Multivariate Approach to Mixed ANOVA with one Within-Subjects
and two Between-Subjects Factors: Howell (8th), page 479.

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.

proc format; value grp 1='BST' 2='EC';

value sx 0='Female' 1='Male';

data HIV; infile 'C:\Users\Vati\Documents\StatData\MAN_1W2B.dat';

INPUT Gender Group Pretest Posttest FU6 FU12;

mean=mean(of Pretest -- FU12); format Group grp. Gender sx. ;

*****************************************************************************;

proc anova; class Group Gender; model Pretest -- FU12 = Group|Gender;

repeated Time 4 / printe; means Group; run;

The ANOVA Procedure

Repeated Measures Analysis of Variance

Repeated Measures Level Information /
DependentVariable / Pretest / Posttest / FU6 / FU12 /
Level of Time / 1 / 2 / 3 / 4
Sphericity Tests /
Variables / DF / Mauchly's Criterion / Chi-Square / PrChiSq /
Orthogonal Components / 5 / 0.9026103 / 3.5577908 / 0.6147
MANOVA Test Criteria and Exact F Statistics for the Hypothesis of no Time Effect
H = Anova SSCP Matrix for Time
E = Error SSCP Matrix
S=1 M=0.5 N=16 /
Statistic / Value / F Value / NumDF / DenDF / PrF /
Wilks' Lambda / 0.93602344 / 0.77 / 3 / 34 / 0.5163
MANOVA Test Criteria and Exact F Statistics for the Hypothesis of no Time*Group Effect
H = Anova SSCP Matrix for Time*Group
E = Error SSCP Matrix
S=1 M=0.5 N=16 /
Statistic / Value / F Value / NumDF / DenDF / PrF /
Wilks' Lambda / 0.73566435 / 4.07 / 3 / 34 / § 0.0142
MANOVA Test Criteria and Exact F Statistics for the Hypothesis of no Time*Gender Effect
H = Anova SSCP Matrix for Time*Gender
E = Error SSCP Matrix
S=1 M=0.5 N=16 /
Statistic / Value / F Value / NumDF / DenDF / PrF /
Wilks' Lambda / 0.83776958 / 2.19 / 3 / 34 / 0.1066
MANOVA Test Criteria and Exact F Statistics for the Hypothesis of no Time*Group*Gender Effect
H = Anova SSCP Matrix for Time*Group*Gender
E = Error SSCP Matrix
S=1 M=0.5 N=16 /
Statistic / Value / F Value / NumDF / DenDF / PrF /
Wilks' Lambda / 0.88714488 / 1.44 / 3 / 34 / 0.2478

Tests of Hypotheses for Between Subjects Effects

Source / DF / Anova SS / Mean Square / F Value / PrF /
Group / 1 / 107.25625 / 107.25625 / 0.21 / 0.6457
Gender / 1 / 3358.05625 / 3358.05625 / 6.73 / 0.0136
Group*Gender / 1 / 63.75625 / 63.75625 / 0.13 / 0.7228
Error / 36 / 17961.27500 / 498.92431

The ANOVA Procedure

Repeated Measures Analysis of Variance

Univariate Tests of Hypotheses for Within Subject Effects

Source / DF / Anova SS / Mean Square / F Value / PrF / Adj Pr > F /
G-G / H-F-L /
Time / 3 / 274.06875 / 91.35625 / 0.90 / 0.4456 / 0.4400 / 0.4456
Time*Group / 3 / 1377.81875 / 459.27292 / 4.51 / 0.0051 / 0.0063 / 0.0051
Time*Gender / 3 / 779.91875 / 259.97292 / 2.55 / 0.0594 / 0.0640 / 0.0594
Time*Group*Gender / 3 / 476.41875 / 158.80625 / 1.56 / 0.2037 / 0.2068 / 0.2037
Error(Time) / 108 / 11006.02500 / 101.90764
Greenhouse-Geisser Epsilon / 0.9317
Huynh-Feldt-Lecoutre Epsilon / 1.0181

Summary: The significant effects are Gender and Time x Groups.

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.

mean=mean(of Pretest -- FU12);

proc anova; class Gender Group;

model mean=Gender|Group; means Gender; run;

The ANOVA Procedure

Class Level Information /
Class / Levels / Values /
Gender / 2 / Female Male
Group / 2 / BST EC
Number of Observations Read / 40
Number of Observations Used / 40

