# Decomposing multivariate interactions in SPSS

With some help from SPSS support, lots of experimentation, and an archived post on the SPSS listserv I have come up with the following generalised summary of how /LMATRIX and /MMATRIX can be used to decompose a three-way interaction between two repeated measures factors, X_within and Y_within, and one between-subjects factor, group, assuming that each factor has three levels. [Added: I have now added syntax at the end to deal with a four-way interaction including two between-Ss factors. homepages.gold.ac.uk/aphome/cc13spss.sps was helpful here.] If you spot any mistakes, please let me know!

The syntax for the basic ANOVA might look something like this:

```GLM
XaYa XaYb XaYc XbYa XbYb XbYc XcYa XcYb XcYc BY group
/WSFACTOR = X_within 3 Polynomial Y_within 3 Polynomial
/METHOD = SSTYPE(3)
/CRITERIA = ALPHA(.05)
/WSDESIGN = X_within Y_within X_within*Y_within
/DESIGN = group .```

If I have a significant three-way interaction and want to decompose it, I may be interested in any of the nine simple interaction effects that involve all three levels of the interacting factors, i.e.:

```  (1-3) X_within*group at Ya, Yb, Yc;
(4-6) Y_within*group at Xa, Xb, Xc;
(7-9) X_within*Y_within at G1, G2, G3.```

The following steps provide some insight into how /LMATRIX and /MATRIX are used on their own before coming to how they are used together to find the nine simple interaction effects mentioned above.

(i.) I can use an /LMATRIX subcommand on its own to define a contrast between my between-Ss factor(s), e.g.:

```  /LMATRIX 'difference between group1 and group2'
group 1 -1 0```

In the output from this I get the equivalent of a LSD post-hoc test on the significance of the difference between group1 and group2, averaged across all X and Y. I can run as many of these contrasts as I care to in separate /LMATRIX subcommands.

(ii.) Alternatively I can put more than one contrast into a single /LMATRIX subcommand, separating them by semicolons, e.g.:

```  /LMATRIX 'pooled group difference'
group 1 -1 0;
group 1 0 -1```

In the output from this I get one test per contrast I define, plus an F-test on the "averaged variable", equivalent to a test on the main effect of group.

(iii.) By extension, I can use an /MMATRIX subcommand on its own to define a contrast between two of my within-Ss variables, e.g.:

```  /MMATRIX 'difference between Xa and Xb at Y=a'
XaYa 1  XbYa -1 XcYa 0```

The /MMATRIX could also be written using ALL, so:

```  /MMATRIX 'Difference between Xa and Xb at Y=a'
all 1 0 0 -1 0 0 0 0 0```

In the output from this I the equivalent of an unadjusted pairwise comparison (averaging across all groups) between Xa and Xb at Y=a, which could also have been produced through an /EMMEANS subcommand. I can only run one /MMATRIX subcommand at once.

(iv.) However, I can put more than one contrast into a single /MMATRIX subcommand, separating them by semicolons, e.g.:

```  /MMATRIX 'Pooled X_within difference at Y=a'
XaYa 1  XbYa -1 XcYa 0;
XaYa 1  XbYa 0  XcYa -1```

In the output from this I get one test per contrast I define, plus a multivariate test that is the equivalent of the simple main effect of X_within at Y=a (which I could also produce through an /EMMEANS subcommand).

(v.) I can combine /LMATRIX and /MMATRIX subcommands in the same routine to test for the simple interaction effects between factors, e.g.:

```  /LMATRIX 'interaction X_within*group at Y=a'
group 1 -1 0;
group 1 0 -1
/MMATRIX 'Pooled X_within difference at Y=a'
XaYa 1  XbYa -1 XcYa 0;
XaYa 1  XbYa 0  XcYa -1```

Notice that the /LMATRIX description has changed, because inclusion of the /MMATRIX modifies the reported results. In the output from this I get several different results:

First is the K-matrix of contrast results, which in this instance contains four results. L1 column 1 is a test on the difference between (XaYa minus XbYa) for group 1 and (XaYa minus XbYa) for group 2; L1 column 2 is a test on (XaYa minus XcYa) for group 1 and (XaYa minus XcYa) for group 2. L2 is the same as L1 except the comparison is between groups 1 and 3. In other words these are tests on the relative size of selected pairwise comparisons.

Second is a multivariate test result, which is a test on the interaction X_within*group at Y=a. The above syntax can therefore be generalized to find any of the simple interaction effects involving one-within and one between-Ss factor at fixed levels of the other within-Ss factor, i.e., 1-6 from the beginning.

Finally are two univariate test results, which (I think) are a test of the simple interaction effect of between group and Xa/Xb at Ya, and between group and Xa/Xc at Ya, respectively.

(vi.) The last combination of /MMATRIX and /LMATRIX needed to solve for simple interaction effects 7-9 (involving two within-Ss factors at fixed levels of the between-Ss factor) requires three different /LMATRIX subcommands to fix the level of the between-subjects factor group:

```  /LMATRIX 'interaction X_within*Y_within at G=1'
Intercept 1 group 1 0 0
/LMATRIX 'interaction X_within*Y_within at G=2'
Intercept 1 group 0 1 0
/LMATRIX 'interaction X_within*Y_within at G=3'
Intercept 1 group 0 0 1```

Note that these are *not* pooled. To get the interaction of the two within factors X and Y use:

```  /MMATRIX 'pooled X_within and Y_within differences'
all 1 -1 0 -1 1 0 0 0 0;
all 1 0 -1 0 0 0 -1 0 1```

Here these are pooled over the two linearly independent possibilities: the interaction of 1 and 2, and of 1 and 3. The third, the interaction of levels 2 and 3, is omitted because it is redundant.

This produces three multivariate results, one for each level of G for the simple interaction effect of X_within*Y_within. There are also three pairs of univariate results: I think the first is a test of the simple interaction effect of Xa/Xb * Ya/Yb at the relevant level of group; the second is a test of the simple interaction effect of Xa/Xc *Ya/Yc at the relevant level of group.

(vii.) If there is more than one between-Ss factor then the /LMATRIX subcommand can be adjusted accordingly. For example, if I have two between-Ss factors (sex [two levels] and condition [2 levels]) and two within-Ss factors (X_within and Y_within as above) and am interested in the simple interaction effect of sex*condition*X_within at each level of Y_within, my syntax will look like:

```  /LMATRIX 'interaction sex*condition*X_within at Y=a'
sex*condition 1 -1 -1 1;
/MMATRIX 'Pooled X_within difference at Y=a'
XaYa 1  XbYa -1 XcYa 0;
XaYa 1  XbYa 0  XcYa -1```

If in the same situation I were interested in the simple interaction effect of sex*X_within at each level of Y_within (i.e., I am not interested in variation with condition), I will still need to include higher order terms involving the between-Ss factors of interest in my /LMATRIX subcommand; to complicate matters the coefficients in the higher order effect need to add up to the coefficients in the lower order effect, so decimal or fractional values are needed, viz.:

```  /LMATRIX 'interaction sex*X_within at Y=a'
sex 1 -1 sex*condition .5 -.5 .5 -.5
/MMATRIX 'Pooled X_within difference at Y=a'
XaYa 1  XbYa -1 XcYa 0;
XaYa 1  XbYa 0  XcYa -1```

Nicholas Gibson

--
Psychology and Religion Research Programme
Faculty of Divinity, University of Cambridge
West Road, Cambridge, CB3 9BS, UK

tel +44 (0)1223 763010 · fax +44 (0)1223 763003
www.divinity.cam.ac.uk/pcp/personnel/nicholas.html