> ## sec 2.8 Tire Exp't > # > data<-read.table("tire.dat", h=T, skip=2) > data Tire Compound Wear 1 1 A 238 2 1 B 238 3 1 C 279 4 2 A 196 5 2 B 213 6 2 D 308 7 3 A 254 8 3 C 334 9 3 D 367 10 4 B 312 11 4 C 421 12 4 D 412 > g<- lm(Wear ~ as.factor(Tire) + Compound, data = data) > anova(g) # table 2.25 Analysis of Variance Table Response: Wear Df Sum Sq Mean Sq F value Pr(>F) as.factor(Tire) 3 39123 13041 37.240 0.0007618 *** Compound 3 20729 6910 19.732 0.0033516 ** Residuals 5 1751 350 --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 > summary(g) # part of table 2.26 Call: lm(formula = Wear ~ as.factor(Tire) + Compound, data = data) Residuals: 1 2 3 4 5 6 7 8 9 13.208 8.833 -22.042 -7.917 4.708 3.208 -5.292 -1.542 6.833 10 11 12 -13.542 23.583 -10.042 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 224.792 14.292 15.728 1.89e-05 *** as.factor(Tire)2 -20.875 16.206 -1.288 0.25410 as.factor(Tire)3 34.500 16.206 2.129 0.08653 . as.factor(Tire)4 96.375 16.206 5.947 0.00192 ** CompoundB 4.375 16.206 0.270 0.79798 CompoundC 76.250 16.206 4.705 0.00531 ** CompoundD 100.875 16.206 6.225 0.00157 ** --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 Residual standard error: 18.71 on 5 degrees of freedom Multiple R-Squared: 0.9716, Adjusted R-squared: 0.9375 F-statistic: 28.49 on 6 and 5 DF, p-value: 0.001029 > > # For a BIBD, ANOVA depends on the order of the treatment and block factors entering the model. > # E.g., the following ANOVA table is different from Table 2.25 > # the correct ANOVA is Table 2.25 (the treatment effects are adjusted for the block effects) > g<- lm(Wear ~ Compound + as.factor(Tire) , data = data) > anova(g) Analysis of Variance Table Response: Wear Df Sum Sq Mean Sq F value Pr(>F) Compound 3 38814 12938 36.946 0.0007763 *** as.factor(Tire) 3 21038 7013 20.026 0.0032406 ** Residuals 5 1751 350 --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1