> ## Girder Exp't > data<-read.table("http://www2.isye.gatech.edu/%7Ejeffwu/book/data/girder.dat", h=T) > data Aarau Karlsruhe Lehigh Cardiff 1 0.772 1.186 1.061 1.025 2 0.744 1.151 0.992 0.905 3 0.767 1.322 1.063 0.930 4 0.745 1.339 1.062 0.899 5 0.725 1.200 1.065 0.871 6 0.844 1.402 1.178 1.004 7 0.831 1.365 1.037 0.853 8 0.867 1.537 1.086 0.858 9 0.859 1.559 1.052 0.805 > y<-c(t(data)) # row-wise > y [1] 0.772 1.186 1.061 1.025 0.744 1.151 0.992 0.905 0.767 1.322 1.063 0.930 [13] 0.745 1.339 1.062 0.899 0.725 1.200 1.065 0.871 0.844 1.402 1.178 1.004 [25] 0.831 1.365 1.037 0.853 0.867 1.537 1.086 0.858 0.859 1.559 1.052 0.805 > girder <- rep(1:9, rep(4,9)) > girder [1] 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 5 5 5 5 6 6 6 6 7 7 7 7 8 8 8 8 9 9 9 9 > method<-rep(1:4, 9) > method [1] 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 > > g<-lm(y~as.factor(girder)+as.factor(method)) > anova(g) Analysis of Variance Table Response: y Df Sum Sq Mean Sq F value Pr(>F) as.factor(girder) 8 0.08949 0.01119 1.6189 0.1717 as.factor(method) 3 1.51381 0.50460 73.0267 3.296e-12 *** Residuals 24 0.16584 0.00691 --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 > > # the first 3 t values (i.e. t statistics for A vs K, A vs L, A vs C) can be read from the summary (because the default contrast coding is baseline constraint) > summary(g) Call: lm(formula = y ~ as.factor(girder) + as.factor(method)) Residuals: Min 1Q Median 3Q Max -0.14261 -0.03201 0.00668 0.02838 0.17683 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.77919 0.04799 16.236 1.91e-14 *** as.factor(girder)2 -0.06300 0.05878 -1.072 0.29446 as.factor(girder)3 0.00950 0.05878 0.162 0.87296 as.factor(girder)4 0.00025 0.05878 0.004 0.99664 as.factor(girder)5 -0.04575 0.05878 -0.778 0.44397 as.factor(girder)6 0.09600 0.05878 1.633 0.11547 as.factor(girder)7 0.01050 0.05878 0.179 0.85972 as.factor(girder)8 0.07600 0.05878 1.293 0.20832 as.factor(girder)9 0.05775 0.05878 0.983 0.33565 as.factor(method)2 0.54522 0.03919 13.914 5.51e-13 *** as.factor(method)3 0.27133 0.03919 6.924 3.68e-07 *** as.factor(method)4 0.11067 0.03919 2.824 0.00939 ** --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 Residual standard error: 0.08313 on 24 degrees of freedom Multiple R-Squared: 0.9063, Adjusted R-squared: 0.8633 F-statistic: 21.09 on 11 and 24 DF, p-value: 1.047e-09