###################################################################### # Lincoln wind speed - find CI for mu # # # ###################################################################### ###################################################################### #Read in data # May need to set folder location of file # This will not be needed if you open the program from the folder where the data is located # setwd(dir = "C:\\Chris\\data") #Set this to your own folder wind <- read.csv(file = "Lincoln_Feb_wind.csv") #wind #Shows whole data set - probably do not want to due to number of observations head(wind) #Shows first 6 observations tail(wind) #Shows last 6 observations ###################################################################### #Longer way ybar <- mean(wind$y) s <- sd(wind$y) alpha <- 0.05 n <- length(wind$y) #Interval lower <- ybar - qt(p = 1 - alpha/2, df = n-1) * s / sqrt(n) upper <- ybar + qt(p = 1 - alpha/2, df = n-1) * s / sqrt(n) data.frame(lower, upper) ###################################################################### #Shorter way #Ignore the hypothesis test part of output for now t.test(x = wind$y, conf.level = 0.95) save.results <- t.test(x = wind$y, conf.level = 0.95) save.results names(save.results) save.results$conf.int save.results$conf.int[1] save.results$conf.int[2] #