Description Usage Arguments Details Value Author(s) References Examples
Decomposes functional observations using functional principal components analysis. A mixed model framework is used to estimate scores and obtain variance estimates.
1 2 3 4 5 |
data |
the user must supply |
col |
tfd-vector of regular data with a common grid and irregular or sparse data |
Y.pred |
if desired, a matrix of functions to be approximated using the FPC decomposition. |
argvals |
the argument values of the function evaluations in |
random.int |
If |
nbasis |
number of B-spline basis functions used for estimation of the mean function and bivariate smoothing of the covariance surface. |
pve |
proportion of variance explained: used to choose the number of principal components. |
npc |
prespecified value for the number of principal components (if
given, this overrides |
var |
|
simul |
logical: should critical values be estimated for simultaneous confidence intervals? |
sim.alpha |
1 - coverage probability of the simultaneous intervals. |
useSymm |
logical, indicating whether to smooth only the upper
triangular part of the naive covariance (when |
makePD |
logical: should positive definiteness be enforced for the covariance surface estimate? |
center |
logical: should an estimated mean function be subtracted from
|
cov.est.method |
covariance estimation method. If set to |
integration |
quadrature method for numerical integration; only
|
Altered from 'refund::fpca.sc', this function allows users to apply the function directly
on dataframes with a tfd column, specified in the col
argument.
This function computes a FPC decomposition for a set of observed curves, which may be sparsely observed and/or measured with error. A mixed model framework is used to estimate curve-specific scores and variances.
An object of class fpca
containing:
Yhat |
FPC approximation (projection onto leading components)
of |
Y |
the observed data |
scores |
n \times npc matrix of estimated FPC scores. |
mu |
estimated mean
function (or a vector of zeroes if |
efunctions
|
d \times npc matrix of estimated eigenfunctions of the functional covariance, i.e., the FPC basis functions. |
evalues |
estimated eigenvalues of the covariance operator, i.e., variances of FPC scores. |
npc |
number of FPCs: either the supplied |
argvals |
argument values of eigenfunction evaluations |
sigma2 |
estimated measurement error variance. |
diag.var |
diagonal elements of the covariance matrices for each estimated curve. |
VarMats |
a list containing the estimated
covariance matrices for each curve in |
crit.val |
estimated critical values for constructing simultaneous confidence intervals. |
Gaeun Kim gk2501@columbia.edu and Jeff Goldsmith jeff.goldsmith@columbia.edu
Di, C., Crainiceanu, C., Caffo, B., and Punjabi, N. (2009). Multilevel functional principal component analysis. Annals of Applied Statistics, 3, 458–488.
Goldsmith, J., Greven, S., and Crainiceanu, C. (2013). Corrected confidence bands for functional data using principal components. Biometrics, 69(1), 41–51.
Staniswalis, J. G., and Lee, J. J. (1998). Nonparametric regression analysis of longitudinal data. Journal of the American Statistical Association, 93, 1403–1418.
Yao, F., Mueller, H.-G., and Wang, J.-L. (2005). Functional data analysis for sparse longitudinal data. Journal of the American Statistical Association, 100, 577–590.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ## Not run:
library(ggplot2)
library(reshape2)
data(dti)
fit.cca = fpca.tfd(data = dti, col = cca)
fit.mu = data.frame(mu = fit.cca$mu,
n = 1:ncol(fit.cca$Yhat))
fit.basis = data.frame(phi = fit.cca$efunctions, #the FPC basis functions.
n = 1:ncol(fit.cca$Yhat))
## plot estimated mean function
ggplot(fit.mu, aes(x = n, y = mu)) + geom_path() +
theme_bw() + ggtitle("Estimated mean function of corpus callosum")
## plot the first two estimated basis functions
fit.basis.m = melt(fit.basis, id = 'n')
ggplot(subset(fit.basis.m, variable %in% c('phi.1', 'phi.2')),
aes(x = n, y = value, group = variable, color = variable)) +
geom_path() + theme_bw() + ggtitle("First two estimated FPC basis functions")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.