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

SAS FAQ #107: Decomposing interactions using SAS

Question:

I have obtained a significant interaction effect using PROC GLM or another similar procedure in SAS and now I want to further decompose the interaction. In other words, I want to try to identify significant differences between levels of one variable within each level of the other variable or variables. My design has a two level between-subject factor in which one level represents an experimental group and the other represents a control group. There is also a repeated measures variable that is measured on four separate measurement occasions. Thus, the design is a 2 (experimental vs. control group) by 4 (measurement occasion: trial 1 vs. trial 2 vs. trial 3 vs. trial 4). After obtaining a significant interaction between the experimental condition and the measurement occasions, I want to know within which measurement occasions there were differences between experimental groups and I want to know which measurement occasions differed from each other within each level of the experimental groups.

Answer:

A typical method used to address your question is called the analysis of simple main effects (Winer, Brown, & Michaels, 1971). While you can obtain significant interaction effects using several different procedures in SAS such as PROC GLM and PROC ANOVA, due to the presence of a within-subjects effect in the example, you will need to use PROC MIXED procedure to obtain simple main effects. If your design contains only between-subjects effects, you may use the LSMEANS statement described below in PROC GLM to generate tests of simple main effects. If you used the PROC GLM or PROC ANOVA procedures to conduct omnibus tests, you will first have to transform your data from a multivariate to a univariate format. That is, in multivariate form, your data are arranged so that there is one row per subject and each row contains data for all measurement occasions of the repeated measures variable. To analyze your data in PROC MIXED, you should transform your data into a univariate format in which there is one row per measurement occasion. Thus, if you have four measurement occasions, you will need four rows per subject. For details on how to convert multivariate data to a univariate format, examine SAS FAQ #88.

The syntax shown below illustrates the use of PROC MIXED to obtain contrasts between levels of each variable within all other levels of each of the other variables in an interaction. In this example, there are four levels of the repeated measures variable, trial and two levels of the between-subjects variable, anxiety. The variable, ID represents a subject identification number that is associated with each participant in the study. The variable y1 is the dependent variable representing participants' scores on the experimental task.

Each of the classification variables, trial, anxiety, and ID variables is defined in the CLASS statement. The line that follows  defines the model which requests main effects for anxiety and trial and the interaction effect between these variables. The next line defines the classification variable, trial as a repeated measure variable in the REPEATED trial statement. ID is defined as the variable that indicates which rows of data are associated with an individual subject by the /SUBJECT = ID statement. The last statement on that line, TYPE = UN, is a required statement that indicates the type of covariance matrix used in the model. The line that reads, LSMEANS anxiety*trial /PDIFF, is the line that is used to request the contrasts between levels of the variables in the interaction. Following that line, there are two additional LSMEANS statements that are used to obtain simple main effects tests. The first simple main effect, obtained from the line, LSMEANS anxiety*trial / slice = anxiety, is a three degree of freedom test of the hypothesis that the four trials are equal within each level of the between subjects factor, anxiety. For example, one of the tests that is obtained from the above statement is a test of the hypothesis that trial1 = trial2 = trial3 = trial4 within the experimental condition of the anxiety variable. The final instance of the LSMEANS statement, LSMEANS anxiety*trial / slice = trial, compares each level of the between subjects factor, anxiety, within each level of the within subjects factor, trial. For example, one of the the hypotheses that will be tested by this statement is the contrast between the two levels of the anxiety variable, the control and experimental groups, within trial1.

PROC MIXED DATA = one;
   CLASS anxiety trial ID ;
   MODEL y1 = anxiety trial anxiety*trial ;
   REPEATED trial /SUBJECT = ID TYPE = UN ;
   LSMEANS anxiety*trial / slice = anxiety ;
   LSMEANS anxiety*trial / slice = trial  ;
   LSMEANS anxiety*trial /PDIFF;
RUN;

Running the above syntax will produce several pieces of output including: interation history, convergence status, and  fit statistics, as well as simple main effects and contrasts between the levels of the variables within each level of the other variables in the interaction. A logical place to begin examining your output is with the tests of simple main effects, which appear at the end of the output derived from the sample syntax above. This output is produced by the slice option in the LSMEANS statement and appears in the following table:

Tests of Effect Slices

                                                Num     Den
      Effect           Trial       Anxiety      DF      DF    F Value    Pr > F

      ANXIETY*trial                1             3      10      47.97    <.0001
      ANXIETY*trial                2             3      10      36.16    <.0001
      ANXIETY*trial    TRIAL1                    1      10       0.29    0.6008
      ANXIETY*trial    TRIAL2                    1      10       0.48    0.5025
      ANXIETY*trial    TRIAL3                    1      10       0.01    0.9115
      ANXIETY*trial    TRIAL4                    1      10       1.85    0.2038

The first two lines ot the above table are tests of the hypothesis that all of the repeated measurements are equal within each level of the between subjects variable. For example, for the test of the hypothesis that trial1 = trial2 = trial3 = trial4 within level 1 of anxiety, an F value of 47.97 and a significance level of < .0001 is obtained, indicating that it is very unlikely that the four trials are equal to each other. The last four lines of the table test the hypothesis that levels of the between subjects factor, anxiety, are equal at each trial. For example, the comparison between levels of the between-subjects factor within trial1, produces an F value of .29 and a significance level of .6008, indicating that it is unlikely that there is a a difference between levels of anxiety within trial1.

