Scale multivariate functional data contained in an object of class mfd by subtracting the mean function and dividing by the standard deviation function.

scale_mfd(mfdobj, center = TRUE, scale = TRUE)

Arguments

mfdobj

A multivariate functional data object of class mfd.

center

A logical value, or a fd object. When providing a logical value, if TRUE, mfdobj is centered, i.e. the functional mean function is calculated and subtracted from all observations in mfdobj, if FALSE, mfdobj is not centered. If center is a fd object, then this function is used as functional mean for centering.

scale

A logical value, or a fd object. When providing a logical value, if TRUE, mfdobj is scaled after possible centering, i.e. the functional standard deviation is calculated from all functional observations in mfdobj and then the observations are divided by this calculated standard deviation, if FALSE, mfdobj is not scaled. If scale is a fd object, then this function is used as standard deviation function for scaling.

Value

A standardized object of class mfd, with two attributes, if calculated, center and scale, storing the mean and standard deviation functions used for standardization.

Details

This function has been written to work similarly as the function scale for matrices. When calculated, attributes center and scale are of class fd and have the same structure you get when you use fda::mean.fd and fda::sd.fd.

Examples

library(funcharts)
mfdobj <- data_sim_mfd()
mfdobj_scaled <- scale_mfd(mfdobj)