Standardize functional data (z-score normalization)
Source:R/fdata.R, R/irregFdata.R
standardize.RdTransforms each curve to have mean 0 and standard deviation 1. This is useful for comparing curve shapes regardless of their level or scale.
Usage
standardize(fdataobj)
# S3 method for class 'fdata'
standardize(fdataobj)
# S3 method for class 'irregFdata'
standardize(fdataobj)Examples
fd <- fdata(matrix(rnorm(100) * 10 + 50, 10, 10), argvals = seq(0, 1, length.out = 10))
fd_std <- standardize(fd)
# Check: each curve now has mean ~0 and sd ~1
rowMeans(fd_std$data)
#> [1] 1.110223e-16 -2.831069e-16 8.881784e-17 -3.885781e-17 -2.331468e-16
#> [6] 8.465451e-17 1.998401e-16 -3.663736e-16 -3.774758e-16 5.551115e-17
apply(fd_std$data, 1, sd)
#> [1] 1 1 1 1 1 1 1 1 1 1