Does anyone know where I can find an algorithm, as well as an R
implementation of it, to carry out sparse principal component analysis (PCA)?
2 Answers
Another good package is the elasticnet package that Zou and Hastie put out. It has the function spca
.
Be careful to select a good value of $\lambda$, the sparsity parameter (or vector of them).
I would be curious to know which package ends up working better for you since the other package mentioned by @Stephan Kolassa is a year newer and is by Hastie's coauthor, Tibshirani.
Which function in which package are you interested in? All code is available on CRAN. For instance, if you are thinking about the PMA
package (just the first one I found by googling for "CRAN Sparse Principal Components Analysis"), you can find the source code here.
-
$\begingroup$ Thank you very much for your useful answer.I want to use general form of lasso which elasticnet to select a group of highly correlated variables.if you have any idea which is better please tell me your opinion. $\endgroup$ Commented Jun 7, 2014 at 7:16
R
code. If it were changed to request an algorithm I think there would be no controversy. $\endgroup$