wbw <- read.table("http://www.stat.ufl.edu/~winner/data/whole_breast_weight.dat", header=F,col.names=c("trt","repnum","base","meth","wtg")) attach(wbw); names(wbw) # Treatment Ordering: BS, BSM, BC, BCM trt.f <- factor(trt) require(multcomp) wbw.mod1 <- aov(wtg ~ trt.f) summary(wbw.mod1) wbw.glht <- glht(wbw.mod1, linfct = mcp(trt.f="Tukey")) summary(wbw.glht) # the summary of the tests confint(wbw.glht) windows(width=5,height=3,pointsize=10) plot(wbw.glht) title(sub="Whole Breast Weight Data",adj=0) mtext("Tukey Honest Significant Differences",side=3,line=0.5) ### Creating three orthogonal contrasts, testing each contr.ort1 <- rbind( "Corn - Sorghum"=c(-1,-1,1,1),"Meth - NoMeth"=c(-1,1,-1,1), "(C-S)M - (C-S)NM"=c(1,-1,-1,1)) confint(glht(wbw.mod1,linfct=mcp(trt.f=contr.ort1))) ### Treating "BC" as a Control Treatment - Dunnett's Test levels(trt.f) trt.f1 <- relevel(trt.f, ref="3") levels(trt.f1) wbw.mod2 <- aov(wtg ~ trt.f1) summary(wbw.mod2) wbw.Dunnett <- glht(wbw.mod2, linfct=mcp(trt.f1="Dunnett")) summary(wbw.Dunnett) confint(wbw.Dunnett) windows(width=5,height=3,pointsize=10) plot(wbw.Dunnett,sub="Whole Breast Weight Data") mtext("Dunnet's Method",side=3,line=0.5) ### Duncan's and SNK Test require(agricolae) duncan.test(wbw.mod1,"trt.f",main="Whole Breast Weight",console=TRUE) SNK.test(wbw.mod1,"trt.f",main="Whole Breast Weight",console=TRUE)