Dependent Variable: mean (collapsed across times)

Source / DF / Sum of Squares / Mean Square / F Value / PrF /
Model / 3 / 882.267187 / 294.089062 / 2.36 / 0.0879
Error / 36 / 4490.318750 / 124.731076
Corrected Total / 39 / 5372.585938
Source / DF / Anova SS / Mean Square / F Value / PrF /
Gender / 1 / 839.5140625 / 839.5140625 / 6.73 / 0.0136
Group / 1 / 26.8140625 / 26.8140625 / 0.21 / 0.6457
Gender*Group / 1 / 15.9390625 / 15.9390625 / 0.13 / 0.7228
Level of
Gender / N / mean /
Mean / Std Dev /
Female / 20 / 10.0125000 / 9.3539588
Male / 20 / 19.1750000 / 12.2917120

By not specifying “NOUNI” in the first ANOVA, I had SAS compute Group|Gender univariate ANOVAs on Pretest, Posttest, FU6, and FU12 . These provide the simple interaction tests of Group*Gender at each level of Time that we might use to followup a significant triple interaction, but our triple interaction is not significant. However, our Time*Group 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).

The ANOVA Procedure

Class Level Information /
Class / Levels / Values /
Group / 2 / BST EC
Gender / 2 / Female Male
Number of Observations Read / 40
Number of Observations Used / 40

The ANOVA Procedure

Dependent Variable: Pretest

Source / DF / Sum of Squares / Mean Square / F Value / PrF /
Model / 3 / 3066.27500 / 1022.09167 / 3.67 / 0.0210
Error / 36 / 10027.10000 / 278.53056
Corrected Total / 39 / 13093.37500
Source / DF / Anova SS / Mean Square / F Value / PrF /
Group / 1 / 403.225000 / 403.225000 / 1.45 / 0.2368
Gender / 1 / 2544.025000 / 2544.025000 / 9.13 / 0.0046
Group*Gender / 1 / 119.025000 / 119.025000 / 0.43 / 0.5175

Dependent Variable: Posttest

Source / DF / Sum of Squares / Mean Square / F Value / PrF /
Model / 3 / 988.475000 / 329.491667 / 1.35 / 0.2742
Error / 36 / 8799.300000 / 244.425000
Corrected Total / 39 / 9787.775000
Source / DF / Anova SS / Mean Square / F Value / PrF /
Group / 1 / 7.2250000 / 7.2250000 / 0.03 / 0.8645
Gender / 1 / 970.2250000 / 970.2250000 / 3.97 / 0.0540
Group*Gender / 1 / 11.0250000 / 11.0250000 / 0.05 / 0.8330

Dependent Variable: FU6

Source / DF / Sum of Squares / Mean Square / F Value / PrF /
Model / 3 / 1605.400000 / 535.133333 / 4.71 / 0.0071
Error / 36 / 4089.000000 / 113.583333
Corrected Total / 39 / 5694.400000
R-Square / Coeff Var / Root MSE / FU6Mean /
0.281926 / 77.79232 / 10.65755 / 13.70000
Source / DF / Anova SS / Mean Square / F Value / PrF /
Group / 1 / 1040.400000 / 1040.400000 / 9.16 / 0.0045
Gender / 1 / 168.100000 / 168.100000 / 1.48 / 0.2317
Group*Gender / 1 / 396.900000 / 396.900000 / 3.49 / 0.0697

Dependent Variable: FU12

Source / DF / Sum of Squares / Mean Square / F Value / PrF /
Model / 3 / 503.075000 / 167.691667 / 1.00 / 0.4051
Error / 36 / 6051.900000 / 168.108333
Corrected Total / 39 / 6554.975000
R-Square / Coeff Var / Root MSE / FU12Mean /
0.076747 / 98.03902 / 12.96566 / 13.22500
Source / DF / Anova SS / Mean Square / F Value / PrF /
Group / 1 / 34.2250000 / 34.2250000 / 0.20 / 0.6545
Gender / 1 / 455.6250000 / 455.6250000 / 2.71 / 0.1084
Group*Gender / 1 / 13.2250000 / 13.2250000 / 0.08 / 0.7807
Level of
Group / N / Pretest / Posttest / FU6 / FU12 /
Mean / Std Dev / Mean / Std Dev / Mean / Std Dev / Mean / Std Dev /
BST / 20 / 13.4500000 / 13.7744042 / 15.2500000 / 12.0912104 / 18.8000000 / 11.0386879 / 14.1500000 / 11.3752964
EC / 20 / 19.8000000 / 21.8670625 / 14.4000000 / 19.1981359 / 8.6000000 / 11.0948068 / 12.3000000 / 14.6219014

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.

