smooth.sparse.mean: Smooth the mean function of sparse data

View source: R/smooth.sparse.mean.R

smooth.sparse.meanR Documentation

Smooth the mean function of sparse data

Description

Do a smoothing of the mean function for sparse data that is either given as a list or as a matrix with NAs. The smooth is done by basis expansion with the functional basis "type"; if !(lambda == 0) then the second derivative is penalized (int2Lfd(2)).

Usage

smooth.sparse.mean(data, time ,rng = c(0, 1), type = "", nbasis = NULL, 
                  knots = NULL, norder = NULL, lambda = NULL)

Arguments

data

a matrix object or list – If the set is supplied as a matrix object, the rows must correspond to argument values and columns to replications, and it will be assumed that there is only one variable per observation. If y is a three-dimensional array, the first dimension corresponds to argument values, the second to replications, and the third to variables within replications. – If it is a list, each element must be a matrix object, the rows correspond to argument values per individual. First column corresponds to time points and followins columns to argument values per variable.

time

Array with time points where data was taken. length(time) == ncol(data)

rng

an array of length 2 containing the lower and upper boundaries for the rangeval of argument values

type

Type of basisfd for smoothing the mean estimate function. "bspline", "fourier", "exp", "const" or "mon"

nbasis

An integer variable specifying the number of basis functions

knots

a vector specifying the break points if type == "bspline"

norder

an integer specifying the order of b-splines if type == "bspline"

lambda

a nonnegative real number specifying the amount of smoothing to be applied to the estimated functional parameter

Value

a functional data object containing a smooth of the mean.

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.


fda documentation built on Sept. 30, 2024, 9:19 a.m.