| mspca | R Documentation |
Returns multiple sparse principal component of a matrix using an iterative deflation heuristic.
mspca(
Sigma,
r,
ks,
maxIter = 200L,
verbose = TRUE,
feasibilityConstraintType = 0L,
feasibilityTolerance = 1e-04,
stallingTolerance = 1e-08,
maxIterTPM = 20L,
timeLimitTPM = 20L,
restartsAfterFirstIter = 10L
)
Sigma |
A matrix. The correlation or covariance matrix, whose sparse PCs will be computed. |
r |
An integer. Number of principal components (PCs) to be computed. |
ks |
A list of integers. Target sparsity of each PC. |
maxIter |
(optional) An integer. Maximum number of iterations of the algorithm. Default 200. |
verbose |
(optional) A Boolean. Controls console output. Default TRUE. |
feasibilityConstraintType |
(optional) An integer. Type of feasibility constraints to be enforced. 0: orthogonality constraints; 1: uncorrelatedness constraints. Default 0. |
feasibilityTolerance |
(optional) A float. Tolerance for the violation of the orthogonality constraints. Default 1e-4 |
stallingTolerance |
(optional) A float. Controls the objective improvement below which the algorithm is considered to have stalled. Default 1e-8 |
maxIterTPM |
(optional) An integer. Maximum number of random restarts of the truncated power method (inner iteration) for the first outer iteration. Default 20. |
timeLimitTPM |
(optional) An integer. Maximum time in seconds for the truncated power method (inner iteration). Default 20. |
restartsAfterFirstIter |
(optional) An integer. Maximum number of random restarts of the truncated power method (inner iteration) for outer iterations >= 2. Default 10. |
An object with 4 fields: 'x_best' (p x r array containing the sparse PCs), 'objective_value', 'feasibility_violation', 'runtime'.
library(datasets)
TestMat <- cor(datasets::mtcars)
mspca(TestMat, 2, c(4,4))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.