knitr::opts_chunk$set(echo = TRUE)
To install this package (in R):
#if devtools is not installed yet: # install.packages("devtools") library(devtools) install_github("livioivil/acca")
L=matrix(rnorm(100),100,1) X=matrix(rnorm(500),100,5) Y=matrix(rnorm(700),100,7) Z=matrix(rnorm(200),100,2) X[,1]=X[,1]+2*L Y[,1]=Y[,1]+2*L library(acca) mod=cc(X,Y,Z) mod ggbiplot2(mod) L=matrix(rnorm(10),10,1) X=matrix(rnorm(20),10,2) Y=matrix(rnorm(30),10,3) X[,1]=X[,1]+2*L Y[,1]=Y[,1]+2*L X=scale(X) Y=scale(Y) S11=cov(X) ei=eigen(S11) S11sqrtinv=ei$vectors%*%diag(ei$values^-.5)%*%t(ei$vectors) S22=cov(Y) ei=eigen(S22) S22sqrtinv=ei$vectors%*%diag(ei$values^-.5)%*%t(ei$vectors) S12=cov(X,Y) sv=svd(S11sqrtinv%*%S12%*%S22sqrtinv) sv mod=acca::cc(X,Y) mod modcc=CCA::cc(X,Y) modcc$cor modcc$xcoef mod$xcoef sv$u plot(mod$scores$xscores[,1],modcc$scores$xscores[,1]) mod0=cancor(X, Y, xcenter = TRUE, ycenter = TRUE) mod0$xcoef mod$xcoef modcc$xcoef mod0$ycoef modcc$ycoef mod$ycoef/mod0$ycoef[,-3] mod$ycoef/modcc$ycoef
Testing null correlation of the canonical compoments
mod=cc_inference(mod,B = 1000,numb_cc = 3) summary(mod)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.