This function is used to perform functional principal component analysis.
getPCA(data, nbasis, ncomp, gp, emodel = c("classical", "robust"))A list object with the following components:
A functional data object for the eigenfunctions.
A matrix of principal component scores.
A functional data object for the mean function.
A functional data object for B-spline basis expansion.
A matrix of the B-spline basis expansion functions.
An integer denoting the computed number of functional principal components. If the input ``ncomp'' is NULL, then, the output ncomp equals to the number of functional principal components whose usage results in at least 95% explained variation.
A vector containing the grid points for the functional data for \(X(s)\).
A character vector denoting the method used for functional principal component decomposition.
An \(n \times p\)-dimensional data matrix for functional data \(X(s)\), where \(n\) denotes the sample size and \(p\) denotes the number of grid points for \(X(s)\).
An integer specifying the number of B-spline basis expansion functions used to approximate the functional principal components.
An integer specifying the number of functional principal components to be computed.
A vector containing the grid points for the functional data for \(X(s)\).
Method to be used for functional principal component decomposition. Possibilities are "classical" and "robust".
Ufuk Beyaztas and Han Lin Shang
The functional principal decomposition of a functional data \(X(s)\) is given by $$X(s) = \bar{X}(s) + \sum_{k=1}^K \xi_k \psi_k(s),$$ where \(\bar{X}(s)\) is the mean function, \(\psi_k(s)\) is the \(k\)-th weight function, and \(\xi_k\) is the corresponding principal component score which is given by $$\xi_k = \int (X(s) - \bar{X}(s)) \psi_k(s) ds.$$ When computing the estimated functional principal components, first, the functional data is expressed by a set of B-spline basis expansion. Then, the functional principal components are equal to the principal components extracted from the matrix \(D \varphi^{1/2}\), where \(D\) is the matrix of basis expansion coefficients and \(\varphi\) is the inner product matrix of the basis functions, i.e., \(\varphi = \int \varphi(s) \varphi^\top(s) ds\). Finally, the \(k\)-th weight function is given by \(\psi_k(s) = \varphi^{-1/2} a_k\), where \(a_k\) is the \(k\)-th eigenvector of the sample covariance matrix of \(D \varphi^{1/2}\).
If emodel = "classical", then, the standard functional principal component decomposition is used as given by
Ramsay and Dalzell (1991).
If emodel = "robust", then, the robust principal component algorithm of Hubert, Rousseeuw and Verboven (2002) is used.
J. O. Ramsay and C. J. Dalzell (1991) "Some tools for functional data analysis (with discussion)", Journal of the Royal Statistical Society: Series B, 53(3), 539-572.
M. Hubert and P. J. Rousseeuw and S. Verboven (2002) "A fast robust method for principal components with applications to chemometrics", Chemometrics and Intelligent Laboratory Systems, 60(1-2), 101-111.
P. Filzmoser and H. Fritz and K Kalcher (2021) pcaPP: Robust PCA by Projection Pursuit, R package version 1.9-74, URL: https://cran.r-project.org/web/packages/pcaPP/index.html.
J. L. Bali and G. Boente and D. E. Tyler and J.-L. Wang (2011) "Robust functional principal components: A projection-pursuit approach", The Annals of Statistics, 39(6), 2852-2882.
sim.data <- generate.ff.data(n.pred = 5, n.curve = 200, n.gp = 101)
Y <- sim.data$Y
gpY <- seq(0, 1, length.out = 101) # grid points
rob.fpca <- getPCA(data = Y, nbasis = 20, ncomp = 4, gp = gpY, emodel = "robust")
Run the code above in your browser using DataLab