* ch07egs.txt; * ch07eg1.sas; options ls=80; * an example with multicollinearity; ; * extra sums of squares, and multcollinearity; * Bodyfat data from table 7.1, page 257; data bodyfat; title 'Predicting Body Fat Example, (page 256)'; input x1 x2 x3 y; attrib x1 label='Triceps Skinfold Thickness' x2 label='Thigh Circumference' x3 label='Midarm Circumference' y label='Body Fat'; lines; 19.5 43.1 29.1 11.9 24.7 49.8 28.2 22.8 30.7 51.9 37.0 18.7 29.8 54.3 31.1 20.1 19.1 42.2 30.9 12.9 25.6 53.9 23.7 21.7 31.4 58.5 27.6 27.1 27.9 52.1 30.6 25.4 22.1 49.9 23.2 21.3 25.5 53.5 24.8 19.3 31.1 56.6 30.0 25.4 30.4 56.7 28.3 27.2 18.7 46.5 23.0 11.7 19.7 44.2 28.6 17.8 14.6 42.7 21.3 12.8 29.5 54.4 30.1 23.9 27.7 55.3 25.7 22.6 30.2 58.6 24.6 25.4 22.7 48.2 27.1 14.8 25.2 51.0 27.5 21.1 ; proc corr; var x1 x2 x3; proc glm; model y = x1 x2 x3; * enter regressors in another order; proc glm; model y = x2 x1 x3; Predicting Body Fat Example, (page 256) 1 The CORR Procedure 3 Variables: x1 x2 x3 Simple Statistics Variable N Mean Std Dev Sum Minimum Maximum x1 20 25.30500 5.02326 506.10000 14.60000 31.40000 x2 20 51.17000 5.23461 1023 42.20000 58.60000 x3 20 27.62000 3.64715 552.40000 21.30000 37.00000 Simple Statistics Variable Label x1 Triceps Skinfold Thickness x2 Thigh Circumference x3 Midarm Circumference Pearson Correlation Coefficients, N = 20 Prob > |r| under H0: Rho=0 x1 x2 x3 x1 1.00000 0.92384 0.45778 Triceps Skinfold Thickness <.0001 0.0424 x2 0.92384 1.00000 0.08467 Thigh Circumference <.0001 0.7227 x3 0.45778 0.08467 1.00000 Midarm Circumference 0.0424 0.7227 Predicting Body Fat Example, (page 256) 2 The GLM Procedure Number of observations 20 Predicting Body Fat Example, (page 256) 3 The GLM Procedure Dependent Variable: y Body Fat Sum of Source DF Squares Mean Square F Value Pr > F Model 3 396.9846118 132.3282039 21.52 <.0001 Error 16 98.4048882 6.1503055 Corrected Total 19 495.3895000 R-Square Coeff Var Root MSE y Mean 0.801359 12.28017 2.479981 20.19500 Source DF Type I SS Mean Square F Value Pr > F x1 1 352.2697968 352.2697968 57.28 <.0001 x2 1 33.1689128 33.1689128 5.39 0.0337 x3 1 11.5459022 11.5459022 1.88 0.1896 Source DF Type III SS Mean Square F Value Pr > F x1 1 12.70489278 12.70489278 2.07 0.1699 x2 1 7.52927788 7.52927788 1.22 0.2849 x3 1 11.54590217 11.54590217 1.88 0.1896 Standard Parameter Estimate Error t Value Pr > |t| Intercept 117.0846948 99.78240295 1.17 0.2578 x1 4.3340920 3.01551136 1.44 0.1699 x2 -2.8568479 2.58201527 -1.11 0.2849 x3 -2.1860603 1.59549900 -1.37 0.1896 Predicting Body Fat Example, (page 256) 5 (Here's the only change from entering regressors in a different order) Source DF Type I SS Mean Square F Value Pr > F x2 1 381.9658178 381.9658178 62.11 <.0001 x1 1 3.4728919 3.4728919 0.56 0.4633 x3 1 11.5459022 11.5459022 1.88 0.1896 * ch07eg2.sas; options ls=80; * an example without multicollinearity; ; * data from Table 7.6, page 279; * an equireplicate 2-way factorial design, so balanced; data equirep; title 'Work Crew Productivity Example, (page 279)'; input x1 x2 y; attrib x1 label='Crew Size' x2 label='Bonus Pay ($)' y label='Crew Productivity'; lines; 4 2 42 4 2 39 4 3 48 4 3 51 6 2 49 6 2 53 6 3 61 6 3 60 ; proc corr nosimple; var x1 x2; proc glm; model y = x1 x2; * enter regressors in the other order; proc glm; model y = x2 x1; Work Crew Productivity Example, (page 279) 1 The CORR Procedure 2 Variables: x1 x2 Pearson Correlation Coefficients, N = 8 Prob > |r| under H0: Rho=0 x1 x2 x1 1.00000 0.00000 Crew Size 1.0000 x2 0.00000 1.00000 Bonus Pay ($) 1.0000 Work Crew Productivity Example, (page 279) 2 The GLM Procedure Number of observations 8 Work Crew Productivity Example, (page 279) 3 The GLM Procedure Dependent Variable: y Crew Productivity Sum of Source DF Squares Mean Square F Value Pr > F Model 2 402.2500000 201.1250000 57.06 0.0004 Error 5 17.6250000 3.5250000 Corrected Total 7 419.8750000 R-Square Coeff Var Root MSE y Mean 0.958023 3.727044 1.877498 50.37500 Source DF Type I SS Mean Square F Value Pr > F x1 1 231.1250000 231.1250000 65.57 0.0005 x2 1 171.1250000 171.1250000 48.55 0.0009 Source DF Type III SS Mean Square F Value Pr > F x1 1 231.1250000 231.1250000 65.57 0.0005 x2 1 171.1250000 171.1250000 48.55 0.0009 Standard Parameter Estimate Error t Value Pr > |t| Intercept 0.375000000 4.74045093 0.08 0.9400 x1 5.375000000 0.66379590 8.10 0.0005 x2 9.250000000 1.32759180 6.97 0.0009 Work Crew Productivity Example, (page 279) 5 (Entering the regressors in reverse order changes nothing) Source DF Type I SS Mean Square F Value Pr > F x2 1 171.1250000 171.1250000 48.55 0.0009 x1 1 231.1250000 231.1250000 65.57 0.0005