FILENAME fn_hw10 URL "http://www.stat.wmich.edu/naranjo/stat6620/senic_data.txt"; OPTIONS LS=75 PS=55 NODATE PAGENO=1; DATA one; INFILE fn_hw10; INPUT hospital stay age infect culture xray beds school region patients nurses services; RUN; DATA two; SET one; IF school=1 THEN affiln=0; ELSE IF school=2 THEN affiln=1; ELSE affiln=.; ratio=beds/nurses; patients2=log(patients); RUN; PROC PRINT DATA=two (obs=20); VAR beds nurses school affiln ratio patients patients2; RUN; /* Solution starts here */ DATA three; SET two; aff_bed=affiln*beds; aff_pat=affiln*patients; /**************** HW10(a) ****************/ PROC REG DATA=three; MODEL nurses=beds patients; MODEL nurses=beds patients affiln aff_bed aff_pat; MODEL nurses=beds patients affiln; RUN; /**************** HW10(b) ****************/ PROC REG DATA=three; MODEL nurses=beds patients affiln aff_bed aff_pat; TEST affiln=0, aff_bed=0, aff_pat=0; TEST aff_bed=0, aff_pat=0; RUN; PROC SGPLOT DATA=three; REG X=beds Y=nurses / GROUP=affiln; RUN; PROC SGPLOT DATA=three dattrmap=attrmap; REG X=patients Y=nurses / GROUP=affiln; RUN; QUIT; *************************************************************************** The SAS System 1 Obs beds nurses school affiln ratio patients patients2 1 279 241 2 1 1.15768 207 5.33272 2 80 52 2 1 1.53846 51 3.93183 3 107 54 2 1 1.98148 82 4.40672 4 147 148 2 1 0.99324 53 3.97029 5 180 151 2 1 1.19205 134 4.89784 6 150 106 2 1 1.41509 147 4.99043 7 186 129 2 1 1.44186 151 5.01728 8 640 360 1 0 1.77778 399 5.98896 9 182 118 2 1 1.54237 130 4.86753 10 85 66 2 1 1.28788 59 4.07754 11 768 656 1 0 1.17073 591 6.38182 12 167 59 2 1 2.83051 105 4.65396 13 322 349 1 0 0.92264 252 5.52943 14 97 79 2 1 1.22785 59 4.07754 15 72 38 2 1 1.89474 61 4.11087 16 387 405 2 1 0.95556 326 5.78690 17 108 73 2 1 1.47945 84 4.43082 18 133 101 2 1 1.31683 113 4.72739 19 134 125 2 1 1.07200 103 4.63473 20 833 519 2 1 1.60501 547 6.30445 The SAS System 2 The REG Procedure Model: MODEL1 Dependent Variable: nurses Number of Observations Read 113 Number of Observations Used 113 Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 2 1826174 913087 290.25 <.0001 Error 110 346049 3145.89863 Corrected Total 112 2172223 Root MSE 56.08831 R-Square 0.8407 Dependent Mean 173.24779 Adj R-Sq 0.8378 Coeff Var 32.37462 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 7.90917 8.77244 0.90 0.3692 beds 1 0.47691 0.14165 3.37 0.0010 patients 1 0.23554 0.17765 1.33 0.1876 The SAS System 3 The REG Procedure Model: MODEL2 Dependent Variable: nurses Number of Observations Read 113 Number of Observations Used 113 Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 5 1861029 372206 127.98 <.0001 Error 107 311194 2908.35747 Corrected Total 112 2172223 Root MSE 53.92919 R-Square 0.8567 Dependent Mean 173.24779 Adj R-Sq 0.8500 Coeff Var 31.12836 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 69.58357 37.49309 1.86 0.0662 beds 1 0.85770 0.20884 4.11 <.0001 patients 1 -0.36179 0.25384 -1.43 0.1570 affiln 1 -61.86293 38.66528 -1.60 0.1126 aff_bed 1 -0.74079 0.27979 -2.65 0.0093 aff_pat 1 1.06883 0.35150 3.04 0.0030 The SAS System 4 The REG Procedure Model: MODEL3 Dependent Variable: nurses Number of Observations Read 113 Number of Observations Used 113 Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 3 1831236 610412 195.12 <.0001 Error 109 340987 3128.31918 Corrected Total 112 2172223 Root MSE 55.93138 R-Square 0.8430 Dependent Mean 173.24779 Adj R-Sq 0.8387 Coeff Var 32.28404 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 34.44366 22.61950 1.52 0.1307 beds 1 0.49092 0.14168 3.46 0.0008 patients 1 0.18412 0.18171 1.01 0.3132 affiln 1 -23.80883 18.71673 -1.27 0.2061 The SAS System 5 The REG Procedure Model: MODEL1 Dependent Variable: nurses Number of Observations Read 113 Number of Observations Used 113 Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 5 1861029 372206 127.98 <.0001 Error 107 311194 2908.35747 Corrected Total 112 2172223 Root MSE 53.92919 R-Square 0.8567 Dependent Mean 173.24779 Adj R-Sq 0.8500 Coeff Var 31.12836 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 69.58357 37.49309 1.86 0.0662 beds 1 0.85770 0.20884 4.11 <.0001 patients 1 -0.36179 0.25384 -1.43 0.1570 affiln 1 -61.86293 38.66528 -1.60 0.1126 aff_bed 1 -0.74079 0.27979 -2.65 0.0093 aff_pat 1 1.06883 0.35150 3.04 0.0030 The SAS System 6 The REG Procedure Model: MODEL1 Test 1 Results for Dependent Variable nurses Mean Source DF Square F Value Pr > F Numerator 3 11618 3.99 0.0097 Denominator 107 2908.35747 The SAS System 7 The REG Procedure Model: MODEL1 Test 2 Results for Dependent Variable nurses Mean Source DF Square F Value Pr > F Numerator 2 14896 5.12 0.0075 Denominator 107 2908.35747