-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmean.fd.Rd
82 lines (69 loc) · 1.92 KB
/
mean.fd.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
\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{
\method{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}.
}
\references{
Ramsay, James O., Hooker, Giles, and Graves, Spencer (2009),
\emph{Functional data analysis with R and Matlab}, Springer, New York.
Ramsay, James O., and Silverman, Bernard W. (2005),
\emph{Functional Data Analysis, 2nd ed.}, Springer, New York.
Ramsay, James O., and Silverman, Bernard W. (2002),
\emph{Applied Functional Data Analysis}, Springer, New York.
}
\seealso{
\code{\link{stddev.fd}},
\code{\link{var.fd}},
\code{\link{sum.fd}},
\code{\link{center.fd}}
\code{\link{mean}}
}
\examples{
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)
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)$fd
str(weather.fd.mean <- mean.fd(weather.fd))
par(oldpar)
}
\keyword{smooth}