# Chapter 7 R examples toluene = c(543,523,431,635,564,549) control = c(535,385,502,412,387) qqnorm(toluene) shapiro.test(toluene) qqnorm(control) shapiro.test(control) t.test(toluene, control) control = c(10.0,13.2,19.8,19.3,21.2,13.9,20.3,9.6) ancy = c(13.2,19.5,11.0,5.8,12.8,7.1,7.7) qqnorm(control) shapiro.test(control) qqnorm(ancy) shapiro.test(ancy) t.test(control, ancy) # One-sided t-test: control = c(10.0,13.2,19.8,19.3,21.2,13.9,20.3,9.6) ancy = c(13.2,19.5,11.0,5.8,12.8,7.1,7.7) t.test(control, ancy, alternative="greater") # Power calculation: power.t.test(delta=1.8, sd=4.0, power=0.80, sig.level=0.05, type="two.sample", alternative="two.sided") # Mann-Whitney-Wilcoxon test: growth = c(17, 20, 170, 325, 22, 180, 60) gap = c(22, 29, 13, 16, 15, 18, 14, 6) qqnorm(growth) shapiro.test(growth) qqnorm(gap) shapiro.test(gap) wilcox.test(growth,gap, alternative="two.sided") control = c(10.0,13.2,19.8,19.3,21.2,13.9,20.3,9.6) ancy =c(13.2,19.5,11.0,5.8,12.8,7.1,7.7) wilcox.test(control,ancy, alternative="greater")