*****************************************************************************;

proc sort; by group;

proc anova; model Pretest -- FU12 = / nouni;

repeated Time 4 contrast(1) / summary; by group; run;

The ANOVA Procedure

Group=BST

Number of Observations Read / 20
Number of Observations Used / 20
Repeated Measures Level Information /
DependentVariable / Pretest / Posttest / FU6 / FU12 /
Level of Time / 1 / 2 / 3 / 4
Sphericity Tests /
Variables / DF / Mauchly's Criterion / Chi-Square / PrChiSq /
Orthogonal Components / 5 / 0.7768107 / 4.4758984 / 0.4831
MANOVA Test Criteria and Exact F Statistics for the Hypothesis of no Time Effect
H = Anova SSCP Matrix for Time
E = Error SSCP Matrix
S=1 M=0.5 N=7.5 /
Statistic / Value / F Value / NumDF / DenDF / PrF /
Wilks' Lambda / 0.66055172 / 2.91 / 3 / 17 / 0.0645

Univariate Tests of Hypotheses for Within Subject Effects

Group=BST

Source / DF / Anova SS / Mean Square / F Value / PrF / Adj Pr > F /
G-G / H - F /
Time / 3 / 338.937500 / 112.979167 / 1.95 / 0.1323 / 0.1403 / 0.1323
Error(Time) / 57 / 3307.312500 / 58.023026
Greenhouse-Geisser Epsilon / 0.8857
Huynh-Feldt Epsilon / 1.0431

Analysis of Variance of Contrast Variables

Time_N represents the contrast between the nth level of Time and the 1st

Group=BST

Contrast Variable: Time_2 Pretest versus Posttest

Source / DF / Anova SS / Mean Square / F Value / PrF /
Mean / 1 / 64.800000 / 64.800000 / 0.44 / 0.5163
Error / 19 / 2815.200000 / 148.168421

Contrast Variable: Time_3 Pretest versus 6 month follow-up

Source / DF / Anova SS / Mean Square / F Value / PrF /
Mean / 1 / 572.450000 / 572.450000 / 5.50 / 0.0300
Error / 19 / 1976.550000 / 104.028947

Contrast Variable: Time_4 Pretest versus 12 month follow-up

Source / DF / Anova SS / Mean Square / F Value / PrF /
Mean / 1 / 9.800000 / 9.800000 / 0.07 / 0.7960
Error / 19 / 2708.200000 / 142.536842

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).

The ANOVA Procedure

Group=EC

Number of Observations Read / 20
Number of Observations Used / 20

Repeated Measures Analysis of Variance

Group=EC

Repeated Measures Level Information /
DependentVariable / Pretest / Posttest / FU6 / FU12 /
Level of Time / 1 / 2 / 3 / 4
Sphericity Tests /
Variables / DF / Mauchly's Criterion / Chi-Square / PrChiSq /
Orthogonal Components / 5 / 0.7157236 / 5.9273965 / 0.3133
MANOVA Test Criteria and Exact F Statistics for the Hypothesis of no Time Effect
H = Anova SSCP Matrix for Time
E = Error SSCP Matrix
S=1 M=0.5 N=7.5 /
Statistic / Value / F Value / NumDF / DenDF / PrF /
Wilks' Lambda / 0.74187264 / 1.97 / 3 / 17 / 0.1565

Univariate Tests of Hypotheses for Within Subject Effects

Group=EC

Source / DF / Anova SS / Mean Square / F Value / PrF / Adj Pr > F /
G-G / H - F /
Time / 3 / 1312.950000 / 437.650000 / 2.79 / 0.0489 / 0.0622 / 0.0531
Error(Time) / 57 / 8955.050000 / 157.106140
Greenhouse-Geisser Epsilon / 0.8076
Huynh-Feldt Epsilon / 0.9342

Analysis of Variance of Contrast Variables

Time_N represents the contrast between the nth level of Time and the 1st

Contrast Variable: Time_2 Pretest versus Posttest