Spanish <- read.table('http://math.uttyler.edu/nathan/classes/statistics/data/spanish-test.data',header=TRUE) Spanish[1:5,] boxplot(Spanish) ### This is not correct! Why? t.test(Spanish) # One Sample t-test # #data: Spanish #t = 33.3688, df = 39, p-value < 2.2e-16 #alternative hypothesis: true mean is not equal to 0 #95 percent confidence interval: # 26.79592 30.25408 #sample estimates: #mean of x # 28.525 # ##### Here is what happened all.scores <- c(pre.test,post.test) t.test(all.scores) pre.test Spanish$pre.test attach(Spanish) pre.test t.test(post.test-pre.test) # One Sample t-test # #data: post.test - pre.test #t = 2.2848, df = 19, p-value = 0.03400 #alternative hypothesis: true mean is not equal to 0 #95 percent confidence interval: # 0.2056102 4.6943898 #sample estimates: #mean of x # 2.45 ## With 95% confidence the true increase on test scores is between .21 ## and 4.69 points. ## With a p-value of .034 we reject H0 in favor of H1 and conclude that ## there is a difference in pre-test and post-test scores t.test(post.test-pre.test,alternative = 'greater') detach() #### Number 2 Teks <-read.table('http://math.uttyler.edu/nathan/classes/statistics/data/teks-confidence.data',header=TRUE) hist(Teks$conf) attach(Teks) t.test(conf[ecert==1],conf[ecert==0],alternative='less') # Welch Two Sample t-test # #data: conf[ecert == 1] and conf[ecert == 0] #t = -2.6083, df = 39.922, p-value = 0.00637 #alternative hypothesis: true difference in means is less than 0 #95 percent confidence interval: # -Inf -0.493619 #sample estimates: #mean of x mean of y # 2.500000 3.892857 #