Sleep <- scan('http://math.uttyler.edu/nathan/classes/statistics/data/hw2-add.data') t.test(Sleep) # One Sample t-test # #data: Sleep #t = 3.6799, df = 9, p-value = 0.005076 #alternative hypothesis: true mean is not equal to 0 #95 percent confidence interval: # 0.8976775 3.7623225 #sample estimates: #mean of x # 2.33 #alternative hypothesis: true mean is not equal to 0 # H1: mu =/= 0 # H0: mu = 0 # #p-value = 0.005076 # With such a small p-value, the null hypothesis seems to be very # unlikely (our sample would have to be about 1/200) so it seems # reasonable to conclude that the null is wrong and the alternative # hypothesis is true. ### Statistics speak: ### With a p-value of .005076 we reject the null hypothesis in favor of ### the alternative hypothesis that mu =/= 0. ### To test H1: mu =/= 1 versus H0: mu = 1 do: t.test(Sleep,mu=1.5) t.test(Sleep,mu=.8976775) ### To test H1: mu > 0 versus H0: mu <= 0 do: t.test(Sleep,alternative='greater') ### with a p-value of .002538 we reject the null hypothesis in favor of ### the alternative and conclude that the true mean is greater than 0 t.test(Sleep,conf.level = .9) ### H0: mu <= 2 H1: mu > 2 t.test(Sleep,mu=2,alternative='greater') ### with a p-value of .3074 we fail to reject the null hypothesis and ### are unable to conclude that the true mean is larger than 2