Very similar cancor() of package stats, but 1) it allows for X and Y to be rank deficient, 2) it allows for categorical variables and 3) it allows for covariates, 4) more (see below).
cc(X, Y, Zx = NULL, Zy = Zx, numb_cc = NULL, fill.na = FALSE)See x in cancor for a proper documentation.
See y in cancor for a proper documentation.
(=NULL by default) covariates (i.e. nuisance) of X. If different from NULL, the X are residualized by Zx before entering cc(). IMPORTANT: if Zx is not NULL, include the intercept (if appropriate!)
(=Zx by default) covariates of Y. Same use of Zx.
number of (pairs of) canonical correlations to be extracted
replace NA in X and Y with column mean before enter cc().
It returns an acca object. This object contains the same list as returned by cc, while it also contains prop_expl_var which is a list reporting the proportion of explained (total) variance of X and Y by each component (i.e. mode).
L=matrix(rnorm(10),10,1) X=matrix(rnorm(50),10,5) Y=matrix(rnorm(70),10,7) Z=matrix(rnorm(20),10,2)
X[,1]=X[,1]+2*L Y[,1]=Y[,1]+2*L mod=cc(X,Y,Z) mod
ccbiplot(mod)