Data from Table 13.1, page 268
data table13_1; input a b recall @@; datalines; 1 1 7 1 1 7 1 1 9 1 1 10 1 1 9 2 1 6 2 1 8 2 1 7 2 1 9 2 1 9 3 1 10 3 1 8 3 1 8 3 1 6 3 1 8 1 2 7 1 2 8 1 2 9 1 2 10 1 2 10 2 2 6 2 2 8 2 2 8 2 2 9 2 2 9 3 2 7 3 2 7 3 2 6 3 2 9 3 2 9 1 3 7 1 3 7 1 3 10 1 3 7 1 3 9 2 3 3 2 3 5 2 3 3 2 3 6 2 3 5 3 3 2 3 3 3 3 3 4 3 3 5 3 3 5 ; run;
Table 13.1, page 268. Table means and Analysis of Variance in a two-factor design
proc glm data = table13_1; class a b; model recall = a|b / ss3; lsmeans a*b; run; quit;
The GLM Procedure
Class Level Information
Class Levels Values
a 3 1 2 3
b 3 1 2 3
Number of observations 45
Dependent Variable: recall
Sum of
Source DF Squares Mean Square F Value Pr > F
Model 8 129.2000000 16.1500000 9.08 <.0001
Error 36 64.0000000 1.7777778
Corrected Total 44 193.2000000
R-Square Coeff Var Root MSE recall Mean
0.668737 18.51852 1.333333 7.200000
Source DF Type III SS Mean Square F Value Pr > F
a 2 32.93333333 16.46666667 9.26 0.0006
b 2 72.93333333 36.46666667 20.51 <.0001
a*b 4 23.33333333 5.83333333 3.28 0.0216
Least Squares Means
recall
a b LSMEAN
1 1 8.40000000
1 2 8.80000000
1 3 8.00000000
2 1 7.80000000
2 2 8.00000000
2 3 4.40000000
3 1 8.00000000
3 2 7.60000000
3 3 3.80000000
Interaction contrasts for a two-factor design from Table 13.4, page 273 and Numerical Example, page 274-275
NOTE: The contrast statements for interaction contrast are defined at the A*B level. However, to evaluate the contrast on A by a particular level of B, a contrast must first be set up on A, and then defined which level of the A*B interaction it is to take place over.
proc glm data = table13_1;
class a b;
model recall = a|b/ ss3;
contrast '(a2 vs. a3) vs. (b2 vs. b3)'
a*b 0 0 0
0 1 -1
0 -1 1;
contrast '(a1 vs. .5(a2+a3)) vs. (b2 vs. b3)'
a*b 0 1 -1
0 -.5 .5
0 -.5 .5;
contrast '(a1 vs. .5(a2+a3)) at b2'
a 1
-.5
-.5
a*b 0 1 0
0 -.5 0
0 -.5 0;
contrast '(a1 vs. .5(a2+a3)) at b3'
a 1
-.5
-.5
a*b 0 0 1
0 0 -.5
0 0 -.5;
run;
quit;
The GLM Procedure
Class Level Information
Class Levels Values
a 3 1 2 3
b 3 1 2 3
Number of observations 45
Dependent Variable: recall
Sum of
Source DF Squares Mean Square F Value Pr > F
Model 8 129.2000000 16.1500000 9.08 <.0001
Error 36 64.0000000 1.7777778
Corrected Total 44 193.2000000
R-Square Coeff Var Root MSE recall Mean
0.668737 18.51852 1.333333 7.200000
Source DF Type III SS Mean Square F Value Pr > F
a 2 32.93333333 16.46666667 9.26 0.0006
b 2 72.93333333 36.46666667 20.51 <.0001
a*b 4 23.33333333 5.83333333 3.28 0.0216
Contrast DF Contrast SS Mean Square F Value Pr > F
(a2 vs. a3) vs. (b2 vs. b3) 1 0.05000000 0.05000000 0.03 0.8678
(a1 vs. .5(a2+a3)) vs. (b2 vs. b3) 1 14.01666667 14.01666667 7.88 0.0080
(a1 vs. .5(a2+a3)) at b2 1 3.33333333 3.33333333 1.88 0.1794
(a1 vs. .5(a2+a3)) at b3 1 50.70000000 50.70000000 28.52 <.0001
