groupsparsePCA: Group-sparse PCA

Description Usage Arguments Details Value References See Also Examples

View source: R/groupsparsePCA.R

Description

Group-sparse principal component analysis (PCA). Variables are arganized in groups and loadings of variables within the same group are set to zero simultaneously. Three algorithms are proposed for the determination of the group-sparse loadings : on based on a deflation procedure and two based on block optimisation.

Usage

1
2
groupsparsePCA(A, m, lambda, index = 1:ncol(A), block = 1, mu = 1/1:m,
  post = FALSE, center = TRUE, scale = TRUE, init = NULL)

Arguments

A

a n times p numerical data matrix.

m

number of components.

lambda

a vector of dimension m with reduced sparsity parameters (in relative value with respect to the theoretical upper bound). Each reduced sparsity parameter is a value between 0 and 1.

index

vector which defines the grouping of the variables. Components sharing the same number build a group. By default, index=1:ncol(A) corresponds to one variable in each group i.e. (non group) sparse PCA.

block

either 0 or 1. block==0 means that deflation is used if more than one component need to be computed. A block algorithm is otherwise used, that computes m components at once. By default, block=1.

mu

vector of dimension m with the mu parameters (required for the block algorithms only). By default, mu_j=1/j

post

If TRUE the loadings are obtained with post-processing.

center

a logical value indicating whether the variables should be shifted to be zero centered.

scale

a logical value indicating whether the variables should be scaled to have unit variance.

init

a matrix of dimension p times m to initialize the loadings matrix Z in the algorithm.

Details

The principal components are given by the matrix Y=BZ where B is the matrix A which has been centered (if scale=FALSE) or standardized (if scale=TRUE) and Z is the matrix of the sparse loading vectors.

Value

Z

the p times m matrix that contains the m sparse loading vectors

Y

the n times m matrix that contains the m principal components

B

the data matrix centered (if center=TRUE) and scaled (if scale=TRUE)

References

See Also

sparsePCA, pev

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Example from Shen & Huang 2008
 v1 <- c(1,1,1,1,0,0,0,0,0.9,0.9)
 v2 <- c(0,0,0,0,1,1,1,1,-0.3,0.3)
 valp <- c(200,100,50,50,6,5,4,3,2,1)
 n <- 50
 A <- simuPCA(n,cbind(v1,v2),valp,seed=1)
 # 10 scalar variables and 3 group variables of size 4,4,2
 index <- rep(c(1,2,3),c(4,4,2)) 
 Z <- groupsparsePCA(A,2,c(0.5,0.5),index,block=0)$Z #deflation
 Z <- groupsparsePCA(A,2,c(0.5,0.5),index)$Z # block different mu
 Z <- groupsparsePCA(A,2,c(0.5,0.5),index,mu=c(1,1))$Z # block same mu

chavent/sparsePCA documentation built on July 2, 2017, 1:14 a.m.