# R or python implementation of sparse PCA for p>n

According to this paper, there are 2 algorithms to perform sparse PCA. One is better if $p>n$. I need to run SPCA on a $2000\times12000$ matrix so I am looking for an implementation of this algorithm. There is an sparse PCA implementation in sklearn and one in the R package elasticnet but I think they are the $n>p$ version.

Where can I find an implementation of this algorithm?

• – D L Dahly Dec 3 '13 at 9:53
• This question appears to be off-topic because it is about looking for an algorithm. – gung - Reinstate Monica Jan 7 '14 at 3:15

Have a look at the nsprcomp package for R. It implements sparse and/or non-negative PCA and is efficient for $p \gg n$ because it only uses the data matrix and not the covariance matrix. A comparison to arrayspc from the elasticnet package is given in this blog post.
I don't know about the $n<p$ constraint, but it might be worth trying out and looking at the performance either way.