Page 1
ThreeWay Analyses of Variance Containing One or More Repeated Factors
We have already covered the oneway repeated measures design and the A x (B x S) design. I shall not present computation of the (A x B x S) totally withinsubjects twoway design, since it is a simplification of the (A x B x C x S) design that I shall address. If you need to do an (A x B x S) ANOVA, just drop the Factor C from the (A x B x C x S) design.
A X B X (C X S) ANOVA
In this design only one factor, C, is crossed with subjects (is a within-subjects factor), while the other two factors, A and B, are between-subjects factors.
Howell (page 470 of the 8th edition of Statistical Methods for Psychology) presented a set of data with two betweensubjects factors (Gender and Group) and one withinsubjects factor (Time). One group of adolescents attended a behavioral skills training (BST)program designed to teach them how to avoid HIV infection. The other group attended a traditional educational program (EC). The dependent variable which we shall analyze is a measure of the frequency with which the participants used condoms during intercourse. This variable is measured at four times: Prior to the treatment, immediately after completion of the program, six months after completion of the program, and 12 months after completion of the program.
SAS
Obtain the data file, MAN_1W2B.dat, from my StatData page and the program file, MAN_1W2B.SAS, from my SAS programs page. Note that the first variable is Gender, then Group number, then dependent variable scores at each level (pretest, posttest, 6 month follow-up, and 12 month follow-up) of the withinsubjects factor, Time. “Group|Gender” factorially combines the two betweensubjects factors, and “Time 4” indicates that the variables Pretest, Posttest, FU6, and FU12 represent the 4level withinsubjects factor, Time.
By not specifying “NOUNI” I had SAS compute Group|Genderunivariate ANOVAs on Pretest, Posttest, FU6, and FU12 . These provide the simple interaction tests of GroupGender at each level of Time that we might use to followup a significant triple interaction, but our triple interaction is not significant. However, our TimeGroup interaction is significant, so we can use these univariate ANOVAs for simple main effects tests of Group at each level of Time. Note that the groups differ significantly only at the time of the 6 month follow-up, when the BST participants used condoms more frequently (M = 18.8) than did the EC participants (M = 8.6).
Mauchly’s criterion shows that we have no problem with the sphericity assumption. Both multivariate and univariate tests of within-subjects effects show that the only such effect which is significant is the Time x Group interaction, for which we have already inspected the simple main effects of group at each time.
Among the between-subjects effects, only the main effect of gender is significant. Since this effect is across all levels of the time variable, we need to collapse across levels of time to get the appropriate means on which female participants differed from male participants. If you look in the data step, you will see that I used the MEAN(OF....) function to compute, for each participant, mean condom use across times. While we could use proc means by gender to compute the relevant means, I used PROC ANOVA instead, doing a Gender x Group ANOVA and asking for means. I did this to demonstrate to you that the test on gender in the earlier analysis was a test of the difference between genders on mean condom use collapsed across times. Notice that the F statistic for the effect of gender on mean condom use, 6.73, is identical to that computed in the earlier analysis. The means show that male participants reported using condoms during intercourse more than did female participants.
Although we followed the significant Time x Group interaction with an analysis of the simple main effects of group at each time, we could have chosen to test the simple main effects of time in each group. The last invocation of PROC ANOVA does exactly that, after sorting by group. Additionally, I requested contrasts between the pretest and each post-treatment measure. Using individual error terms, the omnibus analysis indicates that the use of condoms in the BST group did not change significantly across time. One could elect to ignore that analysis and look instead at the specific contrasts -- after all, if the treatment was effective and had a lasting effect, mean condom use at all three times after treatment should be higher than prior to treatment, but could be approximately equal to one another across those post-treatment times, diluting the effect of the time variable and leading to an omnibus effect that falls short of significance. Those contrasts show that condom use among the BST participants was significantly greater at the six month follow-up (M = 18.8) than at the time of the pretest (M = 13.45).
Among the members of the EC control group, mean condom use did change significantly across time. The specific contrasts shows that mean condom use in this group at the time of the six month follow-up was significantly less (M = 8.6) than at the time of the pretest (M = 19.8).
Here is an interaction plot of the changes in condom use across time for the two groups.
Annotated SAS Output
SPSS: Point and Click
Obtain the SPSS data file MAN_1W2B.sav from my SPSS data page. Bring it into SPSS. Analyze, General Linear Model, Repeated Measures. Define repeated factor “Time(4)” with variables “pretest,” “posttest,” “fu6,” and “fu12.” Scoot “gender” and “group” into the “Between-Subjects Factor(s)” box.
Click “Plots.” Scoot “Time” into the “Horizontal Axis” box and “group” into the “Separate Lines” box. Click “Add,” “Continue.”
Click “Options.” Scoot “gender” and “group*Time” into the “Display means for” box. Click “Continue,” “OK.” As before, you will find a significant main effect of gender and a significant Time x Group interaction.
To test the simple main effect of the grouping variable at each level of time do this: Click “Analyze,” “General Linear Model,” “Univariate.” Scoot “pretest” into the “Dependent Variable” box and “gender” and “group” into the “Fixed Factor(s)” box. Click “OK.” Look only at the effect of groups – gender was included in the model only to remove its effect from what otherwise would be error variance. You will see that the groups did not differ significantly on the pretest. Now go back to the “Univariate” window and replace “pretest” with “posttest” and click “OK.” Again, the difference is not significant. Compare the groups on “fu6” (significant) and “fu12” (not significant) in the same way.
To test the simple main effect of time within each group do this: Click “Data,” “Split File.” Select “Organize output by groups” and “Sort the file by grouping variables.” Scoot “group” into the “Groups Base on” box. Click “OK.” Click “Analyze,” “General Linear Model,” “Repeated Measures.” Click “Define.” Remove “group” and “gender” from the “Between Subjects Factor(s)” box. Click “Contrasts.” Change the contrast to “Simple,” with “First” being the reference category (to compare pretest scores with each of the other times). Click “Continue,” “OK.” Sphericity is not a problem in either group, so you are free to use the unadjusted univariate results. You will find that the changes across time fell short of statistical significance in the BST group but were significant in the ECU group (where frequency of use of condoms declined across time). To make pairwise comparisons within the ECU you could create the necessary difference scores and for each test the null that the mean difference score in the population is zero. If you are afraid of the Type I boogie man under the bed, you can apply a Bonferroni adjustment.
SPSS MANOVA Syntax
Obtain the SPSS data file MAN_1W2B.sav from my SPSS data page. Bring it into SPSS and then paste the following code into the syntax window and run the program:
manova pretest to fu12 by gender(0,1) group(1,2) / wsfactors = time(4) /
print=error(cor) homogeneity(boxm) / design .
manova pretest to fu12 by gender(0,1) group(1,2) / wsfactors = time(4) /
wsdesign = mwithin time(1) mwithin time(2)
mwithin time(3) mwithin time(4) /
design .
manova pretest to fu12 by gender(0,1) group(1,2) / wsfactors = time(4) /
wsdesign = time /
design = mwithin group(1) mwithin group(2) .
The first invocation of MANOVA reproduces the omnibus analysis we did earlier with SAS. The second invocation reproduces the simple main effects of group at each time. The third invocation tests the simple main effects of time within each group, using pooled error, but with the same disappointing results obtained by SAS. Our analysis does not, it seems, provide much support for the BST program’s effectiveness.
A X (B X C X S) ANOVA
In this design, factors B and C are crossed with Subjects (B and C are withinsubjects factors) and Subjects is nested within factor A (A is a betweensubjects factor). Our data are for the conditioned suppression experiment presented on page 486 of Howell (8th edition). The dependent variable is a measure of the frequency of bar pressing (for food) for an animal (rat?) in an experimental box. During the first phase of the experiment, each animal was placed in box A and, while the animal was bar pressing, a tone (or, in Group L-A-B a light) was presented and paired with shock during each of four cycles. During the second phase of the experiment, animals in Group L-A-B and Group A-B were tested in a different box, where the tone stimulus was presented without the shock. It was expected that the tone would initially suppress bar pressing in these animals (but only somewhat in the group for which shock had been paired with a light rather than with a tone), but that they would learn, across cycles, that box B was safe, and the rate of bar pressing would rise. Group A-A, however, was tested in box A during the second phase. It was expected that they would show low rates of bar pressing across the four cycles of the second phase of the experiment.
SAS
Obtain the data file, MAN_2W1B.DAT from my StatData page and the program file, MAN_2W1B.SAS, from my SAS programs page. Note that the first column of the data file contains the level of the Group variable (betweensubjects) followed by subjects’ scores on Cycle1/Phase1, Cycle1/Phase2, Cycle2/Phase 1, . . .Cycle4/Phase2. We have 4 x 2 = 8 cells in the matrix of repeated factors, represented by 8 dependent variables, C1P1 through C4P2, in the INPUT and MODEL statements. The REPEATED statement indicates that we have two withinsubjects factors, CYCLE with 4 levels, PHASE with 2 levels. The comma separating one withinsubject factor from another must be there. The order of the dependent variables is very important: The further to the right a repeated factor is in the REPEATED statement, the more rapidly its index values must change. Phase, the rightmore factor, changes more rapidly (1,2,1,2,1,2,1,2) than does Cycle, the leftmore factor (1,1,2,2,3,3,4,4). Check the “REPEATED MEASURES LEVEL INFORMATION” output page to assure that the withinsubjects factors are properly defined.
The output shows that there is no problem with the sphericity assumption for the Cycle effect, but there is for the Cycle x Phase interaction, so we need adjust the degrees of freedom for any effect that includes CyclePhase if we use the univariate approach. Since the Phase effect has only two levels, we have no sphericity assumption with respect to Phase.
The main effect of the Group variable falls short of statistical significance, but all other effects are statistically significant with both univariate and multivariate tests (although for CyclePhase only if you accept Roy’s greatest root). Do note that the multivariate and univariate analyses return identical results for the one df Phase effect, F(1, 21) = 129.86, p.0001. The multivariate approach analyzes a Klevel withinsubjects factor by creating K1 differencescores and doing a MANOVA on that set of differencescores. With K = 2 there is only one differencescore variable, so the MANOVA simplifies to an ANOVA on that differencescore, and both simplify to a correlated ttest (tsquared equals F), a onesample ttest of the null hypothesis that the mean differencescore is zero. For the Phase*Group effect both multivariate and univariate approaches simplify to a oneway ANOVA where IV = Group and DV = the difference score.
Simple effects
The significant threeway interaction would likely be further investigated by simple interaction analyses. With SAS you could sort by group and then do twoway ANOVAs involving the other two factors by level of group, doing three (A x B x S) ANOVAs. Below I show how to do simple effects analysis at levels of withinsubjects factors with individual error terms. If you wanted pooled rather than individual error terms, you would need construct them yourself. With SPSS MANOVA, “MWITHIN” could be used to construct simple effects, as explained when we covered the Ax(BxS) analysis.
Howell chose to evaluate the simple Group x Cycle interaction at each level of Phase. Look at the program to see how I did this by dropping variables from the left side of the model statement. Notice that nothing is significant during the first phase. The prediction was that all groups would show high suppression on all cycles during the shock phase (1), but that during the nonshock phase (2) Group 2 (AA) should show more suppression (lower scores) than the other groups, with the difference between Group 2 and the other groups increasing across cycles. Given this prediction, one expects no effects at all for the data from the first phase and a Cycle x Group interaction for the data from the second phase -- and that is exactly what we get.
Simple, simple main effects
The following plot illustrates the change in bar pressing across cycles in the second phase of the experiment. As expected, the animals in Group A-A exhibited conditioned suppression of bar pressing across all four cycles, but the animals in Group A-B apparently learned that box B was safe, since their bar pressing ratio increased across cycles. Group LAB showed less conditioned suppression than the other groups, but also showed a recovery of bar pressing across cycles. This graph is probably more useful than the tests of simple, simple main effects, but the Gods of Hypothesis Testing demand that we kneel at the alter of significance and offer up some p values, so we shall.
Knowing that the Group x Cycle simple interaction was significant during the second phase, I dropped “nouni” from the model statement to get simple, simple main effects of Group at each level of Cycle for the data from the second phase. I also asked for LSD pairwise comparisons. This analysis shows that the groups did not differ significantly on the first cycle, but they did on the remaining three cycles, with the mean for Group A-A being significantly lower than those of Groups A-B and LAB.
An alternative, perhaps better, way to dissect the significant Group x Cycle interaction for the data from the second phase is to evaluate the simple, simple main effects of Cycle at each level of Group (after sorting the data by group). I have included such an analysis, and it shows exactly what was predicted, a significant increase in bar pressing across cycles in Groups A-B and L-A-B (with the univariate test), but not in Group A-A. I did no pairwise comparisons here, as I decided they would not add anything of value.
Annotated SAS Output
SPSS: Point and Click
Bring into SPSS the data file MAN_2W1B.sav. Click Analyze, General Linear Model, Repeated Measures. In the “Within-Subject Factor Name” box, enter “cycle.” For “Number of Levels” enter “4.” Click Add. In the “Within-Subject Factor Name” box, enter “phase.” For “Number of Levels” enter “2.” Click Add and then Define. Select c1p1 through c4p2 and scoot them into the “Within-Subjects Variables” box. Select group and scoot it into the “Between-Subjects Factor(s)” box. Click OK. You will find that you get the same basic statistics that we got with SAS, along with trend contrasts.
Return to the main Repeated Measures dialog box. Remove phase as a factor. Define as the within-subjects variables c1p1, c2p1, c3p1, and c4p1. Leave group as a between-subjects factor. Click OK. Then return to the main Repeated Measures dialog box and Define as the within-subjects variables c1p2, c2p2, c3p2, and c4p2. Click OK. You now have the simple effects at each level of the phase variable.
Click Analyze, Compare Means, One-Way ANOVA. Scoot into the Dependent List c1p2, c2p2, c3p2, and c4p2. Select group as the factor. Click Post Hoc, LSD, Continue, OK. You now have the simple, simple main effects of group at each level of cycle for the second phase.