This page shows how to obtain the results from Chatterjee, Hadi and Price’s Chapter 3 using SAS.
Use data in file p054.
data p054; input Y X1 X2 X3 X4 X5 X6 ; cards; 43 51 30 39 61 92 45 63 64 51 54 63 73 47 71 70 68 69 76 86 48 61 63 45 47 54 84 35 81 78 56 66 71 83 47 43 55 49 44 54 49 34 58 67 42 56 66 68 35 71 75 50 55 70 66 41 72 82 72 67 71 83 31 67 61 45 47 62 80 41 64 53 53 58 58 67 34 67 60 47 39 59 74 41 69 62 57 42 55 63 25 68 83 83 45 59 77 35 77 77 54 72 79 77 46 81 90 50 72 60 54 36 74 85 64 69 79 79 63 65 60 65 75 55 80 60 65 70 46 57 75 85 46 50 58 68 54 64 78 52 50 40 33 34 43 64 33 64 61 52 62 66 80 41 53 66 52 50 63 80 37 40 37 42 58 50 57 49 63 54 42 48 66 75 33 66 77 66 63 88 76 72 78 75 58 74 80 78 49 48 57 44 45 51 83 38 85 85 71 71 77 74 55 82 82 39 59 64 78 39 ; run;
Table 3.3, page 54.
proc print data=p054 (obs=4); run; Obs Y X1 X2 X3 X4 X5 X6 1 43 51 30 39 61 92 45 2 63 64 51 54 63 73 47 3 71 70 68 69 76 86 48 4 61 63 45 47 54 84 35 [remainder of observations omitted]
Coefficients for equation 3.12, page 57.
proc reg data=p054; model y = x1 x2; run; The REG Procedure Model: MODEL1 Dependent Variable: Y Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 2 2935.10281 1467.55141 29.10 <.0001 Error 27 1361.86385 50.43940 Corrected Total 29 4296.96667 Root MSE 7.10207 R-Square 0.6831 Dependent Mean 64.63333 Adj R-Sq 0.6596 Coeff Var 10.98825 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 15.32762 7.16023 2.14 0.0415 X1 1 0.78034 0.11939 6.54 <.0001 X2 1 -0.05016 0.12992 -0.39 0.7025
Coefficients for equation 3.13, page 57.
Note: The output statement creates a new variable, eyx2, for the residual and places it along with the other variables into the SAS dataset p054b.
proc reg data=p054; model y = x1; output out=p054a residual=eyx1; run; The REG Procedure Model: MODEL1 Dependent Variable: Y Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 1 2927.58425 2927.58425 59.86 <.0001 Error 28 1369.38241 48.90651 Corrected Total 29 4296.96667 Root MSE 6.99332 R-Square 0.6813 Dependent Mean 64.63333 Adj R-Sq 0.6699 Coeff Var 10.81999 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 14.37632 6.61999 2.17 0.0385 X1 1 0.75461 0.09753 7.74 <.000
Coefficients for equation 3.14, page 57.
proc reg data=p054a; model x2 = x1; output out=p054b residual=ex2x1; run; The REG Procedure Model: MODEL1 Dependent Variable: X2 Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 1 1353.17314 1353.17314 12.68 0.0013 Error 28 2988.29352 106.72477 Corrected Total 29 4341.46667 Root MSE 10.33077 R-Square 0.3117 Dependent Mean 53.13333 Adj R-Sq 0.2871 Coeff Var 19.44310 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 18.96540 9.77927 1.94 0.0626 X1 1 0.51303 0.14408 3.56 0.0013
Table 3.4, page 58.
proc print data=p054b; var eyx1 ex2x1; run; Obs eyx1 ex2x1 1 -10.6203 -15.1300 2 0.2886 -0.7995 3 4.4592 13.1224 4 -1.2321 -6.2864 5 7.6145 -2.9819 6 -12.7887 1.8178 7 -7.5039 -11.3385 8 -0.3454 -7.4428 9 -3.7043 10.9660 10 6.3286 -5.2604 11 9.9726 6.8439 12 7.2093 -2.7473 13 8.1502 6.2266 14 -7.9329 21.4529 15 4.2946 -4.4689 16 -2.0505 -15.1383 17 -4.4466 1.4269 18 6.1122 15.2527 19 -2.6443 -8.8776 20 -7.1767 19.2787 21 5.1139 -6.4867 22 3.6797 1.7396 23 -11.2220 -0.8255 24 -2.0936 4.0524 25 7.6405 -4.6691 26 -6.1035 7.5311 27 7.0559 0.5572 28 -9.6002 -4.2082 29 6.9045 8.4269 30 4.6405 -22.0340
Coefficients for equation 3.15, page 58.
Note: Values such as -4.6735E-17 are zero as represented by SAS in double precision.
proc reg data=p054b; model eyx1= ex2x1; run; quit; The REG Procedure Model: MODEL1 Dependent Variable: eyx1 Residual Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 1 0 0 0.00 1.0000 Error 28 1361.86385 48.63799 Corrected Total 29 1361.86385 Root MSE 6.97409 R-Square 0.0000 Dependent Mean -1.0244E-14 Adj R-Sq -0.0357 Coeff Var -6.80821E16 Parameter Estimates Parameter Standard Variable Label DF Estimate Error t Value Pr > |t| Intercept Intercept 1 -1.0244E-14 1.27329 -0.00 1.0000 ex2x1 Residual 1 -4.6735E-17 0.12758 -0.00 1.0000
Equation 3.25, page 62; Table 3.5, page 63; Table 3.7, page 67; and Equation 3.40, page 68.
Note: The test statement is used to test specific hypotheses concerning regression parameters.
proc reg data=p054; model y = x1 x2 x3 x4 x5 x6; t1: test x2=0, x4=0, x5=0, x6=0; run; The REG Procedure Model: MODEL1 Dependent Variable: Y Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 6 3147.96634 524.66106 10.50 <.0001 Error 23 1149.00032 49.95654 Corrected Total 29 4296.96667 Root MSE 7.06799 R-Square 0.7326 Dependent Mean 64.63333 Adj R-Sq 0.6628 Coeff Var 10.93552 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 10.78708 11.58926 0.93 0.3616 X1 1 0.61319 0.16098 3.81 0.0009 X2 1 -0.07305 0.13572 -0.54 0.5956 X3 1 0.32033 0.16852 1.90 0.0699 X4 1 0.08173 0.22148 0.37 0.7155 X5 1 0.03838 0.14700 0.26 0.7963 X6 1 -0.21706 0.17821 -1.22 0.2356 Test T1 Results for Dependent Variable Y Mean Source DF Square F Value Pr > F Numerator 4 26.41216 0.53 0.7158 Denominator 23 49.95654
Table 3.8, page 69.
proc reg data=p054; model y = x1 x3; run; The REG Procedure Model: MODEL1 Dependent Variable: Y Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 2 3042.31770 1521.15885 32.74 <.0001 Error 27 1254.64897 46.46848 Corrected Total 29 4296.96667 Root MSE 6.81678 R-Square 0.7080 Dependent Mean 64.63333 Adj R-Sq 0.6864 Coeff Var 10.54685 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 9.87088 7.06122 1.40 0.1735 X1 1 0.64352 0.11848 5.43 <.0001 X3 1 0.21119 0.13440 1.57 0.1278
Equation following 3.48, page 71.
Note 1: New variables need to be created in a data step.Note 2: The set statement is used to include all of the variables from the p054 dataset.
data p054c; set p054; w = x1 + x3; run; proc reg data=p054c; model y = w; run; quit; The REG Procedure Model: MODEL1 Dependent Variable: Y Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 1 2872.37206 2872.37206 56.46 <.0001 Error 28 1424.59461 50.87838 Corrected Total 29 4296.96667 Root MSE 7.13291 R-Square 0.6685 Dependent Mean 64.63333 Adj R-Sq 0.6566 Coeff Var 11.03596 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 9.98821 7.38841 1.35 0.1872 w 1 0.44439 0.05914 7.51 <.0001
F-ratio middle of page 71.
proc reg data=p054c; model y = x1 x3; t2: test x1 = x3; run; quit;
Test t2 Results for Dependent Variable Y Mean Source DF Square F Value Pr > F Numerator 1 169.94564 3.66 0.0665 Denominator 27 46.46848
F-ratio near the top of page 72.
proc reg data=p054c; model y = x1 x2 x3 x4 x5 x6; t3: test x1 = x3, x2=0, x4=0, x5=0, x6=0; run; [some output omitted] The REG Procedure Model: MODEL1 Test T3 Results for Dependent Variable Y Mean Source DF Square F Value Pr > F Numerator 5 55.11886 1.10 0.3857 Denominator 23 49.95654
Method 1: Equations at the bottom of page 72 and top of page 73.
Note: The coefficient for x3, .306, needs to be computed by hand.
data p054d; set p054; yprime = y - x3; v = x1 - x3; run; proc reg data=p054d; model yprime = v; run; The REG Procedure Model: MODEL1 Dependent Variable: yprime Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 1 1794.31921 1794.31921 37.79 <.0001 Error 28 1329.54746 47.48384 Corrected Total 29 3123.86667 Root MSE 6.89085 R-Square 0.5744 Dependent Mean 8.26667 Adj R-Sq 0.5592 Coeff Var 83.35708 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 1.16654 1.70788 0.68 0.5002 v 1 0.69382 0.11287 6.15 <.0001
Method 2: Equations at the bottom of page 72 and top of page 73.
Note: The restrict command is used to compute constrained linear regressions. In this example, it computes the coefficients for both x1 and x3 in a single command.
proc reg data=p054; model y = x1 x3; restrict x1 + x3 = 1; run; The REG Procedure Model: MODEL1 Dependent Variable: Y NOTE: Restrictions have been applied to parameter estimates. Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 1 2967.41921 2967.41921 62.49 <.0001 Error 28 1329.54746 47.48384 Corrected Total 29 4296.96667 Root MSE 6.89085 R-Square 0.6906 Dependent Mean 64.63333 Adj R-Sq 0.6795 Coeff Var 10.66145 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 1.16654 1.70788 0.68 0.5002 X1 1 0.69382 0.11287 6.15 <.0001 X3 1 0.30618 0.11287 2.71 0.0113 RESTRICT -1 -515.50829 410.46113 -1.26 0.2151* * Probability computed using beta distribution.
F-ratio at the top of page 73.
proc reg data=p054; model y = x1 x3; t4: test x1 + x3 = 1; run; [some output omitted] The REG Procedure Model: MODEL1 Test T4 Results for Dependent Variable Y Mean Source DF Square F Value Pr > F Numerator 1 74.89848 1.61 0.2151 Denominator 27 46.46848