spca               package:elasticnet               R Documentation

_S_p_a_r_s_e _P_r_i_n_c_i_p_a_l _C_o_m_p_o_n_e_n_t_s _A_n_a_l_y_s_i_s

_D_e_s_c_r_i_p_t_i_o_n:

     Using an alternating minimization algorithm to minimize the SPCA
     criterion.

_U_s_a_g_e:

     spca(x,K,para,type=c("predictor","Gram"),sparse=c("penalty","varnum"),use.corr=FALSE,lambda=1e-6,max.iter=200,trace=FALSE,eps.conv=1e-3)

_A_r_g_u_m_e_n_t_s:

       x: A matrix. It can be the predictor matrix or the sample
          covariance/correlation matrix.  

       K: Number of components 

    para: A vector of length K. All elements should be positive. If
          sparse="varnum", the elements integers. 

    type: If type="predictor", x is the predictor matrix. If
          type="Gram", the function asks the user to provide the sample
          covariance or correlation matrix.   

  sparse: If sparse="penalty", para is a vector of 1-norm penalty
          parameters. If sparse="varnum", para defines the number of
          sparse loadings to be obtained. This option is not discussed
          in the paper given below, but it is convenient in practice.

  lambda: Quadratic penalty parameter. Default value is 1e-6.

use.corr: Perform PCA on the correlation matrix? This option is only
          effective when the argument type is set "data".

max.iter: Maximum number of iterations.

   trace: If TRUE, prints out its progress.

eps.conv: Convergence criterion.

_D_e_t_a_i_l_s:

     PCA is shown to be equivalent to a regression-type optimization
     problem, then sparse loadings are obtained by imposing the 1-norm
     constraint on the regression coefficients. If x is a microarray
     matrix, use arrayspc().

_V_a_l_u_e:

     A "spca" object is returned.  The below are some quantities which
     the user may be interested in:  

loadings: The loadings of the sparse PCs 

     pev: Percentage of explained variance 

 var.all: Total variance of the predictors 

_A_u_t_h_o_r(_s):

     Hui Zou, Trevor Hastie and Robert Tibshirani

_R_e_f_e_r_e_n_c_e_s:

     Zou, H., Hastie, T. and Tibshirani, R. (2004) "Sparse principal
     component analysis" _Technical report, Statistics Dept. Stanford
     University_.

_S_e_e _A_l_s_o:

     princomp, arrayspc

_E_x_a_m_p_l_e_s:

     data(pitprops)
     out1<-spca(pitprops,K=6,type="Gram",sparse="penalty",trace=TRUE,para=c(0.06,0.16,0.1,0.5,0.5,0.5))
     ## print the object out1
     out1
     out2<-spca(pitprops,K=6,type="Gram",sparse="varnum",trace=TRUE,para=c(7,4,4,1,1,1))
     out2
     ## to see the contents of out2
     names(out2) 
     ## to get the loadings
     out2$loadings

