############# R code for variation on problem 6.38, Ott & Longnecker (5th ed.) ### Comparing two populations via two sample & paired t-tests ############################################################################### # load package "car" (needed by qq.plot) library(car) # Data: lung capacity of 12 mice (x1=no ozone) vs. 12 mice (x2=ozone) x1<-c(8.7,7.9,8.3,8.4,9.2,9.1,8.2,8.1,8.9,8.2,8.9,7.5) x2<-c(9.4,9.8,9.9,10.3,8.9,8.8,9.8,8.2,9.4,9.9,12.2,9.3) # side-by-side boxplots boxplot(x1,x2,names=c("no-ozone","ozone"),main="Lung Capacity") # first test for equal variances (parametric & nonparametric) var.test(x1, x2, ratio = 1, alternative ="two.sided") # parametric fligner.test(x1, x2) # non-par # two-sample t-test for Ha: mu_1