eespcaForK {EESPCA} | R Documentation |
Multi-PC version of Eigenvectors from Eigenvalues Sparse Principal Component Analysis (EESPCA)
Description
Computes multiple sparse principal components of the specified data matrix via sequential application of
the Eigenvectors from Eigenvalues Sparse Principal Component Analysis (EESPCA) algorithm.
After computing the first sparse PC via the eespca
function,
subsequent sparse PCs are computing by repeatedly applying eespca
to the residual matrix formed
by subtracting the reconstruction of X
from the original X
.
Multiple sparse PCs are not guaranteed to be orthogonal.
Note that the accuracy of the sparse approximation declines substantially for PCs with very small
variances. To avoid this issue, k
should not be set higher than the number of statistically
significant PCs according to a Tracey-Widom test.
Usage
eespcaForK(X, k=2, max.iter=20, sparse.threshold, lambda.diff.threshold=1e-6,
compute.sparse.lambda=FALSE, sub.mat.max.iter=5, trace=FALSE)
Arguments
X |
An n-by-p data matrix for which the first |
k |
The number of sparse PCs to compute. The specified k must be 2 or greater (for k=1, use
the |
max.iter |
See description for |
sparse.threshold |
See description for |
lambda.diff.threshold |
See description for |
compute.sparse.lambda |
See description for |
sub.mat.max.iter |
See description for |
trace |
See description for |
Value
A list
with the following elements:
"V": Matrix of sparse loadings for the first k PCs.
"lambdas": Vector of variances of the first k sparse PCs.
References
Frost, H. R. (2021). Eigenvectors from Eigenvalues Sparse Principal Component Analysis (EESPCA). arXiv e-prints. https://arxiv.org/abs/2006.01924
See Also
Examples
set.seed(1)
# Simulate 10x5 MVN data matrix
X=matrix(rnorm(50), nrow=10)
# Get first two sparse PCs
eespcaForK(X=X, sparse.threshold=1/sqrt(5), k=2)