# What is the correct way to add and analyse covariates in a 2x3 Mixed ANOVA in SPSS

I am trying to analyze whether different intervention groups scored differently in questionnaire measures before and after an intervention.

The first independent variable is time at 2 levels (pre-intervention and post-intervention). The second independent variable is Intervention group at 3 levels.

I also want to include age and gender as covariates in order to control for them. Gender and age have both been included as a numeric variable type within SPSS as when i tried to code gender as a string variable type (e.g. M=1, F=2) it would not let me analyse the data.

I try to use a general linear model --> Repeated measures and then classify my within subjects factor as the scores on the two questionnaires at 2 levels. The intervention is put in as the Between-subjects factor and the gender and age are included as covariates.

The problems I am having:

1. Have I encoded gender into SPSS correctly for this kind of analysis?
2. Am I doing the correct kind of analysis for what I am trying to achieve?
3. Without including the covariates, there is a significant difference between pre-intervention and post-intervention (no significant interaction with the groups) however when including the covariates, intervention * gender is now only significant but the intervention is no longer significant. What does this mean?

Any help would be appreciated.

While you can use a repeated measures ANOVA, I would recommend conducting an ANCOVA, as advocated by Vickers & Altman (2001). This analysis adjusts the changes from baseline to follow-up for the baseline measurements. Specifically, this is a multiple regression with the follow-up measurements as dependent and the baseline measurements, dummy variables for the groups and other variables you want to adjust for as independent variables.

Here is a simulated dataset in SPSS. The data have to be in the wide-format, as shown here:

ID is an identifier for each subject, group indicates the group, sex indicates the gender and t1 and t2 are the measurements at baseline and follow-up.

We can visualize the data using boxplots:

The analysis itself is simple. Using the menu, go Analyze $\rightarrow$ General Linear Model $\rightarrow$ Univariate. I find it much easier to use the syntax directly. For this example, the syntax could look like this:

UNIANOVA t2 BY group sex WITH t1
/METHOD=SSTYPE(3)
/INTERCEPT=INCLUDE
/SAVE=PRED ZRESID
/PRINT PARAMETER
/CRITERIA=ALPHA(.05)
/DESIGN=t1 group sex group.


The results are as follows:

We can see that there is evidence that the baseline value t1 has an influence on the follow-up measurements (this is often not of interest). The line called group provides evidence that the change from baseline to follow-up differ between the groups. On the other hand, there is little evidence for a difference among genders with respect to change.

Next, we can compare the groups pairwise:

These comparisons were corrected using Bonferroni adjustments. We can see that there is evidence that groups 1 vs. 2 and 2 vs. 3 differ with respect to their changes from baseline to follow up. Specifically, group 2 changed 5.65 points more on average compared to group 1. Group 3 changed 6.5 points less compared to group 2. (Note that these comparisons are calculated at the mean of the baseline measurements.)

This analysis can be expanded by including interaction terms or adding more covariates. One could, for example, include an interaction term of sex with group, allowing to test whether the change in each group depends on the gender.

Don't forget to perform model diagnostics as applicable to all (multiple) linear regression models: The syntax above saves the predicted values and the standardized residuals. These can subsequently be used to create a scatterplot of predicted values vs. residuals (Tukey-Anscombe plot) or a Q-Q-plot of the residuals.

• Thank you very much for the well thought out and detailed reply. I appreciate it very much! Would you be able to expand on how to enter the different variables as a univariate test?
– Nick
Mar 27, 2018 at 17:26
• @Nick I don't fully understand what you mean by "enter the different variables as a univariate test". What do you want to test exactly? Mar 28, 2018 at 6:42