Skip to content
Prev 67843 / 398506 Next

can test the if relationship is significant in cancor?

ronggui wrote:

            
One reference is T. W. Anderson: "An Introduction to Multivariate
    Statistical Analysis", second edition, pages 497-498.
Following the reference above:

cancor.test <- function(obj, N){
   # obj is object returned from cancor
   # N is sample size, which is not contained in the cancor object!
   p1 <- NROW(obj$xcoef)
   p2 <- NROW(obj$ycoef)
   p <- p1 + p2
   r <- length(obj$cor)
   # Calculating Bartlett modification of minus twice log likelihood:
   bartlett <-   -(N-0.5*(p+3))*sum( log( 1-obj$cor^2))
   # which is approximately chi-squared with p1p2 degrees of freedom:
   list(bartlett=bartlett, p.value=pchisq(bartlett, df=p1*p2, 
lower.tail=FALSE))
}


This tests if ALLl the canonical correlations are zero.  Anybody knows 
how good this approximation is,
and how dependent on multivariate normality?

Kjetil