l.hydro <- scan('http://math.uttyler.edu/nathan/classes/statistics/data/hw2-add.data') summary(l.hydro) boxplot(l.hydro) #boxplot(l.hydro,rnorm(30,mean=mean(l.hydro),sd=sd(l.hydro))) hist(l.hydro) t.test(l.hydro) # One Sample t-test # #data: l.hydro #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 # we are 95% confident that the average number of extra hrs of sleep of # l.hydro takers is between .90 and 3.76 t.test(l.hydro,conf.level=.9) # we are 95% confident that the average number of extra hrs of sleep of # l.hydro takers is at least 1.17. ##################################################### ##################################################### ##################################################### ### Problem Two labor <- scan('http://math.uttyler.edu/nathan/classes/statistics/data/hw2-labor.data') labor boxplot(labor) hist(labor) summary(labor) # t.test confidence interval the hard way # method 1 -- not quite correct mean(labor) - 1.96*sd(labor)/sqrt(length(labor)) mean(labor) + 1.96*sd(labor)/sqrt(19) # method 2 -- correct mean(labor) - qt(.975,df=18)*sd(labor)/sqrt(length(labor)) mean(labor) + qt(.975,df=18)*sd(labor)/sqrt(19) #### note qt(.975,df=18) is the analogue of 1.96 for the appropriate #### t distribution # confidence interval the easy way: t.test(labor) ##################################################### ##################################################### ##################################################### ### Problem Three labor.1 <- read.table('http://math.uttyler.edu/nathan/classes/statistics/data/hw2-labor1.data',header=TRUE) names(labor.1) increase <- labor.1$X1972-labor.1$X1968 t.test(increase) # One Sample t-test # #data: increase #t = 2.4577, df = 18, p-value = 0.02435 #alternative hypothesis: true mean is not equal to 0 #95 percent confidence interval: # 0.004889895 0.062478527 #sample estimates: # mean of x #0.03368421 # an increase of between .48% and 6.2% in female labor force # participation is suggested by this data set (with 95% confidence) t.test(increase,conf.level=.9)$conf.int #[1] 0.009917895 0.057450526 # with 95% confidence we have an increase in female labor force # participation of at least .99%