> pdf("F:\\sta4210\\CH03TA04.pdf") > > plot(X,Y) > > bank.reg1 <- lm(Y~X) > summary(bank.reg1) Call: lm(formula = Y ~ X) Residuals: Min 1Q Median 3Q Max -59.23 -34.06 12.61 32.44 48.44 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 50.7225 39.3979 1.287 0.23 X 0.4867 0.2747 1.772 0.11 Residual standard error: 40.47 on 9 degrees of freedom Multiple R-squared: 0.2586, Adjusted R-squared: 0.1762 F-statistic: 3.139 on 1 and 9 DF, p-value: 0.1102 > anova(bank.reg1) Analysis of Variance Table Response: Y Df Sum Sq Mean Sq F value Pr(>F) X 1 5141.3 5141.3 3.1389 0.1102 Residuals 9 14741.6 1638.0 > > bank.aov1 <- lm(Y~factor(X)) > summary(bank.aov1) Call: lm(formula = Y ~ factor(X)) Residuals: 1 2 3 4 5 6 7 5.000e+00 -1.200e+01 1.000e+01 -7.000e+00 -3.331e-15 1.600e+01 7.000e+00 8 9 10 11 -1.600e+01 -5.000e+00 -1.000e+01 1.200e+01 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 35.00 10.71 3.267 0.022282 * factor(X)100 89.00 15.15 5.874 0.002030 ** factor(X)125 120.00 15.15 7.919 0.000517 *** factor(X)150 117.00 18.56 6.305 0.001478 ** factor(X)175 105.00 15.15 6.930 0.000960 *** factor(X)200 79.00 15.15 5.214 0.003428 ** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 15.15 on 5 degrees of freedom Multiple R-squared: 0.9423, Adjusted R-squared: 0.8845 F-statistic: 16.32 on 5 and 5 DF, p-value: 0.004085 > anova(bank.aov1) Analysis of Variance Table Response: Y Df Sum Sq Mean Sq F value Pr(>F) factor(X) 5 18735 3747.0 16.32 0.004085 ** Residuals 5 1148 229.6 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > > anova(bank.reg1,bank.aov1) Analysis of Variance Table Model 1: Y ~ X Model 2: Y ~ factor(X) Res.Df RSS Df Sum of Sq F Pr(>F) 1 9 14742 2 5 1148 4 13594 14.801 0.005594 ** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 >