OPTIONS NODATE ls=75 PS=55 PAGENO=1; DATA one; INPUT months size type; sizetype=size*type; DATALINES; 17 151 0 26 92 0 21 175 0 30 31 0 22 104 0 0 277 0 12 210 0 19 120 0 4 290 0 16 238 0 28 164 1 15 272 1 11 295 1 38 68 1 31 85 1 21 224 1 20 166 1 13 305 1 30 124 1 14 246 1 ; PROC PRINT; RUN; PROC REG DATA=one; TITLE '(Qualitative Predictor Variables from Chap. 8, p.239)'; TITLE3 'Model 1: One regression line (Y vs X1)'; MODEL months = size; RUN; PROC REG DATA=one; TITLE3 'Model 2: Two parallel regression lines (Y vs X1, X2ind)'; MODEL months = size type; RUN; PROC REG DATA=one; TITLE3 'Model 3: Two regression lines (Y vs X1, X2ind, X1*X2ind)'; MODEL months = size type sizetype; Parallel: test sizetype=0; OneLine: test type=0, sizetype=0; RUN; PROC REG DATA=one; TITLE3 'Separate regressions'; MODEL months = size; BY type; RUN; QUIT; *************************************************************************** The SAS System 1 Obs months size type sizetype 1 17 151 0 0 2 26 92 0 0 3 21 175 0 0 4 30 31 0 0 5 22 104 0 0 6 0 277 0 0 7 12 210 0 0 8 19 120 0 0 9 4 290 0 0 10 16 238 0 0 11 28 164 1 164 12 15 272 1 272 13 11 295 1 295 14 38 68 1 68 15 31 85 1 85 16 21 224 1 224 17 20 166 1 166 18 13 305 1 305 19 30 124 1 124 20 14 246 1 246 (Qualitative Predictor Variables from Chap. 8, p.239) 2 Model 1: One regression line (Y vs X1) The REG Procedure Model: MODEL1 Dependent Variable: months Number of Observations Read 20 Number of Observations Used 20 Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 1 1188.16736 1188.16736 43.41 <.0001 Error 18 492.63264 27.36848 Corrected Total 19 1680.80000 Root MSE 5.23149 R-Square 0.7069 Dependent Mean 19.40000 Adj R-Sq 0.6906 Coeff Var 26.96644 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 36.48211 2.84425 12.83 <.0001 size 1 -0.09394 0.01426 -6.59 <.0001 (Qualitative Predictor Variables from Chap. 8, p.239) 3 Model 2: Two parallel regression lines (Y vs X1, X2ind) The REG Procedure Model: MODEL1 Dependent Variable: months Number of Observations Read 20 Number of Observations Used 20 Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 2 1504.41333 752.20667 72.50 <.0001 Error 17 176.38667 10.37569 Corrected Total 19 1680.80000 Root MSE 3.22113 R-Square 0.8951 Dependent Mean 19.40000 Adj R-Sq 0.8827 Coeff Var 16.60377 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 33.87407 1.81386 18.68 <.0001 size 1 -0.10174 0.00889 -11.44 <.0001 type 1 8.05547 1.45911 5.52 <.0001 (Qualitative Predictor Variables from Chap. 8, p.239) 4 Model 3: Two regression lines (Y vs X1, X2ind, X1*X2ind) The REG Procedure Model: MODEL1 Dependent Variable: months Number of Observations Read 20 Number of Observations Used 20 Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 3 1504.41904 501.47301 45.49 <.0001 Error 16 176.38096 11.02381 Corrected Total 19 1680.80000 Root MSE 3.32021 R-Square 0.8951 Dependent Mean 19.40000 Adj R-Sq 0.8754 Coeff Var 17.11450 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 33.83837 2.44065 13.86 <.0001 size 1 -0.10153 0.01305 -7.78 <.0001 type 1 8.13125 3.65405 2.23 0.0408 sizetype 1 -0.00041714 0.01833 -0.02 0.9821 (Qualitative Predictor Variables from Chap. 8, p.239) 5 Model 3: Two regression lines (Y vs X1, X2ind, X1*X2ind) The REG Procedure Model: MODEL1 Test Parallel Results for Dependent Variable months Mean Source DF Square F Value Pr > F Numerator 1 0.00571 0.00 0.9821 Denominator 16 11.02381 (Qualitative Predictor Variables from Chap. 8, p.239) 6 Model 3: Two regression lines (Y vs X1, X2ind, X1*X2ind) The REG Procedure Model: MODEL1 Test OneLine Results for Dependent Variable months Mean Source DF Square F Value Pr > F Numerator 2 158.12584 14.34 0.0003 Denominator 16 11.02381 (Qualitative Predictor Variables from Chap. 8, p.239) 7 Separate regressions --------------------------------- type=0 ---------------------------------- The REG Procedure Model: MODEL1 Dependent Variable: months Number of Observations Read 10 Number of Observations Used 10 Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 1 667.01559 667.01559 48.04 0.0001 Error 8 111.08441 13.88555 Corrected Total 9 778.10000 Root MSE 3.72633 R-Square 0.8572 Dependent Mean 16.70000 Adj R-Sq 0.8394 Coeff Var 22.31337 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 33.83837 2.73918 12.35 <.0001 size 1 -0.10153 0.01465 -6.93 0.0001 (Qualitative Predictor Variables from Chap. 8, p.239) 8 Separate regressions --------------------------------- type=1 ---------------------------------- The REG Procedure Model: MODEL1 Dependent Variable: months Number of Observations Read 10 Number of Observations Used 10 Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 1 691.60345 691.60345 84.73 <.0001 Error 8 65.29655 8.16207 Corrected Total 9 756.90000 Root MSE 2.85693 R-Square 0.9137 Dependent Mean 22.10000 Adj R-Sq 0.9029 Coeff Var 12.92730 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 41.96962 2.33998 17.94 <.0001 size 1 -0.10195 0.01108 -9.21 <.0001