Data from Table 14.2, page 299
data table14_2; input a b scores; datalines; 1 1 16 1 1 12 1 1 9 1 1 14 1 1 17 2 1 21 2 1 20 2 1 19 2 1 15 2 1 17 2 1 22 3 1 8 3 1 18 3 1 12 1 2 9 1 2 6 1 2 15 1 2 11 1 2 12 1 2 8 1 2 14 2 2 22 2 2 19 2 2 24 2 2 25 2 2 19 2 2 19 2 2 14 2 2 26 2 2 21 3 2 8 3 2 10 3 2 14 3 2 7 3 2 5 3 2 11 3 2 8 ; run;
Evaluating the simple effect of Factor A across the levels of B , bottom of page 307
proc glm data = table14_2; class a b; model scores = a|b/ ss3; lsmeans a*b/slice = b; run; quit;
The GLM Procedure Class Level Information Class Levels Values a 3 1 2 3 b 2 1 2 Number of observations 37 Dependent Variable: scores Sum of Source DF Squares Mean Square F Value Pr > F Model 5 824.975032 164.995006 14.48 <.0001 Error 31 353.295238 11.396621 Corrected Total 36 1178.270270 R-Square Coeff Var Root MSE scores Mean 0.700158 22.83508 3.375888 14.78378 Source DF Type III SS Mean Square F Value Pr > F a 2 599.6950907 299.8475454 26.31 <.0001 b 1 18.8946868 18.8946868 1.66 0.2074 a*b 2 57.6943170 28.8471585 2.53 0.0959
Least Squares Means scores a b LSMEAN 1 1 13.6000000 1 2 10.7142857 2 1 19.0000000 2 2 21.0000000 3 1 12.6666667 3 2 9.0000000 Least Squares Means a*b Effect Sliced by b for scores Sum of b DF Squares Mean Square F Value Pr > F 1 2 114.990476 57.495238 5.04 0.0127 2 2 690.484472 345.242236 30.29 <.0001
Main effect contrasts in a two-factor design, page 308-309
NOTE: The rationale for doing a main effect contrast (without consideration of the other factor) is that the interaction between the two factors is statistically non-significant.
proc glm data = table14_2; class a b; model scores = a|b/ ss3; contrast 'a1 - a3' a -1 0 1; contrast 'a1 - 2a2 + a3 ' a 1 -2 1; run; quit;
The GLM Procedure Class Level Information Class Levels Values a 3 1 2 3 b 2 1 2 Number of observations 37 Dependent Variable: scores Sum of Source DF Squares Mean Square F Value Pr > F Model 5 824.975032 164.995006 14.48 <.0001 Error 31 353.295238 11.396621 Corrected Total 36 1178.270270 R-Square Coeff Var Root MSE scores Mean 0.700158 22.83508 3.375888 14.78378 Source DF Type III SS Mean Square F Value Pr > F a 2 599.6950907 299.8475454 26.31 <.0001 b 1 18.8946868 18.8946868 1.66 0.2074 a*b 2 57.6943170 28.8471585 2.53 0.0959 Contrast DF Contrast SS Mean Square F Value Pr > F a1 - a3 1 8.5585825 8.5585825 0.75 0.3928 a1 - 2a2 + a3 1 599.5857143 599.5857143 52.61 <.0001
(NOTE! t^2 = F, so .87^2 = .75, and (-7.25)^2 = 52.56)