/* Two-way ANOVA (Balanced) */ OPTIONS LS=75 PS=55 NODATE PAGENO=1; DATA one; INPUT height $ width $ sales h1 h2 w1; cp1=h1*w1; cp2=h2*w1; DATALINES; Bottom Regular 47 1 0 1 Bottom Regular 43 1 0 1 Bottom Wide 46 1 0 -1 Bottom Wide 40 1 0 -1 Middle Regular 62 0 1 1 Middle Regular 68 0 1 1 Middle Wide 67 0 1 -1 Middle Wide 71 0 1 -1 Top Regular 41 -1 -1 1 Top Regular 39 -1 -1 1 Top Wide 42 -1 -1 -1 Top Wide 46 -1 -1 -1 ; PROC REG; TITLE 'PROC REG approach to two-way ANOVA'; MODEL sales = h1 h2 w1 cp1 cp2 / p; MODEL sales = h1 h2 w1 / p; MODEL sales = h1 h2 cp1 cp2; MODEL sales = w1 cp1 cp2; RUN; PROC REG; TITLE 'PROC REG approach to two-way ANOVA, no interaction'; MODEL sales = h1 h2 / p; MODEL sales = w1 / p; RUN; QUIT; **************************************************************************** PROC REG approach to two-way ANOVA 1 The REG Procedure Model: MODEL1 Dependent Variable: sales Number of Observations Read 12 Number of Observations Used 12 Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 5 1580.00000 316.00000 30.58 0.0003 Error 6 62.00000 10.33333 Corrected Total 11 1642.00000 Root MSE 3.21455 R-Square 0.9622 Dependent Mean 51.00000 Adj R-Sq 0.9308 Coeff Var 6.30304 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 51.00000 0.92796 54.96 <.0001 h1 1 -7.00000 1.31233 -5.33 0.0018 h2 1 16.00000 1.31233 12.19 <.0001 w1 1 -1.00000 0.92796 -1.08 0.3226 cp1 1 2.00000 1.31233 1.52 0.1783 cp2 1 -1.00000 1.31233 -0.76 0.4749 PROC REG approach to two-way ANOVA 2 The REG Procedure Model: MODEL1 Dependent Variable: sales Output Statistics Dependent Predicted Obs Variable Value Residual 1 47.0000 45.0000 2.0000 2 43.0000 45.0000 -2.0000 3 46.0000 43.0000 3.0000 4 40.0000 43.0000 -3.0000 5 62.0000 65.0000 -3.0000 6 68.0000 65.0000 3.0000 7 67.0000 69.0000 -2.0000 8 71.0000 69.0000 2.0000 9 41.0000 40.0000 1.0000 10 39.0000 40.0000 -1.0000 11 42.0000 44.0000 -2.0000 12 46.0000 44.0000 2.0000 Sum of Residuals 0 Sum of Squared Residuals 62.00000 Predicted Residual SS (PRESS) 248.00000 PROC REG approach to two-way ANOVA 3 The REG Procedure Model: MODEL2 Dependent Variable: sales Number of Observations Read 12 Number of Observations Used 12 Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 3 1556.00000 518.66667 48.25 <.0001 Error 8 86.00000 10.75000 Corrected Total 11 1642.00000 Root MSE 3.27872 R-Square 0.9476 Dependent Mean 51.00000 Adj R-Sq 0.9280 Coeff Var 6.42886 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 51.00000 0.94648 53.88 <.0001 h1 1 -7.00000 1.33853 -5.23 0.0008 h2 1 16.00000 1.33853 11.95 <.0001 w1 1 -1.00000 0.94648 -1.06 0.3216 PROC REG approach to two-way ANOVA 4 The REG Procedure Model: MODEL2 Dependent Variable: sales Output Statistics Dependent Predicted Obs Variable Value Residual 1 47.0000 43.0000 4.0000 2 43.0000 43.0000 0 3 46.0000 45.0000 1.0000 4 40.0000 45.0000 -5.0000 5 62.0000 66.0000 -4.0000 6 68.0000 66.0000 2.0000 7 67.0000 68.0000 -1.0000 8 71.0000 68.0000 3.0000 9 41.0000 41.0000 0 10 39.0000 41.0000 -2.0000 11 42.0000 43.0000 -1.0000 12 46.0000 43.0000 3.0000 Sum of Residuals 0 Sum of Squared Residuals 86.00000 Predicted Residual SS (PRESS) 193.50000 PROC REG approach to two-way ANOVA 5 The REG Procedure Model: MODEL3 Dependent Variable: sales Number of Observations Read 12 Number of Observations Used 12 Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 4 1568.00000 392.00000 37.08 <.0001 Error 7 74.00000 10.57143 Corrected Total 11 1642.00000 Root MSE 3.25137 R-Square 0.9549 Dependent Mean 51.00000 Adj R-Sq 0.9292 Coeff Var 6.37524 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 51.00000 0.93859 54.34 <.0001 h1 1 -7.00000 1.32737 -5.27 0.0012 h2 1 16.00000 1.32737 12.05 <.0001 cp1 1 2.00000 1.32737 1.51 0.1756 cp2 1 -1.00000 1.32737 -0.75 0.4758 PROC REG approach to two-way ANOVA 6 The REG Procedure Model: MODEL4 Dependent Variable: sales Number of Observations Read 12 Number of Observations Used 12 Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 3 36.00000 12.00000 0.06 0.9795 Error 8 1606.00000 200.75000 Corrected Total 11 1642.00000 Root MSE 14.16863 R-Square 0.0219 Dependent Mean 51.00000 Adj R-Sq -0.3449 Coeff Var 27.78162 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 51.00000 4.09013 12.47 <.0001 w1 1 -1.00000 4.09013 -0.24 0.8130 cp1 1 2.00000 5.78432 0.35 0.7384 cp2 1 -1.00000 5.78432 -0.17 0.8670 PROC REG approach to two-way ANOVA, no interaction 7 The REG Procedure Model: MODEL1 Dependent Variable: sales Number of Observations Read 12 Number of Observations Used 12 Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 2 1544.00000 772.00000 70.90 <.0001 Error 9 98.00000 10.88889 Corrected Total 11 1642.00000 Root MSE 3.29983 R-Square 0.9403 Dependent Mean 51.00000 Adj R-Sq 0.9271 Coeff Var 6.47026 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 51.00000 0.95258 53.54 <.0001 h1 1 -7.00000 1.34715 -5.20 0.0006 h2 1 16.00000 1.34715 11.88 <.0001 PROC REG approach to two-way ANOVA, no interaction 8 The REG Procedure Model: MODEL1 Dependent Variable: sales Output Statistics Dependent Predicted Obs Variable Value Residual 1 47.0000 44.0000 3.0000 2 43.0000 44.0000 -1.0000 3 46.0000 44.0000 2.0000 4 40.0000 44.0000 -4.0000 5 62.0000 67.0000 -5.0000 6 68.0000 67.0000 1.0000 7 67.0000 67.0000 0 8 71.0000 67.0000 4.0000 9 41.0000 42.0000 -1.0000 10 39.0000 42.0000 -3.0000 11 42.0000 42.0000 0 12 46.0000 42.0000 4.0000 Sum of Residuals 0 Sum of Squared Residuals 98.00000 Predicted Residual SS (PRESS) 174.22222 PROC REG approach to two-way ANOVA, no interaction 9 The REG Procedure Model: MODEL2 Dependent Variable: sales Number of Observations Read 12 Number of Observations Used 12 Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 1 12.00000 12.00000 0.07 0.7917 Error 10 1630.00000 163.00000 Corrected Total 11 1642.00000 Root MSE 12.76715 R-Square 0.0073 Dependent Mean 51.00000 Adj R-Sq -0.0920 Coeff Var 25.03362 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 51.00000 3.68556 13.84 <.0001 w1 1 -1.00000 3.68556 -0.27 0.7917 PROC REG approach to two-way ANOVA, no interaction 10 The REG Procedure Model: MODEL2 Dependent Variable: sales Output Statistics Dependent Predicted Obs Variable Value Residual 1 47.0000 50.0000 -3.0000 2 43.0000 50.0000 -7.0000 3 46.0000 52.0000 -6.0000 4 40.0000 52.0000 -12.0000 5 62.0000 50.0000 12.0000 6 68.0000 50.0000 18.0000 7 67.0000 52.0000 15.0000 8 71.0000 52.0000 19.0000 9 41.0000 50.0000 -9.0000 10 39.0000 50.0000 -11.0000 11 42.0000 52.0000 -10.0000 12 46.0000 52.0000 -6.0000 Sum of Residuals 0 Sum of Squared Residuals 1630.00000 Predicted Residual SS (PRESS) 2347.20000