https://github.com/cran/fda
Raw File
Tip revision: 229f7206c9196b18bb88d6ee7c3c775e8b28e5d3 authored by J. O. Ramsay on 01 June 2009, 00:00:00 UTC
version 2.1.3
Tip revision: 229f720
mean.fd.Rd
\name{mean.fd}
\alias{mean.fd}
\title{
  Mean of Functional Data
}
\description{
Evaluate the mean of a set of functions in a functional data object.
}
\usage{
mean.fd(x, ...)
}
\arguments{
\item{x}{
a functional data object.
}
\item{...}{Other arguments to match the generic function for 'mean'}
}
\value{
a functional data object with a single replication
that contains the mean of the functions in the object \code{fd}.
}
\seealso{
  \code{\link{stddev.fd}}, 
  \code{\link{var.fd}}, 
  \code{\link{sum.fd}}, 
  \code{\link{center.fd}}
  \code{\link{mean}}
}
\examples{
##
## 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(lipbasis, lipLfdobj, lipLambda)

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

lipmeanfd <- mean.fd(lipfd)
plot(lipmeanfd)

##
## 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,
            weatherBasis)

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

}
% docclass is function
\keyword{smooth}
back to top