Description Usage Arguments Details Value Author(s) See Also Examples
Performs a functional principal component analysis.
1 |
data |
Dataset in |
dimBase |
Dimension of the basis. |
fpcCtrl |
Control object, see |
regTime |
Optional vector of time points if original data is in |
A functional principal component analysis is
executed. Therefore, a smoothed mean curve and a smoothed covariance
matrix are built and upon these, eigenvalues and eigenvectors are
calculated. If average
=TRUE, data is stored in a sparse matrix
of dimension (nr_curves x nr_union_time_points) and matrix operations
speed up the calculation. However, if the curves do not have many
common time points, average should be set to FALSE. If the smoothing
parameter (either for the mean or for the covariance) specified in
fpcCtrl
led to NA-values in the smoothing process, it is
automatically increased by 10% of its actual value and a warning is
printed. This process is repeated until smoothing is possible.
yreg |
Smoothed dataset evaluated at union time points. |
time |
Vector of union time points. |
meanfcn |
Smoothed mean function. |
covfcn |
Smoothed covariance matrix. |
base |
Basis functions. |
eigval |
Eigenvalues. |
coeffs |
Coefficients for the basis functions. |
varprop |
Proportion of the variance. |
Christina Yassouridis
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ##Generate a regular dataset
set.seed(2804)
ds <- sampleFuncy(obsNr=40, timeNr=15, reg=TRUE)
##Execute functional principal component analysis
res <- fpca(Data(ds))
matplot(res$base,type='l')
##Generate an irregular dataset
set.seed(2804)
ds <- sampleFuncy(obsNr=30, k=5, timeNrMin=5, timeNrMax=7, reg=FALSE)
##Execute functional principal component analysis
res <- fpca(Data(ds))
matplot(res$base, type='l', main="First 4 basis functions.")
|
Loading required package: flexclust
Loading required package: grid
Loading required package: lattice
Loading required package: modeltools
Loading required package: stats4
Loading required package: splines
Warning message:
In fpc(Yin = Yin, Tin = Tin, Tout = NULL, isobs = isobs, dimBase = dimBase, :
Another smoothing parameter-9.192 is used for covariance smoothing on transformed points.
Warning message:
system call failed: Cannot allocate memory
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.