eespcaCV {EESPCA} | R Documentation |
Cross-validation for Eigenvectors from Eigenvalues Sparse Principal Component Analysis (EESPCA)
Description
Performs cross-validation of EESPCA to determine the optimal
sparsity threshold. Selection is based on the minimization of reconstruction error.
Based on the cross-validation approach of Witten et al. as implemented by the SPC.cv
method in the PMA package.
Usage
eespcaCV(X, max.iter=20, sparse.threshold.values, nfolds=5,
lambda.diff.threshold=1e-6, compute.sparse.lambda=FALSE,
sub.mat.max.iter=5, trace=FALSE)
Arguments
X |
See description for |
max.iter |
See description for |
sparse.threshold.values |
Vector of threshold values to evaluate via cross-validation.
See description for |
nfolds |
Number of cross-validation folds. |
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:
"cv": The mean of the out-of-sample reconstruction error computed for each threshold.
"cv.error": The standard deviations of the means of the out-of-sample reconstruction error computed for each threshold.
"best.sparsity": Threshold value with the lowest mean reconstruction error.
"best.sparsity.1se": Threshold value whose mean reconstruction error is within 1 standard error of the lowest.
"nonzerovs": Mean number of nonzero values for each threshold.
"sparse.threshold.values": Tested threshold values.
"nfolds": Number of cross-validation folds.
References
Frost, H. R. (2021). Eigenvectors from Eigenvalues Sparse Principal Component Analysis (EESPCA). arXiv e-prints. https://arxiv.org/abs/2006.01924
Witten, D. M., Tibshirani, R., and Hastie, T. (2009). A penalized matrix decomposition, with applications to sparse principal components and canonical correlation analysis. Biostatistics, 10(3), 515-534.
See Also
Examples
set.seed(1)
# Simulate 10x5 MVN data matrix
X=matrix(rnorm(50), nrow=10)
# Generate range of threshold values to evaluate
default.threshold = 1/sqrt(5)
threshold.values = seq(from=.5*default.threshold, to=1.5*default.threshold, length.out=10)
# Use 5-fold cross-validation to estimate optimal sparsity threshold
eespcaCV(X=X, sparse.threshold.values=threshold.values)