Runners <- read.table('http://math.uttyler.edu/nathan/classes/statistics/data/jan23-runners.data') Runners[1:5,] names(Runners) # either Runners$weight or attach(runners) and then use weight attach(Runners) hist(weight) boxplot(weight) t.test(weight) # One Sample t-test # #data: weight #t = 62.9639, df = 23, p-value < 2.2e-16 #alternative hypothesis: true mean is not equal to 0 #95 percent confidence interval: # 59.76152 63.82181 #sample estimates: #mean of x # 61.79167 # the 95% confidence interval for average male runner weight is 59.76 to 63.82 # from this we're sure that the mean weight should be less than 65kg # we're not 95% confident that the average male runner weight is less than 63.5 # # but ... # # t.test(weight,alternative='less') # One Sample t-test # #data: weight #t = 62.9639, df = 23, p-value = 1 #alternative hypothesis: true mean is less than 0 #95 percent confidence interval: # -Inf 63.47363 #sample estimates: #mean of x # 61.79167 # so if we really only want an upper bound, we can say that the # average male runner weight is less than 63.5kg detach(Runners) Vitamin.C <- read.table('http://math.uttyler.edu/nathan/classes/statistics/data/jan23-vitaminc.data',header=TRUE) attach(Vitamin.C) names(Vitamin.C) boxplot(factory,haiti) t.test(factory) t.test(haiti) t.test(factory-haiti) # One Sample t-test # #data: factory - haiti #t = 4.9589, df = 26, p-value = 3.745e-05 #alternative hypothesis: true mean is not equal to 0 #95 percent confidence interval: # 3.122616 7.544050 #sample estimates: #mean of x # 5.333333 # average vitamin C loss is somewhere between 3.12 and 7.54 units detach(Vitamin.C) Malathion <- read.table('http://math.uttyler.edu/nathan/classes/statistics/data/jan23-malathion.data',header=TRUE) attach(Malathion) names(Malathion) boxplot(control,treatment) t.test(control,treatment) # Welch Two Sample t-test # #data: control and treatment #t = 5.9869, df = 17.625, p-value = 1.265e-05 #alternative hypothesis: true difference in means is not equal to 0 #95 percent confidence interval: # 1.438438 2.997459 #sample estimates: #mean of x mean of y # 3.384615 1.166667 # # we're 95% confident that the difference between means of the two groups # is between 1.43 and 2.99 (of course this is control - treatment so # we're doing average number less on treated stems)