Post hoc Tests for Interactions using SPSS

Using SPSS GLM

The GLM Procedure in SPSS 11.5 allows tests of simple main effects for between and within subjects factors in the EMMEANS subcommand. Simple main effect contrasts are comparisons of means of different levels of one factor within levels of another factor. For instance, a simple main effect for an S(A2B2) design (two levels of each independent variable) might compare the A1B1 mean against the A1B2 mean (a simple main effect comparison for B within A1) or the A1B1 mean against the A2B1 (simple main effect comparison for A within B1). This is handled by the EMMEANS subcommand as follows:


    GLM Y BY A B
     ...
     /EMMEANS=TABLE(A*B) COMPARE(B)
     /EMMEANS=TABLE(A*B) COMPARE(A)
     ...
     /DESIGN.

For the S(A2B2) design, this represents four pairwise comparisons. SPSS will print out comparison values which are redundant for two-tailed t-tests, e.g., A1B1 - A1B2 and A1B2 - A1B1. The criterion significance level should be adjusted by a procedure similar to that described by Bonferroni (see below).

For within-subjects comparisons, the approach is similar.


    GLM PRE POST1 POST2 BY GROUP
     /WSFACTORS=TIME 3
     ...
     /EMMEANS=TABLE(GROUP*TIME) COMPARE(GROUP)
     /EMMEANS=TABLE(GROUP*TIME) COMPARE(TIME)
     ...
     /DESIGN.

The above analysis compares group means at each measurement occasion, then runs pairwise comparisons for pairs of TIME means within each group.

Using SPSS ONEWAY

If GLM is not available or other types of comparisons are needed, it may be more straightforward to carry out the comparisons using the ONEWAY procedure, inputting cell means, sample sizes, MSE and DFE.

A simple way of carrying out the analysis is to use the SPSS ONEWAY procedure to follow up a significant effect, since one can specify posthoc tests such as Tukey or Scheffe or to define specific contrasts of interest. The example below shows how to set up an analysis for a two-way between subjects design, but it can be easily modified to allow analysis of within subjects designs and more complex multiway interactions.

The following information is necessary:

  1. Cell sample size: this is the number of observations used to calculate the cell mean.
  2. Cell mean
  3. MSE: this is the error term which was used in testing the interaction effect. Note that it is not the effect MS.
  4. DFE: these are the degrees of freedom associated with MSE, above.
Sample Program:

The following example presents a follow-up analysis for a significant interaction effect in a 2 x 3 factorial ANOVA.

title 'Analysis for S(A2B3) design'
matrix data 
  variables = cells rowtype_  response / factor=cells
begin data
1 n  20
2 n  20
3 n  20
4 n  20
5 n  20
6 n  20
1 mean  11.18
2 mean   6.79
3 mean   6.33
4 mean   3.99
5 mean   1.59
6 mean   2.49
. mse   11.49
. dfe    72
end data

value labels cells 1 'A1B1' 2 'A1B2' 3 'A1B3' 4 'A2B1' 5 'A2B2' 6 'A2B3' 

oneway response by cells (1,6)
       /matrix=in(*)
       /format=labels
       /ranges=tukey
       /contrast 1 -1 4*0
       /contrast 1 0 0 -1 0 0
       /contrast 1 -1 0 -1 1 0

MATRIX DATA statement:

The program begins with a "MATRIX DATA" statement.

matrix data 
  variables = cells rowtype_  response / factor=cells 

This signals to SPSS that the active file will not contain raw data; rather, it will contain data in a specific type of format-- here cell means, sample sizes, mean squared error, and degrees of freedom for the error term. The first column gives the numbering scheme for the cells. Since the design has two levels for A and three for B, there are six cells altogether. The values of the first variable, CELLS, give information about the cell number for the oneway design. A value of 1 for CELLS corresponds to the A1B1 cell, 2 to the A1B2 cell and so on. The values for CELLS for MSE and DFE will be missing since this information corresponds to the analysis as a whole, not any particular cell. The /FACTOR=CELLS subcommand indicates that the variable CELLS is used to indicate the numbering scheme.

ROWTYPE_ is a system variable which tells SPSS what type of information is contained in the row, here N (cell sample size), MEAN (cell mean), MSE (mean square error term), and DFE (error degrees of freedom).

RESPONSE gives the numeric value for the ROWTYPE_ variable. For instance, the line reading


     1 mean  11.18

indicates that the mean value for the A1B1 cell is 11.18.

Value Labels:

It is a good idea to include value labels to connect the value of CELLS with the corresponding cell in the multiway design. This is especially helpful in labeling the output of posthoc analyses doing comparisons of means.

ONEWAY procedure:

