data1<-read.table("http://web.mst.edu/~wenx/teaching/stat6554/data/data-ex1304.txt",header=T) y<-data1$Acid trt<-data1$Method ftrt<-factor(trt) l1<-lm(y~ftrt) summary(l1) anova(l1) contrast.matrix<-rbind( "contr 1"=c(2, -1,-1), "contr 2"=c(0, 1, -1)) library(multcomp) aov.trt<-aov(y~ftrt) summary(glht(aov.trt,linfct=mcp(ftrt=contrast.matrix),alternative="two.sided"), test=adjusted("none")) c1<-rep(contrast.matrix[1,],each=7) c2<-rep(contrast.matrix[2,],each=7) anova(lm(y~c1+c2)) Analysis of Variance Table Response: y Df Sum Sq Mean Sq F value Pr(>F) c1 1 85.058 85.058 27.854 5.11e-05 *** c2 1 62.287 62.287 20.397 0.0002672 *** Residuals 18 54.967 3.054 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1