eespcaCV | R Documentation |
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.
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)
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 |
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.
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.
eespca
, PMA{SPC.cv}
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.