knitr::opts_chunk$set(echo = TRUE)

We give an example below of how to estimate transelliptical CCA and construct asymptotic confidence intervals. The data have radial diffusivity (RD) measures for 20 different white matter tracts measured using diffusion tensor imaging and five different executive function test scores for the same 210 children.

library(transCCA) data("rdef6yr")

After downloading the data we can obtain the point and variance estimates for first transelliptical CCA direction. The RD values for the 20 tracts are treated as our X data matrix and the five EF test scores are treated as the Y data matrix.

ccest <- transCCA(rdef6yr[,2:21],rdef6yr[,22:26],ndir = 1) ccvar <- transCorVar(rdef6yr[,2:21],rdef6yr[,22:26],i = 1)

After obtaining the estimates for the canonical direction and correlation as well as their variances we can use this to construct confidence intervals.

xub <- ccest$xcoef + qnorm(0.975)*sqrt(diag(ccvar$XCoefVar)/210) xlb <- ccest$xcoef - qnorm(0.975)*sqrt(diag(ccvar$XCoefVar)/210) yub <- ccest$ycoef + qnorm(0.975)*sqrt(diag(ccvar$YCoefVar)/210) ylb <- ccest$ycoef - qnorm(0.975)*sqrt(diag(ccvar$YCoefVar)/210) corub <- min(ccest$cancor + qnorm(0.975)*sqrt(ccvar$corVar/210),1) corlb <- max(ccest$cancor - qnorm(0.975)*sqrt(ccvar$corVar/210),0)

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.