= How do I perform a repeated measures ANOVA using MINITAB (and use a similar approach to obtain post-hoc tests on a repeated measures factor in SPSS)? =
Mixed (Between and within factor ANOVA) can be fitted in Minitab using the GLM procedure. Details are [[attachment:rmmtb.pdf|in this pdf file.]] The trick is to declare subjects as a random factor and a nested term involving subjects of form subjects(A) where A is a between subjects factor. In each case the data is entered in 'long format' with separate columns for all the factors including between subject factors, within subject factors and subjects. Data in repeated measures 'wide format' can be converted into 'long format' using syntax given [[FAQ/restwb| here.]]
An analogous approach works in SPSS using UNIANOVA. For the attached MINITAB examples we need for a repeated measures ANOVA with two within subject factors, wit1 and wit2, and a subject factor, sub, the following code in SPSS.
{{{
UNIANOVA
y BY wit1 wit2 sub
/RANDOM = sub
/METHOD = SSTYPE(3)
/INTERCEPT = INCLUDE
/CRITERIA = ALPHA(.05)
/DESIGN = wit1 wit2 sub wit1*wit2 wit1*sub wit2*sub wit1*wit2*sub .
}}}
For one repeated measures factor, wit1, one between subjects factor, bet1, and a subjects factor, sub, we run the syntax below.
{{{
UNIANOVA
y BY bet wit1 sub
/RANDOM = sub
/METHOD = SSTYPE(3)
/INTERCEPT = INCLUDE
/CRITERIA = ALPHA(.05)
/DESIGN = BET wit1 sub(bet) bet*wit1.
}}}
More generally for two or more between subjects factors the nesting term for subjects is nested within all combinations of the between subjects factors so for example for an anova for two between subject factors, bet and bet2, and a subjects factor, sub, the nested term is sub(bet*bet2) as below:
{{{
UNIANOVA
y BY bet bet2 sub
/RANDOM = sub
/METHOD = SSTYPE(3)
/INTERCEPT = INCLUDE
/CRITERIA = ALPHA(.05)
/DESIGN = BET bet2 sub(bet*bet2) bet*bet2.
}}}
A useful consequence of formulating a repeated measures design using a between subjects ANOVA procedure is that a range of post-hocs tests on a within subjects factor can now be outputted (this is not possible using the GLM repeated measures procedure). The below syntax uses Tukey's test to compare four groups comprising the within subjects factor, WIT. Note: to re-emphasise, as the UNIANOVA routine is usually used to fit between subjects designs, the data input file is in long format (as above) consisting of four columns: y, wit, bet and sub as shown in this SPSS data file [[attachment:wit.sav|here.]]
{{{
UNIANOVA
y BY wit bet sub
/RANDOM = sub
/METHOD = SSTYPE(3)
/INTERCEPT = INCLUDE
/CRITERIA = ALPHA(.05)
/POSTHOC = WIT (TUKEY)
/DESIGN = wit bet sub(bet) bet*wit.
}}}
Finally for a one-way repeated measures ANOVA with no between subject factors
we run the below.
{{{
UNIANOVA
y BY wit sub
/RANDOM = sub
/METHOD = SSTYPE(3)
/INTERCEPT = INCLUDE
/CRITERIA = ALPHA(.05)
/POSTHOC = WIT (TUKEY)
/DESIGN = wit sub.
}}}
You can also fit a two-way repeated measures using the syntax below on 'long format' data in the between subjects format in SPSS but the Tukey test is not much use in this case as it will only compare levels of the main effects and not the w1*w2 interaction. Only fixed main effects appearing or implied on the DESIGN subcommand are valid test effects for post-hoc testing using the /POSTHOC subcommand. /EMMEANS can be used, however, for comparing interaction means using repeated measures formatted data.
{{{
UNIANOVA
y BY wit1 wit2 sub
/RANDOM = sub
/METHOD = SSTYPE(3)
/INTERCEPT = INCLUDE
/CRITERIA = ALPHA(.05)
/POSTHOC = WIT1 (TUKEY)
/DESIGN = wit1 wit2 wit1*wit2 wit1(sub) wit2(sub).
}}}