# December 10, 2024 ### Example 1 Y<-c(4,2,5,2,3,6,3,5,3,6,5,4,6,7,6,5,7,2,3,5) X<-c(rep("A",5),rep("B",5),rep("C",10)) Y X boxplot(Y~X) t.test(Y~X) # A vs. B t.test(Y[1:10]~X[1:10]) # A vs. C t.test(Y[c(1:5,11:20)]~X[c(1:5,11:20)]) # B vs. C t.test(Y[6:20]~X[6:20]) t.test(Y[X=='A'|X=='B']~X[X=='A'|X=='B']) t.test(Y[X=='A'|X=='C']~X[X=='A'|X=='C']) t.test(Y[X=='B'|X=='C']~X[X=='B'|X=='C']) choose(3,2) choose(4,2) choose(10,2) anova(lm(Y~X)) summary(aov(Y~X)) ### Example 2 warpbreaks ?TukeyHSD summary(fm1 <- aov(breaks ~ wool + tension, data = warpbreaks)) anova(lm(breaks ~ wool + tension, data = warpbreaks)) TukeyHSD(fm1, "tension", ordered = TRUE) plot(TukeyHSD(fm1, "tension"))