Three-Way all Within-Subjects ANOVA

The data are for the automobile driving experiment presented on page 511 of the 5th edition of Howell. The dependent variable is number of steering errors during a driving test. Factor T is the time of testing, 1 for night and 2 for day. Factor C is type of course, 1 for a road racing track, 2 for city streets, and 3 for open highways. Factor S is size of car, 1 for small, 2 for medium, and 3 for large.

No sphericity test is done here, as there are two few subjects (only three). Furthermore, there are too few subjects to conduct a multivariate-approach analysis. Accordingly, I have requested only univariate-approach analyses. The conservative thing to do here would be to use the G-G correction whenever epsilon is not 1.

data err;

INPUT T1C1S1 T1C1S2 T1C1S3 T1C2S1 T1C2S2 T1C2S3 T1C3S1 T1C3S2 T1C3S3

T2C1S1 T2C1S2 T2C1S3 T2C2S1 T2C2S2 T2C2S3 T2C3S1 T2C3S2 T2C3S3;

<code removed>

cards;

10 8 6 9 7 5 7 6 3 5 4 3 4 3 3 2 2 1

9 8 5 10 6 4 4 5 2 4 3 3 4 2 2 2 3 2

8 7 4 7 4 3 3 4 2 4 1 2 3 3 2 1 0 1

procanova; model T1C1S1 -- T2C3S3 = / nouni;

The ANOVA Procedure

Number of Observations Read / 3
Number of Observations Used / 3

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
Time / 1 / 140.1666667 / 140.1666667 / 120.14 / 0.0082
Error(Time) / 2 / 2.3333333 / 1.1666667
Source / DF / Anova SS / Mean Square / F Value / PrF / AdjPr > F
G-G / H - F
Course / 2 / 56.77777778 / 28.38888889 / 1022.00 / <.0001 / <.0001 / .
Error(Course) / 4 / 0.11111111 / 0.02777778
Greenhouse-Geisser Epsilon / 1.0000
Huynh-Feldt Epsilon / 0.0000
Source / DF / Anova SS / Mean Square / F Value / PrF / AdjPr > F
G-G / H - F
Size / 2 / 51.44444444 / 25.72222222 / 92.60 / 0.0004 / 0.0080 / 0.0031
Error(Size) / 4 / 1.11111111 / 0.27777778
Greenhouse-Geisser Epsilon / 0.5435
Huynh-Feldt Epsilon / 0.6905
Source / DF / Anova SS / Mean Square / F Value / PrF / AdjPr > F
G-G / H - F
Time*Course / 2 / 5.44444444 / 2.72222222 / 2.09 / 0.2397 / 0.2601 / 0.2397
Error(Time*Course) / 4 / 5.22222222 / 1.30555556
Greenhouse-Geisser Epsilon / 0.7625
Huynh-Feldt Epsilon / 2.7108
Source / DF / Anova SS / Mean Square / F Value / PrF / AdjPr > F
G-G / H - F
Time*Size / 2 / 16.77777778 / 8.38888889 / 37.75 / 0.0025 / 0.0102 / 0.0025
Error(Time*Size) / 4 / 0.88888889 / 0.22222222
Greenhouse-Geisser Epsilon / 0.6957
Huynh-Feldt Epsilon / 1.7857
Source / DF / Anova SS / Mean Square / F Value / PrF / AdjPr > F
G-G / H - F
Course*Size / 4 / 8.77777778 / 2.19444444 / 3.76 / 0.0524 / 0.1375 / 0.0524
Error(Course*Size) / 8 / 4.66666667 / 0.58333333
Greenhouse-Geisser Epsilon / 0.4265
Huynh-Feldt Epsilon / 2.6513
Source / DF / Anova SS / Mean Square / F Value / PrF / AdjPr > F
G-G / H - F
Time*Course*Size / 4 / 2.77777778 / 0.69444444 / 1.92 / 0.2000 / 0.2933 / 0.2701
Error(Time*Course*Size) / 8 / 2.88888889 / 0.36111111
Greenhouse-Geisser Epsilon / 0.2884
Huynh-Feldt Epsilon / 0.4315

Since there was a significant main effect of course, we want to obtain the marginal means for course, and we may also want to make pairwise comparisons among those marginal means. Here is the code, from the data step, used to obtain the marginal means and the difference scores.

c1=mean(of T1C1S1 T1C1S2 T1C1S3 T2C1S1 T2C1S2 T2C1S3);

c2=mean(of T1C2S1 T1C2S2 T1C2S3 T2C2S1 T2C2S2 T2C2S3);

c3=mean(of T1C3S1 T1C3S2 T1C3S3 T2C3S1 T2C3S2 T2C3S3);

c1c2=c1-c2; c1c3=c1-c3; c2c3=c2-c3;

There was also a significant main effect of Size of car, so I computed marginal means and difference scores for size of car.

