funPCA | R Documentation |
FPCA is performed via PACE (Principal Analysis via Conditional Expectation) proposed by Yao et al. (2005).
funPCA(Lt, Ly, mu, cov, sig2 = 0, work.grid = NULL, K = NULL, PVE = 0.99)
Lt |
a list of vectors or a vector containing time points for all curves |
Ly |
a list of vectors or a vector containing observations for all curves |
mu |
a mean function estimated at work.grid |
cov |
a covariance function estimated at work.grid |
sig2 |
a noise variance |
work.grid |
a work grid |
K |
a number of FPCs. If K is NULL, K is selected by PVE. |
PVE |
a proportion of variance explained |
a list contatining as follows:
data |
a list containing Lt and Ly |
lambda |
the first K eigenvalues |
eig.fun |
the first K eigenvectors |
pc.score |
the first K FPC scores |
K |
a number of FPCs |
PVE |
a proportion of variance explained |
work.grid |
a work grid |
eig.obj |
an object of the eigenanalysis |
mu |
a mean function |
cov |
a covariance function |
sig2 |
a noise variance |
### Generate example data
set.seed(100)
x.list <- sim_delaigle(n = 100,
type = "partial",
out.prop = 0.2,
dist = "normal")
x <- list2matrix(x.list)
### Estimate robust covariance function
work.grid <- seq(0, 1, length.out = 51)
cov.obj <- cov_ogk(x,
type = "huber",
bw = 0.1)
### Functional principal component analysis
fpca.obj <- funPCA(Lt = x.list$Lt,
Ly = x.list$Ly,
mu = cov.obj$mean,
cov = cov.obj$cov,
work.grid = work.grid,
PVE = 0.95)
fpc.score <- fpca.obj$pc.score
# ### Give same result in the above
# fpca.obj <- robfpca.partial(x,
# type = "huber",
# PVE = 0.95,
# bw = 0.1)
# fpc.score <- fpca.obj$pc.score
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.