Data from Table 15.3, page 320
data table15_3; input a x y; datalines; 1 11 9 1 6 1 1 5 2 1 8 3 1 9 5 1 4 2 1 9 4 1 12 6 2 3 2 2 7 3 2 11 7 2 9 12 2 5 5 2 10 9 2 7 6 2 4 4 ; run;
ANOVA table for Y from Table 15.3, page 320
proc glm data = table15_3; class a; model y = a / ss3; run;quit;
The GLM Procedure Class Level Information Class Levels Values a 2 1 2 Number of observations 16 Dependent Variable: y Sum of Source DF Squares Mean Square F Value Pr > F Model 1 16.0000000 16.0000000 1.81 0.2003 Error 14 124.0000000 8.8571429 Corrected Total 15 140.0000000 R-Square Coeff Var Root MSE y Mean 0.114286 59.52190 2.976095 5.000000 Source DF Type III SS Mean Square F Value Pr > F a 1 16.00000000 16.00000000 1.81 0.2003
Analysis of Covariance: Equation (15.12), page 321 and Table 15.4, page 324
proc glm data = table15_3; class a; model y = a x / solution ss3 noint; run; quit;
The GLM Procedure Class Level Information Class Levels Values a 2 1 2 Number of observations 16 Dependent Variable: y Sum of Source DF Squares Mean Square F Value Pr > F Model 2 91.8684211 45.9342105 12.41 0.0010 Error 13 48.1315789 3.7024291 Corrected Total 15 140.0000000 R-Square Coeff Var Root MSE y Mean 0.656203 38.48339 1.924170 5.000000 Source DF Type III SS Mean Square F Value Pr > F a 1 30.63960749 30.63960749 8.28 0.0130 x 1 75.86842105 75.86842105 20.49 0.0006
Standard Parameter Estimate Error t Value Pr > |t| a 1 -2.526315789 1.59416447 -1.58 0.1370 a 2 0.289473684 1.43324758 0.20 0.8431 x 0.815789474 0.18021501 4.53 0.0006
NOTE: The X'X matrix has been found to be singular, and a generalized inverse was used to solve the normal equations. Terms whose estimates are followed by the letter 'B' are not uniquely estimable.
Data from Table 15.5, page 327
data table15_5; input a x y; datalines; 1 11 9 1 6 1 1 5 2 1 8 3 1 9 5 1 4 2 1 9 4 1 12 6 2 3 2 2 7 3 2 11 7 2 9 12 2 5 5 2 10 9 2 7 6 2 4 4 3 3 2 3 8 8 3 7 5 3 10 8 3 4 3 3 5 4 3 9 6 3 5 4 ; run;
Contrasts on adjusted means, middle of page 327
proc glm data = table15_5; class a; model y = a x /ss3; contrast 'a1 vs (a2 + a3)' a 1 -.5 -.5; contrast 'a2 vs a3' a 0 1 -1; run; quit;
The GLM Procedure Class Level Information Class Levels Values a 3 1 2 3 Number of observations 24 Dependent Variable: y Sum of Source DF Squares Mean Square F Value Pr > F Model 3 121.4061758 40.4687253 15.39 <.0001 Error 20 52.5938242 2.6296912 Corrected Total 23 174.0000000 R-Square Coeff Var Root MSE y Mean 0.697737 32.43265 1.621632 5.000000 Source DF Type III SS Mean Square F Value Pr > F a 2 34.5803789 17.2901894 6.57 0.0064 x 1 105.4061758 105.4061758 40.08 <.0001 Contrast DF Contrast SS Mean Square F Value Pr > F a1 vs (a2 + a3) 1 33.35230372 33.35230372 12.68 0.0020 a2 vs a3 1 0.94831611 0.94831611 0.36 0.5549
Note that t^2 is F, and using the standard error by a computer program from the book we get (-2.572 / .722) ^ 2 = 12.690173 and (.489 / .815 )^2 = .36
Data from Table 15.6, page 329
data table15_6; input a b x y; datalines; 1 1 2 11 1 1 1 8 1 1 5 8 1 1 4 7 1 2 5 10 1 2 5 8 1 2 1 10 1 2 3 11 2 1 2 12 2 1 3 7 2 1 4 6 2 1 1 11 2 2 4 15 2 2 5 12 2 2 3 16 2 2 4 13 ; run;
Table 15.6, page 329. Analysis of Covariance and adjusted means in a two-factor design
proc glm data = table15_6; class a b; model y = a|b x / ss3; means a*b; lsmeans a*b; run; quit;
The GLM Procedure Class Level Information Class Levels Values a 2 1 2 b 2 1 2 Number of observations 16 Dependent Variable: y Sum of Source DF Squares Mean Square F Value Pr > F Model 4 92.1964286 23.0491071 7.63 0.0034 Error 11 33.2410714 3.0219156 Corrected Total 15 125.4375000 R-Square Coeff Var Root MSE y Mean 0.734999 16.85688 1.738366 10.31250 Source DF Type III SS Mean Square F Value Pr > F a 1 22.56250000 22.56250000 7.47 0.0195 b 1 53.04017857 53.04017857 17.55 0.0015 a*b 1 19.70720443 19.70720443 6.52 0.0268 x 1 16.50892857 16.50892857 5.46 0.0394 Level of Level of --------------y-------------- --------------x-------------- a b N Mean Std Dev Mean Std Dev 1 1 4 8.5000000 1.73205081 3.00000000 1.82574186 1 2 4 9.7500000 1.25830574 3.50000000 1.91485422 2 1 4 9.0000000 2.94392029 2.50000000 1.29099445 2 2 4 14.0000000 1.82574186 4.00000000 0.81649658 Least Squares Means a b y LSMEAN 1 1 8.3080357 1 2 9.9419643 2 1 8.4241071 2 2 14.5758929
Data from Table 15.7, page 331
data table15_7; input a x y; datalines; 1 2 5 1 2 4 1 3 6 1 4 4 1 4 7 1 6 3 1 7 5 1 8 6 1 8 3 1 9 3 1 10 2 1 11 4 2 3 2 2 5 2 2 5 4 2 6 4 2 6 6 2 8 4 2 9 6 2 9 8 2 10 7 2 11 5 2 12 7 2 13 10 ; run;
Table 15.7, page 331. Analysis of Covariance testing for differences in slope
NOTE: If the a*x interaction is significant, the assumption of homogeneity of the regression line has been violated.
proc glm data = table15_7; class a; model y = a|x / ss3 ; run;quit; The GLM Procedure Class Level Information Class Levels Values a 2 1 2 Number of observations 24 Dependent Variable: y Sum of Source DF Squares Mean Square F Value Pr > F Model 3 55.41310547 18.47103516 9.42 0.0004 Error 20 39.21189453 1.96059473 Corrected Total 23 94.62500000 R-Square Coeff Var Root MSE y Mean 0.585607 28.72231 1.400212 4.875000 Source DF Type III SS Mean Square F Value Pr > F a 1 26.15664286 26.15664286 13.34 0.0016 x 1 8.71289511 8.71289511 4.44 0.0478 x*a 1 39.78810547 39.78810547 20.29 0.0002
Data from Table 15.8, page 334
data table15_8; input a x xquad y; datalines; 1 1 49 7 1 3 25 5 1 3 25 7 1 4 16 4 1 5 9 3 1 5 9 5 1 7 1 3 1 9 1 4 1 10 4 6 1 11 9 5 1 12 16 8 1 13 25 7 2 3 25 10 2 4 16 9 2 4 16 8 2 6 4 9 2 7 1 5 2 8 0 7 2 9 1 6 2 10 4 5 2 11 9 9 2 13 25 9 2 14 36 8 2 14 36 10 ; run;
Table 15.8, page 334. Analysis of Covariance testing for curvature
NOTE: The xquad term is mean centered to reduce the correlation with x.
proc glm data = table15_8; class a; model y = a x xquad / ss3; run; quit;
The GLM Procedure Class Level Information Class Levels Values a 2 1 2 Number of observations 24 Dependent Variable: y Sum of Source DF Squares Mean Square F Value Pr > F Model 3 66.9479610 22.3159870 11.54 0.0001 Error 20 38.6770390 1.9338519 Corrected Total 23 105.6250000 R-Square Coeff Var Root MSE y Mean 0.633827 20.99064 1.390630 6.625000 Source DF Type III SS Mean Square F Value Pr > F a 1 38.56583744 38.56583744 19.94 0.0002 x 1 1.06146292 1.06146292 0.55 0.4674 xquad 1 26.25915831 26.25915831 13.58 0.0015
Data from Table 15.9, page 338
data table15_9; input a x y; datalines; 1 62 3 1 63 4 1 63 5 1 64 5 1 64 6 1 65 5 1 66 4 1 66 7 1 67 6 1 67 8 1 68 7 1 69 9 2 68 5 2 70 7 2 71 6 2 72 8 2 72 9 2 73 7 2 73 8 2 74 9 2 75 11 2 76 10 2 77 9 2 77 11 ; run;
Table 15.9, page 338. Analysis of variance and covariance
proc glm data = table15_9; class a; model y = a / ss3; run; quit;
The GLM Procedure Class Level Information Class Levels Values a 2 1 2 Number of observations 24 Dependent Variable: y Sum of Source DF Squares Mean Square F Value Pr > F Model 1 40.0416667 40.0416667 12.08 0.0021 Error 22 72.9166667 3.3143939 Corrected Total 23 112.9583333 R-Square Coeff Var Root MSE y Mean 0.354482 25.85393 1.820548 7.041667 Source DF Type III SS Mean Square F Value Pr > F a 1 40.04166667 40.04166667 12.08 0.0021 proc glm data = table15_9; class a; model y = a x / ss3; run; quit;
The GLM Procedure Class Level Information Class Levels Values a 2 1 2 Number of observations 24 Dependent Variable: y Sum of Source DF Squares Mean Square F Value Pr > F Model 2 91.4545181 45.7272590 44.66 <.0001 Error 21 21.5038153 1.0239912 Corrected Total 23 112.9583333 R-Square Coeff Var Root MSE y Mean 0.809631 14.37053 1.011925 7.041667 Source DF Type III SS Mean Square F Value Pr > F a 1 7.87492775 7.87492775 7.69 0.0114 x 1 51.41285141 51.41285141 50.21 <.0001