Producing interaction plots in SPSS
Error bar plots for an interaction involving one between subjects factor and one within subjects factor may be produced using the graphical procedure. For example the below syntax produces error bars for responses at each of three time points on the same subject (data in columns t1 and t2) and plots each set for each group.
GRAPH /ERRORBAR(STERROR 1) = t1 t2 BY GROUP.
A line plot of group means with error bars representing 95% Confidence Intervals (as illustrated here) may also be plotted, for example, for data formatted as in the table below.
Trial1 |
Trial2 |
Group |
|||
1 |
2 |
1 |
|||
2 |
5 |
1 |
|||
3 |
4 |
2 |
|||
2 |
3 |
2 |
VARSTOCASES /MAKE score FROM TRIAL1 TO TRIAL2. LIST. compute time=$casenum. compute time=mod(time,2). if(time eq 0) time=2. exe. GRAPH /title = 'time profiles for each group with 95% CIs' /LINE(MULTIPLE) MEAN(score) BY TIME BY GROUP /INTERVAL CI (95) /MISSING=REPORT.
Pallant J (2010) shows how to produce an interaction line plot (without error bars) using the /PLOT subcommand in the GLM procedure in SPSS. For example the below syntax produces an interaction line plot for a mixed ANOVA with one between subjects factor and one within subjects factor.
GLM trial1 trial2 trial3 trial4 BY group /WSFACTOR = trial 4 SIMPLE /METHOD = SSTYPE(3) /CRITERIA = ALPHA(.05) /EMMEANS = TABLES (group*trial) COMPARE (group) ADJ (sidak) /EMMEANS = TABLES (group*trial) COMPARE (trial) ADJ (sidak) /PRINT = DESCRIPTIVE ETASQ OPOWER HOMOGENEITY /PLOT = PROFILE(trial*group) /WSDESIGN = trial /DESIGN = group.
Similarly for two between subjects factors the /PLOT subcommand can be used for two between subjects factors (age group and sex).
UNIANOVA y BY agegp sex /METHOD = SSTYPE(3) /INTERCEPT = INCLUDE /POSTHOC = agegp (TUKEY) /PLOT = PROFILE(agegp*sex) /PRINT = DESCRIPTIVE ETASQ HOMOGENEITY /CRITERIA = ALPHA(.05) /DESIGN = agegp sex agegp*sex.
Reference
Pallant J. (2010). SPSS Survival Manual 4th edition. A step by step guide to data analysis using the SPSS program (Version 18). Open University Press: Maidenhead, Berkshire, UK.