cv.growth {growthrate} | R Documentation |
cross validation error
Description
Computes the cross validation error resulting from the removal of the data at a given interior observation time as a function of the infinitessimal standard deviation sigma
on a grid of k
equispaced values in the interval [a
, b
].
Usage
cv.growth(data, tobs, d, K, a, b, r)
Arguments
data |
Input matrix of size N (subjects) times n (observation times). Each column contains the heights (of all subjects) at a given observation time, each row contains the heights (at the observation times) for a given subject. |
tobs |
Row vector of n observation times (in increasing order, same for each subject). |
d |
Number of points on the fine time-grid (between the first and last observation times in |
K |
Number of points on the grid for |
a |
Minimum value for |
b |
Maximum value for |
r |
Index of the interior observation time in |
Details
The data for the r
th observation time (for a given
r
) are removed and the mean squared error of the reconstructed data at that time point computed over the grid for
sigma
.
Value
sigmavec |
|
CVer |
Cross validation error at each value of |
Author(s)
Sara Lopez-Pintado and Ian W. McKeague
Maintainer: Ian W. McKeague <im2131@columbia.edu>
References
Lopez-Pintado, S. and McKeague, I. W. (2013). Recovering gradients from sparsely observed functional data. Biometrics 69, 396-404 (2013). http://www.columbia.edu/~im2131/ps/growthrate-package-reference.pdf
Examples
## Not run:
## example using the height data provided in the package
## there are 7 observation times (age in years):
## WARNING: cv.growth is time-consuming. This example uses only part of the data.
data(height_data);
ht = height_data[1:100,];
tobs=c(0,1/3,2/3,1,3,4,7);
cvg=cv.growth(ht, tobs, 100, 21, 1, 5, 2);
## Plot of the cross validation error as a function of sigma:
plot(cvg$sigmavec, cvg$CVer, xlab="Sigma", ylab="Cross validation error");
## Value of sigma that minimizes the cross validation error:
sigmaopt=cvg$sigmavec[which(cvg$CVer==min(cvg$CVer))];
## End(Not run)