FAQ/Manzeroes - CBU statistics Wiki
location: FAQ / Manzeroes

# How do I obtain an interaction in SPSS to describe how a fixed covariate influences a repeated measures interaction?

(In this example we assume that the factors in the repeated measures each have two levels).

Suppose we have a covariate, such as age, which does not vary with any levels of any repeated measures factors. We wish to see if age varies with time by valance interaction where each subject has their negative and positive moods (valence) assessed at two time points.

There are three equivalent ways to obtain the age by valence by time interaction using SPSS. One can use the default repeated measures ANOVA procedure, GLM, to compute this interaction.

```GLM
NA1 NA2 NA3 NA4 WITH C1
/WSFACTOR = valence 2 Polynomial time 2 Polynomial
/METHOD = SSTYPE(3)
/CRITERIA = ALPHA(.05)
/WSDESIGN = valence time valence*time
/DESIGN = C1 .```

The MANOVA procedure which is only available in SPSS syntax will compute this interaction but we need to use some trickery. MANOVA, unlike GLM, allows different (varying) covariates to be used for each level of the repeated measures.

Let us suppose our four outcomes are NA1 to NA4 and suppose C1 is the age covariate (see the SPSS data file here.). MANOVA will compute the interaction which is a difference of differences: (NA1-NA2)-(NA3-NA4) correlated with the covariate.

Unfortunately MANOVA requires a covariate to be given for each combination of the levels of the repeated measures factors. MANOVA also correlates the difference representing the two-way valence by time interaction with the difference in the differences of the covariates. Putting these two pieces of information together we need to specify three more covariates, C2 to C4 which all equal zero.

Then (C1 - C2) - (C3 - C4) = C1 so that the difference in the differences of the covariates equals the covariate.

```COMPUTE C2=0.
COMPUTE C3=0.
COMPUTE C4=0.
manova NA1 NA2 NA3 NA4 with c1 c2 c3 c4
/wsfactors valence(2) time(2)
/wsdesign
/print=transform signif(univ).```

The Valence by Time Within subject effect ANOVA table has a term representing the Valence by Time by Covariate interaction (Regression) and a term representing the Valence by Time interaction adjusted for the covariate (Valence by Time).

 Variation SS DF MS F p Within Cells 25.47 7 3.64 Regression .03 1 .03 .01 .929 Valence by Time .00 1 .00 .00 .991

This is equivalent to a correlation between the difference of the differences representing the valence by time interaction:(NA1-NA2)-(NA3-NA4) and the covariate.

```COMPUTE naintd = (NA1-NA2)-(NA3-NA4).
REGRESSION
/MISSING LISTWISE
/STATISTICS COEFF OUTS R ANOVA
/CRITERIA=PIN(.05) POUT(.10)
/NOORIGIN
/DEPENDENT naintd
/METHOD=ENTER C1  .```

The coefficients table shows the valence by time interaction adjusted for the covariate (Constant term) with the valence by time by covariate interaction (C1 term). These are identical to the terms in the ANOVA table outputted above by MANOVA.

 Term B se Beta t p Constant -.042 3.394 -.012 .991 C1 -.125 1.349 -.035 -.093 .929

The same methods may be used for obtaining covariate by valence and covariate by time interactions. For example, to obtain the valence by covariate interaction in MANOVA we use the syntax below.

```COMPUTE NA13 = (NA1 + NA3)/2.
COMPUTE NA24 = (NA2 + NA4)/2.
manova NA13 NA24  with c1 c2
/wsfactors valence(2) time
/wsdesign
/print=transform signif(univ).```

The analogous syntax using a correlation between the covariate and the difference representing the valence effect is given below.

```COMPUTE valenced = 0.5*(NA1+NA2)-0.5(NA3+NA4).
REGRESSION
/MISSING LISTWISE
/STATISTICS COEFF OUTS R ANOVA
/CRITERIA=PIN(.05) POUT(.10)
/NOORIGIN
/DEPENDENT valenced
/METHOD=ENTER C1  .```

It is straightforward to extend GLM to fit interactions involving covariates and factors with three or more levels. MANOVA may also be used to test for interactions involving factors with >2 levels and a covariate by adding in more zero covariates. e.g. if we now have three time points the above example would become the below (this hypothesis needs to be checked!)

```COMPUTE C2=0.
COMPUTE C3=0.
COMPUTE C4=0.
COMPUTE C5=0.
COMPUTE C6=0
manova NA1 NA2 NA3 NA4 NA5 NA6 with c1 c2 c3 c4 c5 c6
/wsfactors valence(2) time(3)
/wsdesign
/print=transform signif(univ).```

Another example using MANOVA to only fit a covariate (cv1) as a between subjects effect and not with an interaction term with a within subjects factor (trial) with three levels in repeated measures ANOVA is given here using syntax

```manova dv1 dv2 dv3 by group(1,2) with (cv1)
/wsfactors trial (3)
/wsdesign trial
/design.```

Note that by simply putting the covariate (cv1) in brackets in the above we have circumvented the earlier problem of having to declare a covariate for each level of repeated measures.

The above results can also be equivalently obtained by running the repeated measures twice: both with the covariate (reading off the results for the between subjects factors) and without the covariate (reading off the results for the within subjects factors).

None: FAQ/Manzeroes (last edited 2015-05-14 09:26:20 by PeterWatson)