My task is to test if there's change in covariance matrix of 6 variables. Values of 6 variables are measured twice from same subjects (3 years between measurements).

How can I do that? I've been doing most of my work using SAS.

  • $\begingroup$ Thank you for your answers. I was thinking of Box M, but I wasn't sure if it applies into repeated measures. Had to get that Rencher's book. I'm quite certain that nested model comparison can be done used for example proc mixed of SAS as well. Nevertheless, thank you! I'm new here and hopefully I'm someday able to provide some answers as well:o) $\endgroup$ – Janne Oct 6 '11 at 5:25
  • $\begingroup$ Welcome to the site! Thanks are very welcome but in this site you should not give them as an answer. You can express your gratitude by upvoting the answers you like and accepting the one you liked the best. You can also add comment to the answer. It also helps if you put in the question the things you tried or think might be of help to solve the problem. $\endgroup$ – mpiktas Oct 6 '11 at 5:46

Assuming that your distributions are multivariate normal (as the tests for covariance matrices tend to assume that, anyway), your null hypothesis is that the two populations differ only by shift. You can test this with a Kolmogorov-Smirnov test on the two groups of data from which their means were subtracted.

Rencher (2002) (Sec. 7.3.2) provides the likelihood ratio test statistic for comparing two matrices (Box M-test) as follows:

$$M=|S_1|^{\nu_1/2} |S_2|^{\nu_2/2}/|S_p|^{(\nu_1+\nu_2)/2}$$

where $S_1$ and $S_2$ are the sample covariance matrices in the two samples, $S_p$ is the pooled covariance matrix, $\nu_1$ and $\nu_2$ are the degrees of freedom (sample size minus 1). Asymptotically, $-2\log M$ follows $\chi^2$ distribution with $p(p+1)/2$ degrees of freedom where $p$ is the size of the matrices. Rencher (2002) also gives the Bartlett-corrected version of the test and an $F$-approximation. This, however, is a two-sample test, rather than the repeated measures test, so it may be somewhat conservative.


You could use structural equation modelling software. This is a sketch of how the process might work in Amos:

  • Add all your variables for time 1 ($X1, ..., X_6$) and time 2 ($Y_1, ..., Y_6$)
  • Draw double headed arrows between all variables (i.e., you are letting the software know that all variances and covariances are free to vary, and thus, your model should perfectly represent data)
  • Name all variances and covariances
  • The above is model 1 (i.e., no equality constraints)
  • Then add equality statements to model 2 (i.e., variances and covariances constrained)
    • Equal variances for corresponding variables at different times points: e.g., var_x1 = var_y1 var_x2 = var_y2 and so on
    • equal covariances for corresponding time points: e.g., cov_x1_x2 = cov_y1_y2 cov_x1_x3 = cov_y1_y3 and so on
  • Examine the difference in fit between the two models
    • model 2 is nested within model 1, so you should be able to use nested model comparison tests like chi-square difference tests.

This can probably be tested with proc mixed (well you have to assume multivariate normality). Stack all data on one column. You'll need then indicators for the subject ID and for the time-point. You'll have to define both subject ID and time point-indicator as class variables. Fit an intercept only model; then use perhaps a repeated statement to fit an unconstrained variance/covariance structure (type=un). Write down the $-2\ln(\mathcal{L})$ where $\mathcal{L}$ is the likelihood) and the degrees of freedom. Then fit a second model, but this time in the repeated statement, use the group= option to make SAS fit separate covariance structures for each time-point (i.e. each time-point is a group). Write down the $-2\ln(\mathcal{L})$ and df. Then conduct the LRT test of no difference in fit using the difference in -2loglikelihoods and dfs between the two models, which should be distributed chi-squared under the null hypothesis of no difference in fit between the two models.

  • $\begingroup$ Welcome to the site, @Andres. You can use LaTeX here. I did so in your post to make it a little neater. $\endgroup$ – Peter Flom - Reinstate Monica Oct 2 '12 at 10:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.