Learn R Programming

fda (version 6.2.0)

sd.fd: Standard Deviation of Functional Data

Description

Evaluate the standard deviation of a set of functions in a functional data object.

Usage

sd.fd(fdobj)
std.fd(fdobj)
stdev.fd(fdobj)
stddev.fd(fdobj)

Value

a functional data object with a single replication that contains the standard deviation of the one or several functions in the object fdobj.

Arguments

fdobj

a functional data object.

Details

The multiple aliases are provided for compatibility with previous versions and with other languages. The name for the standard deviation function in R is 'sd'. Matlab uses 'std'. S-Plus and Microsoft Excal use 'stdev'. 'stddev' was used in a previous version of the 'fda' package and is retained for compatibility.

References

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

mean.fd, sum.fd, center.fd

Examples

Run this code
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)
lipbasis <- create.bspline.basis(liprange, nbasis, norder)

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

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

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

lipstdfd <- sd.fd(lipfd)
oldpar <- par(no.readonly=TRUE)
plot(lipstdfd)
par(oldpar)
all.equal(lipstdfd, std.fd(lipfd))
all.equal(lipstdfd, stdev.fd(lipfd))
all.equal(lipstdfd, stddev.fd(lipfd))

Run the code above in your browser using DataLab