| tpm | R Documentation |
Returns the leading sparse principal component of a matrix using the truncated power method.
tpm(Sigma, k, maxIter = 200L, verbose = TRUE, timeLimit = 10L)
Sigma |
A matrix. The correlation or covariance matrix, whose sparse PCs will be computed. |
k |
An integer. Target sparsity of the PC. |
maxIter |
(optional) An integer. Maximum number of iterations of the algorithm. Default 200. |
verbose |
(optional) A Boolean. Controls console output. Default TRUE. |
timeLimit |
(optional) An integer. Maximum time in seconds. Default 10. |
An object with 3 fields: 'x_best' (p x 1 array containing the sparse PC), 'objective_value', 'runtime'.
Yuan, X. T., & Zhang, T. (2013). Truncated power method for sparse eigenvalue problems. The Journal of Machine Learning Research, 14(1), 899-925.
library(datasets)
TestMat <- cor(datasets::mtcars)
tpm(TestMat, 4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.