Answer edited to implement encouraging and constructive comment by @Ferdi
I would like to:
- provide an answer with a full contained script
- mention one can also test more general custom contrasts using the /TEST command
- argue this is necessary in some cases (ie the EMMEANS COMPARE combination is not enough)
I assume to have a database with columns: depV, Group, F1, F2. I implement a 2x2x2 mixed design ANOVA where depV is the dependent variable, F1 and F2 are within subject factors and Group is a between subject factor. I further assume the F test has revealed that the interaction Group*F2 is significant. I therefore need to use post hoc t-tests to understand what drives the interaction.
MIXED depV BY Group F1 F2
/FIXED=Group F1 F2 Group*F1 Group*F2 F1*F2 Group*F1*F2 | SSTYPE(3)
/METHOD=REML
/RANDOM=INTERCEPT | SUBJECT(Subject) COVTYPE(VC)
/EMMEANS=TABLES(Group*F2) COMPARE(Group) ADJ(Bonferroni)
/TEST(0) = 'depV(F2=1)-depV(F2=0) differs between groups'
Group*F2 1/4 -1/4 -1/4 1/4
Group*F1*F2 1/8 -1/8 1/8 -1/8 -1/8 1/8 -1/8 1/8
/TEST(0) = 'depV(Group1, F2=1)-depV(Group2, F2=1)' Group 1 -1
Group*F1 1/2 1/2 -1/2 -1/2
Group*F2 1 0 -1 0
Group*F1*F2 1/2 0 1/2 0 -1/2 0 -1/2 0 .
In particular the second t-test corresponds to the one performed by the EMMEANS command. The EMMEANS comparison could reveal for example that depV was bigger in Group 1 on the condition F2=1.
However the interaction could also be driven by something else, which is verified by the first test: the difference depV(F2=1)-depV(F2=0) differs between groups, and this is a contrast you cannot verify with the EMMEANS command (at least I did not find an easy way).
Now, in models with many factors it is a bit tricky to write down the /TEST line, the sequence of 1/2, 1/4 etc, called L matrix. Typically if you get the error message: "the L matrix is not estimable", you are forgetting some elements. One link that explains the receipt is this one: https://stats.idre.ucla.edu/spss/faq/how-can-i-test-contrasts-and-interaction-contrasts-in-a-mixed-model/
Pre-post designs are quite common and the standard method is to use the pre-measure as a control variable and the post-measure as the response with the binary variable as the covariate.
This is quite simple:
m0 <- lm(Post ~ Pre, data=dat)
m1 <- lm(Post ~ Pre+Condition, data=dat)
anova(m1,m0) # test for difference in mean(Post) after control for Pre
m2 <- lm(Post ~ Pre*Condition, data=dat)
anova(m2, m1) # test for interaction: different slopes in the two Conditions
If this had been with repeated measures within subject (i.e, pre-post measures in each Condition, you would need to specify the error structure in the aov
function: You could compare this model in R where the errors for each Condition are nested in subject-ID:
m1 <- aov(post ~ pre + Condition+Error(subjID/Condition), data=dat)
Ratio variables are notorious for being poorly behaved statistically (i.e., often having significant skew and blowing up as the denominator goes near zero.) However, if the denominator is far from zero, you should not make the mistake of looking at the raw distributions and deciding that the data fail the assumptions needed for validity of linear methods. You need to look at the residuals before conducting any test. (And even then, there is some doubt whether minor departures from normality invalidate inferences.) The help page for aov
warns you to use orthogonal contrasts. There was an article in R-News several years ago on multi-variate (as opposed to multi-variable) methods and this would provide further options for model comparisons and measures of sphericity.
Another option is offered by the Anova
function in John Fox's car
package.
A useful link: http://blog.gribblelab.org/2009/03/09/repeated-measures-anova-using-r/
Another approach is to analyze the pairwise differences, but that approach has flaws.
Best Answer
From what you said, it seems like you have an AxBxCx(DxS) design. A-C are between subjects. D is pre/post (within subjects). In SPSS you would want a wide data format, where each subject would be a row in your data set.
Then you would do a repeated-measures GLM, adding as a factor (call it "test" or whatever) with 2 levels, and name your response (below that, on the same dialog box) "score" or whatever.
On the next screen, select expert guided disguised and add those to "Between-subjects" factors. You should be off to the races then. This might help as a guide to the screens.