Skip to contents

Transforms 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)

Arguments

fdataobj

An object of class 'fdata'.

Value

A standardized 'fdata' object where each curve has mean 0 and sd 1.

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