[R] Difference between two correlation matrices

Fernando Henrique Ferraz P. da Rosa feferraz at ime.usp.br
Fri Nov 19 23:17:01 CET 2004

michael watson (IAH-C) writes:
> Hi 
> Now a more theoretical question.  I have two correlation matrices - one
> of a set of variables under a particular condition, the other of the
> same set of variables under a different condition.  Is there a
> statistical test I can use to see if these correlation matrices are
> "different"?
> Thanks
> Mick

        If you can assume multivariate normality, you can use a test of
hypothesis to test if the covariance+ matrices are equal. Such a test is
described for example in Anderson (1958)*.

        I am currently working on implementing some multivariate tests
on R (sphericity test, equality of covariance matrices, etc). Attached
follows a preliminary version of varcomp(): this function implements the
test for equality of covariance matrices under multivare normality
aforementioned. It takes as first argument a list with the covariance
matrices and a vector n indicating the sample size used to calculate
each of them.

        Example of use: Suppose you have 3 estimated covariance matrices
S1, S2, S3, from a sample of 3 bivariate normal populations with unkown
covariance matrices. The sample size for each Si, was 11,12,11.

        S1 <- matrix(c(7.17,19.47,19.47,113.38),byrow=T,ncol=2)
        S2 <- matrix(c(20.33,59.78,59.78,229.02),byrow=T,ncol=2)
        S3 <- matrix(c(5.22,17.33,17.33,112.88),byrow=T,ncol=2)

  Will test H0: Sigma1 = Sigma2 = Sigma3, vs. H1: at least two of
them are different from each other. 

        Beware though that it's still work in progress, I've tested it
for a few examples and it gave sensible results, but it still needs some

* An Introduction to Multivariate Analysis, Wiley.
+ note that a correlation matrix is a special type of a covariance
matrix, so you can use a test of hypothesis designed for covariance

Fernando Henrique Ferraz P. da Rosa

More information about the R-help mailing list