The ONEWAY procedure is specified because it includes CONTRAST statements and posthoc tests such as TUKEY.

oneway response by cells (1,6)
       /matrix=in(*)
       /format=labels
       /ranges=tukey
       /contrast 1 -1 4*0
       /contrast 1 0 0 -1 0 0
       /contrast 1 -1 0 -1 1 0

The output of the omnibus oneway ANOVA should be ignored. The analysis is intended to carry out follow-up contrasts. The oneway analysis results themselves are invalid, but the CONTRAST and RANGES statements will give correct significance information.

MATRIX=IN(*) indicates the type of active file (cell means matrix rather than raw data file) which is input to the procedure. FORMAT=LABELS is used to label the cells in the contrasts. RANGES=TUKEY will give posthoc tests using Tukey's procedure for pairwise comparisons. The differences which are significant at a familywise error rate of .05 are indicated with a * on the output.

Doing Contrasts with ONEWAY:

The CONTRAST statement gives the coefficients (weights) for the contrast which is tested. The form of the contrast is

w1 Xbar1 + w2 Xbar2 + ... + wk Xbark = 0

where Xbari is the cell mean for the ith cell in the oneway design and wi weight given that cell. The weights may be positive, zero, or negative, but should sum to zero for most hypotheses of interest. In order to test the hypothesis that Xbar1 = Xbar3, for example, rewrite the hypothesis as H0: Xbar1 - Xbar3 = 0. For this contrast, the coefficient for Xbar1 is implicitly 1, the coefficient for Xbar3 is -1 and the coefficient for all other cell means is 0. This contrast may be written using the sequence 1 0 -1 0 0 0, or more briefly, 1 0 -1 3*0. This type of contrast is a "simple main effect contrast", i.e., we are testing the hypothesis that there is a significant difference between B1 and B3 at level A1

The last contrast in the above statement tests the hypothesis that A1B1 - A1B2 = A2B1 - A2B2, that is, the change in B from level 1 to level 2 is the same across both levels of A.

Bonferroni procedure:

The output in SPSS will give the significance level of each specified contrast. In order to control the familywise error rate for these comparisons, an adjustment to the criterion alpha level suggested by Bonferroni should be used. This is done by dividing the overall alpha level (often .05) by the total number of contrasts (3 in the above example) to obtain the comparison-wise alpha (here .0167). If there is reason to believe that unequal alphas should be assigned, that is, some comparisons should be evaluated with a larger alpha than others, unequal values may be assigned as long as they sum to the overall alpha level. This decision should be made on the basis of theory, not on the basis of output significance levels.

If the contrasts are pairwise, it is a good idea to compare the contrast conclusions made with the Bonferroni procedure with the output from the Tukey posthoc comparison procedure. The Tukey procedure will show which compairsons are significant when all possible pairwise comparisons are carried out. When a Bonferroni procedure is used for a limited number of comparisons, it may have more power than a Tukey test, but with a larger number of contrasts, this advantage may be lost. Therefore, if a comparison is significant with Tukey and not with Bonferroni, the Tukey result may be used, since the overall error rate will be .05.

Simple Main Effects for Between and Within Subjects Contrasts:

In mixed design ANOVAs with both between and within-subjects factors, simple main effect comparisons may represent two different types of contrasts. If B represents a repeated measure, e.g., pre-post-followup testing occasions, and A represents a between groups measure, e.g., experimental vs. control, simple main effects contrasts will represent very different types of effects depending on the type of effect examined. For example, a contrast of A1B1 vs. A1B2 is a within subjects contrast (pre vs. post for experimentals), whereas a contrast of A1B1 vs. A2B1 is a between subjects contrast (experimental vs. control for pretest). The error term for testing the main effect for the repeated measure (testing occasion) is the same as the error term for testing the interaction between A and B, so contrasts of levels of B within levels of A will use the error term for the interaction.

Typically, between-groups differences are larger than within group differences, so the error term for testing levels of A within levels of B is modified by combining the error terms for the between subjects effect and the within subjects effect. This is done by summing SS(Error/Between) and SS(Error/Within) and dividing by the summed corresponding df. This gives an error term referred to by Kirk (Experimental Design) as MS(w.cell). This is substituted for the previous error term for more contrasts as shown below:

if rowtype_='MSE' response=28.10 
if rowtype_='DFE' response=108

oneway response by cells (1,6)
       /matrix=in(*)
       /format=labels
       /contrast 1 0 0 -1 0 0
       /contrast 0 1 0 0 -1 0
       /contrast 0 0 1 0 0 -1

This is added to the end of the above file, and the total number of contrasts for both analyses should be used to determine the Bonferroni alpha value.