s1=mean(of T1C1S1 T1C2S1 T1C3S1 T2C1S1 T2C2S1 T2C3S1);

s2=mean(of T1C1S2 T1C2S2 T1C3S2 T2C1S2 T2C2S2 T2C3S2);

s3=mean(of T1C1S3 T1C2S3 T1C3S3 T2C1S3 T2C2S3 T2C3S3);

s1s2=s1-s2; s1s3=s1-s3;s2s3=s2-s3;

There was also a significant Time x Size interaction. Accordingly, I computed, for each subject, the mean number of errors in each of the four cells for Time x Size.

Night_Small = mean(of T1C1S1 T1C2S1 T1C3S1);

Day_Small = mean(of T2C1S1 T2C2S1 T2C3S1);

Night_Medium = mean(of T1C1S2 T1C2S2 T1C3S2);

Day_Medium = mean(of T2C1S2 T2C2S2 T2C3S2);

Night_Large = mean(of T1C1S3 T1C2S3 T1C3S3);

Day_Large = mean(of T2C1S3 T2C2S3 T2C3S3);

procmeans; var c1 c2 c3 s1 s2 s3 Night_Small -- Day_Large;

title'Means for main effects of Course and Size and for Time x Size interaction';

The MEANS Procedure

Variable / N / Mean / StdDev / Minimum / Maximum
c1
c2
c3
s1
s2
s3
Night_Small
Day_Small
Night_Medium
Day_Medium
Night_Large
Day_Large
/ 3
3
3
3
3
3
3
3
3
3
3
3
/ 5.2222222
4.5000000
2.7777778
5.3333333
4.2222222
2.9444444
7.4444444
3.2222222
6.1111111
2.3333333
3.7777778
2.1111111
/ 0.8388705
0.7637626
0.8552669
0.9279607
0.9477068
0.5853141
1.3471506
0.5091751
1.0183502
0.8819171
0.8388705
0.3849002
/ 4.3333333
3.6666667
1.8333333
4.3333333
3.1666667
2.3333333
6.0000000
2.6666667
5.0000000
1.3333333
3.0000000
1.6666667
/ 6.0000000
5.1666667
3.5000000
6.1666667
5.0000000
3.5000000
8.6666667
3.6666667
7.0000000
3.0000000
4.6666667
2.3333333

procmeanstprt; var c1c2 c1c3 c2c3 s1s2 s1s3 s2s3;

title'Pairwise comparisons'; run;

The MEANS Procedure

Variable / tValue / Pr|t|
c1c2
c1c3
c2c3
s1s2
s1s3
s2s3
/ 13.00
44.00
31.00
20.00
11.93
5.75
/ 0.0059
0.0005
0.0010
0.0025
0.0070
0.0289

For both type of course and size of car, each marginal mean differs significantly from each other marginal mean.

I investigated the Time x Size interaction by testing the simple effects of time at each level of size.

procanova; model T1C1S1 T1C2S1 T1C3S1 T2C1S1 T2C2S1 T2C3S1 = / nouni;

repeated Time 2, Course 3 / nom; title2'Simple Effects for Small Cars';

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

procanova; model T1C1S2 T1C2S2 T1C3S2 T2C1S2 T2C2S2 T2C3S2 = / nouni;

repeated Time 2, Course 3 / nom; title2'Simple Effects for Medium Cars';

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

procanova; model T1C1S3 T1C2S3 T1C3S3 T2C1S3 T2C2S3 T2C3S3 = / nouni;

repeated Time 2, Course 3 / nom; title2'Simple Effects for Large Cars';

Three-Way all Within-Subjects ANOVA
Simple Effects of Time for Small Cars

Univariate Tests of Hypotheses for Within Subject Effects

Source / DF / Anova SS / Mean Square / F Value / PrF
Time / 1 / 80.22222222 / 80.22222222 / 76.00 / 0.0129
Error(Time) / 2 / 2.11111111 / 1.05555556
Three-Way all Within-Subjects ANOVA
Simple Effects for Medium Cars

Univariate Tests of Hypotheses for Within Subject Effects

Source / DF / Anova SS / Mean Square / F Value / PrF
Time / 1 / 64.22222222 / 64.22222222 / 1156.00 / 0.0009
Error(Time) / 2 / 0.11111111 / 0.05555556
Three-Way all Within-Subjects ANOVA
Simple Effects for Large Cars

Repeated Measures Analysis of Variance

Univariate Tests of Hypotheses for Within Subject Effects

Source / DF / Anova SS / Mean Square / F Value / PrF
Time / 1 / 12.50000000 / 12.50000000 / 25.00 / 0.0377
Error(Time) / 2 / 1.00000000 / 0.50000000

The effect of time of day is significant for each size of car, but the magnitude of the effect varies across size of car, as shown in the interaction plot below.

Karl L. Wuensch, November, 2013.Fair Use of this Document