* ch16eg2.sas; * This SAS program fits a cell means (1-way ANOVA) model to * the data of problem 1.22, showing the relation between * ANOVA and regression; ; options ls=76; ; data plastic; do x=16, 24, 32, 40; x2=x**2; x3=x**3; do j=1 to 4; input y @@; output; end; end; lines; 199.0 205.0 196.0 200.0 218.0 220.0 215.0 223.0 237.0 234.0 235.0 230.0 250.0 248.0 253.0 246.0 ; proc print; title 'Plastic hardness experiment (ANOVA for Exercise 1.22 data).'; ; * Do ANOVA using proc glm, each factor being a class(ification) variable; proc glm; class x; model y = x; output out=B p=yhat r=e; ; * plot the raw data and fitted model; proc plot; plot yhat*x='*' y*x / overlay; ; * Fit the corresponding regression model; proc glm data=plastic; model y = x x2 x3; Plastic hardness experiment (ANOVA for Exercise 1.22 data). 1 12:45 Thursday, January 8, 2009 Obs x x2 x3 j y 1 16 256 4096 1 199 2 16 256 4096 2 205 3 16 256 4096 3 196 4 16 256 4096 4 200 5 24 576 13824 1 . 6 24 576 13824 2 218 7 24 576 13824 3 220 8 24 576 13824 4 215 9 32 1024 32768 1 223 10 32 1024 32768 2 . 11 32 1024 32768 3 237 12 32 1024 32768 4 234 13 40 1600 64000 1 235 14 40 1600 64000 2 230 15 40 1600 64000 3 . 16 40 1600 64000 4 250 17 16 256 4096 1 248 18 16 256 4096 2 253 19 16 256 4096 3 246 20 16 256 4096 4 . Plastic hardness experiment (ANOVA for Exercise 1.22 data). 2 12:45 Thursday, January 8, 2009 The GLM Procedure Class Level Information Class Levels Values x 4 16 24 32 40 Number of Observations Read 20 Number of Observations Used 16 Plastic hardness experiment (ANOVA for Exercise 1.22 data). 3 12:45 Thursday, January 8, 2009 The GLM Procedure Dependent Variable: y Sum of Source DF Squares Mean Square F Value Pr > F Model 3 921.937500 307.312500 0.82 0.5097 Error 12 4522.000000 376.833333 Corrected Total 15 5443.937500 R-Square Coeff Var Root MSE y Mean 0.169351 8.606127 19.41220 225.5625 Source DF Type I SS Mean Square F Value Pr > F x 3 921.9375000 307.3125000 0.82 0.5097 Source DF Type III SS Mean Square F Value Pr > F x 3 921.9375000 307.3125000 0.82 0.5097 Plastic hardness experiment (ANOVA for Exercise 1.22 data). 4 12:45 Thursday, January 8, 2009 Plot of yhat*x. Symbol used is '*'. Plot of y*x. Legend: A = 1 obs, B = 2 obs, etc. yhat | | 260 + | | | | A | 250 + A | A | A | | | 240 + | * | A | A | A | * 230 + A | | | | A | * 220 + A | * | | A | | 210 + | | | A | | 200 + A | A | A | | | 190 + | ---+-----------------+-----------------+-----------------+-- 16 24 32 40 x NOTE: 4 obs had missing values. 17 obs hidden. Plastic hardness experiment (ANOVA for Exercise 1.22 data). 5 12:45 Thursday, January 8, 2009 The GLM Procedure Number of Observations Read 20 Number of Observations Used 16 Plastic hardness experiment (ANOVA for Exercise 1.22 data). 6 12:45 Thursday, January 8, 2009 The GLM Procedure Dependent Variable: y Sum of Source DF Squares Mean Square F Value Pr > F Model 3 921.937500 307.312500 0.82 0.5097 Error 12 4522.000000 376.833333 Corrected Total 15 5443.937500 R-Square Coeff Var Root MSE y Mean 0.169351 8.606127 19.41220 225.5625 Source DF Type I SS Mean Square F Value Pr > F x 1 728.4834770 728.4834770 1.93 0.1897 x2 1 106.9662779 106.9662779 0.28 0.6039 x3 1 86.4877451 86.4877451 0.23 0.6405 Source DF Type III SS Mean Square F Value Pr > F x 1 102.2051545 102.2051545 0.27 0.6120 x2 1 98.0844391 98.0844391 0.26 0.6192 x3 1 86.4877451 86.4877451 0.23 0.6405 Standard Parameter Estimate Error t Value Pr > |t| Intercept 373.3333333 293.0871126 1.27 0.2269 x -18.5486111 35.6163698 -0.52 0.6120 x2 0.6875000 1.3475575 0.51 0.6192 x3 -0.0077040 0.0160810 -0.48 0.6405