SparseCCA | R Documentation |
Implement an iterative penalized least squares approach to sparse canonical correlation analysis (SparseCCA) with various penalty functions. Modified Wilms, Ines, and Christophe Croux. "Robust sparse canonical correlation analysis." BMC systems biology 10.1 (2016): 1-13. The original code is accessible https://sites.google.com/view/iwilms/software?authuser=0
SparseCCA( X, Y, Xmethod = c("lasso", "alasso", "gglasso", "SGL"), Ymethod = c("lasso", "alasso", "OLS"), init.method = "SVD", X.groupidx = NULL, standardize = T, max.iter = 50, conv = 5 * 10^-2 )
X |
: n by p exposure data matrix, where n is sample size and p is number of exposures. |
Y |
: n by q outcome data matrix, where n is sample size and q is number of outcomes. |
Xmethod |
: penalty function for the exposure, i.e. penalty function when regressing Y onto X. Possible values are:
|
Ymethod |
: penalty function for the outcome, i.e. penalty function when regressing X onto Y. Possible values are:
|
init.method |
: "Possible two values are:
|
X.groupidx |
: A vector of length p that indicates grouping structure of exposure |
standardize |
: A logical flag for exposure X and outcome Y standardization, prior to fitting the model. |
max.iter |
: A maximum number of iterations |
conv |
: A tolerance value for convergence epsilon |
The function returns a list of 6 objects according to the following order:
ALPHA : An estimated canonical vector of length p corresponding to the exposure data X
BETA : An estimated canonical vector of length q corresponding to the outcome data Y
U_ALL : An estimated canonical variates Xα corresponding to the exposure data X which is a vector of length n
V_ALL : An estimated canonical variates Yβ corresponding to the outcome data Y which is a vector of length n
lamdbaA : A numeric value of the sparsity parameter lambdaA
lamdbaB : A numeric value of the sparsity parameter lambdaB
it : Number of iterations until convergence
data.list <- generate.data(n=500) DATA.X <- data.list$DATA.X DATA.Y <- data.list$DATA.Y SparseCCA.result <- SparseCCA(X=DATA.X,Y=DATA.Y,Xmethod="SGL",Ymethod="lasso",X.groupidx=c(rep(1,4),rep(2,3),rep(3,2),rep(1,3))) str(SparseCCA.result) projection.error(data.list$TRUE.ALPHA,SparseCCA.result$ALPHA) projection.error(data.list$TRUE.BETA,SparseCCA.result$BETA)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.