4*7 # read this: # ex1 gets scan .... ex1 <- scan('http://math.uttyler.edu/nathan/classes/statistics/data/example1.data') ex1 mean(ex1) summary(ex1) sd(ex1) # Let's do a confidence interval the hard way mean(ex1) - 1.96*sd(ex1)/sqrt(30) #really should use t here but mean(ex1) + 1.96*sd(ex1)/sqrt(length(ex1)) #this should be close # Let's do a confidence interval the easy way t.test(ex1) # One Sample t-test # #data: ex1 #t = 10.3287, df = 29, p-value = 3.152e-11 #alternative hypothesis: true mean is not equal to 0 #95 percent confidence interval: # 7.77451 11.61362 #sample estimates: #mean of x # 9.694066 t.test(ex1,conf.level=.99) ex2 <- read.table('http://math.uttyler.edu/nathan/classes/statistics/data/example2.data',header=TRUE) summary(ex2) t.test(ex2) ex3 <- read.table('http://math.uttyler.edu/nathan/classes/statistics/data/example3.data',header=TRUE) ex3[1:5,] v1 # you get an error!!! ex3$v1 # the 'v1' column of ex3 t.test(ex3$v1) t.test(ex3$v1)$conf.int q