
#THREEWAY ANOVA SPSS CODE CODE#
That’s the “options” statement in the code right after the “car” library is loaded. Second, R needs to have a default set so that it computes sums of squares properly for the mixed design. First, of course, is that R has to be told explicitly that something is a factor. This is, in fact, also a fairly simple modification of the strictly within-subjects code from last time as well. SPSS produces a lot of other output, including multivariate tests and all kinds of default contrasts, but that’s not new here. Finally, SPSS provides the tests of between-subjects effects, which in this case isn’t very interesting, but it is necessary for completeness. SPSS only gives partial eta squared, which is probably the worst of them all, but it’s (very slightly) better than nothing. Same basic effects for all the purely within-subjects parts, but now we pick up the interaction of “group” and drug type, which was evident in the graph.Īlso notice that this time I requested effect size estimates. Next is the big ANOVA table with all the within-subjects factors. How they get away with this year after year, version after version, is simply beyond me. R gets it right, below, so look there to see the correct number. It’s not way off, but it’s a little bit off. SPSS has known about this bug for decades, but hasn’t fixed it yet. If you have a between-subjects factor, SPSS’s computation of the Hunh-Feldt epsilon is WRONG. That looks like this:Īnd here’s our first really, really serious problem. The next thing it produces is the sphericity output, which is now different because of the between-subjects factor. In addition, since there is now a between-subjects effect, it provides a listing of the number of subjects in each between-subjects group, like this: SPSS produces the same printout that shows the pairings between the individual variables and the levels in the repeated-measures design so I won’t repeat that here. This is the same as the entirely within-subjects code, but with the addition of “BY Group” which tells SPSS to include a between-subjects variable. Adding the between-subjects effect actually generates an interaction, which looks like this:Īgain, SPSS makes the easy things easy, and the code to get SPSS to do this is straightforward:

In the within-subjects part of the design, there were main effects of drug type and dosage, but no interactions. The data file is just as described in that last post, with 11 variables: subject number, the group number (the between-subjects variables) an then 9 measurements that make up the 3 x 3 within-subjects part of the design. I’ll continue to use the Elashoff data set that I used in the last post the data are in the file elashoff.xls. That is, an ANOVA with both within-subjects and between-subjects factors.

This post will cover a simple mixed repeated-measures ANOVA. As usual, it’s been far too long since I’ve posted, but the fall semester is coming and I’ve been ramping back up on both SPSS and R lately and I’d like to get in a couple more posts to finish off this series.
