College of Natural Sciences
 
FAQs
This is for IE7 to hold div open

SAS FAQ #40: Testing homogeneity of cell covariance matrices with SAS

Question:

How can I use SAS to test the homogeneity of the within-subject covariance matrices for the cells defined by the between-subject factors?

Answer:

Create a classification variable representing cell membership, and then use PROC DISCRIM to test for homogeneous cell covariance matrices.

For example, suppose that the following PROC GLM syntax had been written to perform a repeated measures ANOVA for a grouping factor with two levels, a treatment factor with three levels, and a single repeated factor with three levels (measurements).

PROC GLM DATA = repeated ;
    CLASS group exertype ;
    MODEL pulse1 pulse2 pulse3 = group exertype group*exertype ;
    REPEATED repdfact 3 / PRINTE ;
RUN ;

The PRINTE option produces a sphericity test of the homogeneity of the covariance matrices of the orthogonal components of the transformed variables defined by the cells of the within-subject factors. To obtain a test of the homogeneity of the covariance matrices of the cells defined by all between-subject factors, study the following example.

DATA discrim ;
    SET repeated ;
    IF group = 1 AND exertype = 1 THEN intterm = 1 ;
    IF group = 1 AND exertype = 2 THEN intterm = 2 ;
    IF group = 1 AND exertype = 3 THEN intterm = 3 ;
    IF group = 2 AND exertype = 1 THEN intterm = 4 ;
    IF group = 2 AND exertype = 2 THEN intterm = 5 ;
    IF group = 2 AND exertype = 3 THEN intterm = 6 ;
RUN;

PROC DISCRIM METHOD = NORMAL POOL = TEST ;
    CLASS intterm ;
    VAR pulse1 pulse2 pulse3 ;
RUN;

You will be interested in that part of the DISCRIM output that is labeled "Test of Homogeneity of Within Covariance Matrices". This output includes the chi-square value, degrees of freedom, and p-value produced by the test of the null hypothesis that the cell covariance matrices are homogeneous.

If you have a large number of between-subjects cells to create, consider using a single ARRAY statement rather than the multiple IF statements as shown above.

If you have more questions about this test, see the SAS/STAT User's Guide, Version 6, Fourth Edition, pp. 677-772. Example 3, and the output shown on p. 749, is particularly relevant. You can also click on the Help button in the SAS menu bar and scroll to SAS Help and Documentation for more information.

In general, you may want to consider using the MIXED procedure to conduct repeated measures ANOVA. MIXED features a wide array of covariance structures you can use to fit a more appropriate model to your particular dataset. You can also use MIXED to test sphericity and the homogeneity of covariance matrices. You can test sphericity by comparing the model fit criteria for a model with TYPE=HF (Huynh-Feldt) versus a model with covariance structure TYPE=UN (unstructured) specified on the REPEATED statement. Similarly, you can test homogeneity of covariance matrices across groups by testing a model with GROUP=groups*exertype versus a model with no GROUP= option on the REPEATED statement.

If you have further questions, send E-mail to stats@ssc.utexas.edu.