After examining the Tests of Effect Slices table, you can examine contrasts between levels of variables within levels of other variables. The contrasts are in a table labeled, Differences of Least Squares Means and are similar to the one shown below:

Differences of Least Squares Means

                                                  Standard
Trial     Anxiety  Trial     Anxiety  Estimate    Error     DF   t Value  Pr > |t|

TRIAL1    1        TRIAL2    1          5.1667    0.9804    10     5.27    0.0004
TRIAL1    1        TRIAL3    1          8.3333    1.1702    10     7.12    <.0001
TRIAL1    1        TRIAL4    1         13.0000    1.3006    10    10.00    <.0001
TRIAL1    1        TRIAL1    2         -0.6667    1.2338    10    -0.54    0.6008
TRIAL1    1        TRIAL2    2          4.1667    1.3396    10     3.11    0.0111
TRIAL1    1        TRIAL3    2          8.5000    1.3530    10     6.28    <.0001
TRIAL1    1        TRIAL4    2         10.8333    1.4250    10     7.60    <.0001
TRIAL2    1        TRIAL3    1          3.1667    0.5798    10     5.46    0.0003
TRIAL2    1        TRIAL4    1          7.8333    0.6852    10    11.43    <.0001
TRIAL2    1        TRIAL1    2         -5.8333    1.3396    10    -4.35    0.0014
TRIAL2    1        TRIAL2    2         -1.0000    1.4376    10    -0.70    0.5025
TRIAL2    1        TRIAL3    2          3.3333    1.4501    10     2.30    0.0444
TRIAL2    1        TRIAL4    2          5.6667    1.5175    10     3.73    0.0039
TRIAL3    1        TRIAL4    1          4.6667    0.5578    10     8.37    <.0001
TRIAL3    1        TRIAL1    2         -9.0000    1.3530    10    -6.65    <.0001
TRIAL3    1        TRIAL2    2         -4.1667    1.4501    10    -2.87    0.0166
TRIAL3    1        TRIAL3    2          0.1667    1.4625    10     0.11    0.9115
TRIAL3    1        TRIAL4    2          2.5000    1.5293    10     1.63    0.1332
TRIAL4    1        TRIAL1    2        -13.6667    1.4250    10    -9.59    <.0001
TRIAL4    1        TRIAL2    2         -8.8333    1.5175    10    -5.82    0.0002
TRIAL4    1        TRIAL3    2         -4.5000    1.5293    10    -2.94    0.0147
TRIAL4    1        TRIAL4    2         -2.1667    1.5934    10    -1.36    0.2038
TRIAL1    2        TRIAL2    2          4.8333    0.9804    10     4.93    0.0006
TRIAL1    2        TRIAL3    2          9.1667    1.1702    10     7.83    <.0001
TRIAL1    2        TRIAL4    2         11.5000    1.3006    10     8.84    <.0001
TRIAL2    2        TRIAL3    2          4.3333    0.5798    10     7.47    <.0001
TRIAL2    2        TRIAL4    2          6.6667    0.6852    10     9.73    <.0001
TRIAL3    2        TRIAL4    2          2.3333    0.5578    10     4.18    0.0019

There are four columns in the above table that you use to determine which pairs of means are being compared. These are the two columns labeled, Trial and the two columns labeled Anxiety. Using these columns, you can find a particular comparison in which you are interested. For example, to examine the contrast between trial1 and trial4 in level 1 of Anxiety, you would find the row where both Anxiety columns contained the value 1 and where one of the Trial columns contained trial1 and the other contained trial4. This corresponds to the third row in the table above. Examining this row, the t value of 10.0 and its associated significance level of .0001 indicates that there is a significant difference between these two trials within level 1 of Anxiety. In addition to comparing the effects of repeated measures within a level of the experimental condition, we can also examine whether there is a difference between level 1 and level 2 of the between subjects variable, Anxiety. For example, you could examine the difference between levels of Anxiety within trial1 in the same manner as we approached the repeated measures comparison. First, you would find the row where both Trial columns contained trial1. Next, find the row where one of the Anxiety columns contains the value 1 and the other contains the value 2. This comparison can be found on the fourth row. Examining this row, you can see that there is not a significant difference between the two levels of Anxiety within trial1 as the t value of -.54 and its associated significance level of .6008 indicate that it is unlikely that there is a difference between these two groups.

For more information on specifying models using PROC MIXED, examples, and interpretation of PROC MIXED output, see the SAS Institute publications Advanced General Linear Models with an Emphasis on Mixed Models, The SAS System for Mixed Models, and SAS/STAT Software: Changes and Enhancements through Release 6.12. For more information about simple main effects tests see Statistical Principles in Experimental Design, by B.J. Winer, Donald R. Brown, and Kenneth M. Michaels. You can also click on the Help button in the SAS menu bar and scroll to SAS Help and Documentation for additional information on SAS procedures.

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