Mean curve calculation for dense or sparse functional data.
GetMeanCurve(Ly, Lt, optns = list())
A list containing the following fields:
A vector of length nWorkGrid containing the mean function estimate.
A vector of length nWorkGrid. The internal regular grid on which the mean estimation is carried out.
The selected (or user specified) bandwidth for smoothing the mean function.
A list of actually-used options relevant to the mean function calculation.
A list of n vectors containing the observed values for each individual. Missing values specified by NA
s are supported for dense case (dataType='Dense'
).
A list of n vectors containing the observation time points for each individual corresponding to y. Each vector should be sorted in ascending order.
A list of options control parameters specified by list(name=value)
. See `Details'.
Available control options are
The bandwidth value for the smoothed mean function (using 'CV' or 'GCV'); positive numeric - default: determine automatically based on 'methodBwMu'
The bandwidth choice method for the mean function; 'GMeanAndGCV' (the geometric mean of the GCV bandwidth and the minimum bandwidth),'CV','GCV' - default: 5% of the support
The type of design we have (usually distinguishing between sparse or dense functional data); 'Sparse', 'Dense', 'DenseWithMV', 'p>>n' - default: determine automatically based on 'IsRegular'
Plot mean curve; logical - default: FALSE
Smoothing kernel choice, common for mu and covariance; "rect", "gauss", "epan", "gausvar", "quar" - default: "gauss"; dense data are assumed noise-less so no smoothing is performed.
The number of folds to be used for mean and covariance smoothing. Default: 10
The method to estimate the mean and covariance in the case of dense functional data; 'cross-sectional', 'smooth' - default: 'cross-sectional'
The number of bins to bin the data into; positive integer > 10, default: NULL
Should the data be binned? 'FORCE' (Enforce the # of bins), 'AUTO' (Select the # of bins automatically), 'OFF' (Do not bin) - default: 'AUTO'
The user-defined smoothed mean function; list of two numerical vector 't' and 'mu' of equal size, 't' must cover the support defined 'Ly' - default: NULL
Pick the largest bandwidth such that CV-error is within one Standard Error from the minimum CV-error, relevant only if methodBwMu ='CV' and/or methodBwCov ='CV'; logical - default: FALSE
set.seed(1)
n <- 20
pts <- seq(0, 1, by=0.025)
sampWiener <- Wiener(n, pts)
mu = sin(2*pi*pts)
sampWiener <- Sparsify(t(t(sampWiener) + mu), pts, 10)
res = GetMeanCurve(Ly = sampWiener$Ly, Lt = sampWiener$Lt, optns = list(plot = TRUE))
Run the code above in your browser using DataLab