mean.fd: Mean of Functional Data

View source: R/fd.R

mean.fdR Documentation

Mean of Functional Data


Evaluate the mean of a set of functions in a functional data object.


## S3 method for class 'fd'
mean(x, ...)



a functional data object.


Other arguments to match the generic function for 'mean'


a functional data object with a single replication that contains the mean of the functions in the object fd.


Ramsay, James O., Hooker, Giles, and Graves, Spencer (2009), Functional data analysis with R and Matlab, Springer, New York.

Ramsay, James O., and Silverman, Bernard W. (2005), Functional Data Analysis, 2nd ed., Springer, New York.

Ramsay, James O., and Silverman, Bernard W. (2002), Applied Functional Data Analysis, Springer, New York.

See Also

stddev.fd, var.fd, sum.fd, center.fd mean


oldpar <- par(no.readonly=TRUE)
## 1.  univeriate:  lip motion
liptime  <- seq(0,1,.02)
liprange <- c(0,1)

#  -------------  create the fd object -----------------
#       use 31 order 6 splines so we can look at acceleration

nbasis <- 51
norder <- 6
lipbasis <- create.bspline.basis(liprange, nbasis, norder)

#  ------------  apply some light smoothing to this object  -------

lipLfdobj <- int2Lfd(4)
lipLambda <- 1e-12
lipfdPar  <- fdPar(fd(matrix(0,nbasis,1),lipbasis), lipLfdobj, lipLambda)

lipfd <- smooth.basis(liptime, lip, lipfdPar)$fd
names(lipfd$fdnames) = c("Normalized time", "Replications", "mm")

lipmeanfd <- mean.fd(lipfd)

## 2.  Trivariate:  CanadianWeather
dayrng <- c(0, 365)

nbasis <- 51
norder <- 6

weatherBasis <- create.fourier.basis(dayrng, nbasis)

weather.fd <- smooth.basis(day.5, CanadianWeather$dailyAv,

str(weather.fd.mean <- mean.fd(weather.fd))

fda documentation built on May 29, 2024, 11:26 a.m.