spca: Rank-1 Sparse Principal Components Analysis

Description Usage Arguments Details Value References Examples

View source: R/spca.R

Description

Uses the L1-penalized matrix decomposition in pmd to obtain sparse principal components analysis of rank-1. This function is called by mspca, which should be used in applications.

Usage

1
2
3
4
5
6
7
8
9
spca(
  Z,
  c = 1,
  vstart = NULL,
  maxit = 100,
  eps = sqrt(.Machine$double.eps),
  center = TRUE,
  scale = FALSE
)

Arguments

Z

Matrix to be decomposed

c

L1-norm bound for u, the left singular vector. Feasible solutions are available when values greater than or equal to 1. For values larger than sqrt(nrow(Z), it has no effect.

vstart

Optional starting value for the v vector

maxit

Maximum number of iterations

eps

Stopping criterion, and absolute error tolerance on the mean squared reconstruction error

center

Logical indicating whether the columns of Z should be mean-centered

scale

Logical indicating whether the standard deviations of the column of Z should be set equal to 1

Details

Note that in the SPC implementation, the overall mean of the input matrix is set equal to zero before analysis when the (default) center = TRUE. This is not done here, or even given as an option.

Value

A list with the penalized singular value decomposition(d, u, v), the vector of errors (error), and the number of iterations (iteration). The output from mspca is more appropriate for PCA, and that function should be used.

References

Witten, D. M., Tibshirani, R., & Hastie, T. (2009). A penalized matrix decomposition, with applications to sparse principal components and canonical correlation analysis. Biostatistics, 10(3), 515-534.

Examples

1
2
3
4
5
set.seed(1)
Z <- matrix(rnorm(600), nrow = 20, ncol = 30)

spca(Z, c = 1.6)
spca(Z, c = 1.5)

schoonees/spca documentation built on Jan. 31, 2021, 6:21 p.m.