## examples of confidence intervals and tests in R ## ADM 10/23/2007 ## for anything involving the mean, we have to work with the raw data my.data <- c(1,2,3,4,5,6,5,4,3,2,1) ## here are confidence intervals for the population mean, first for 95% ## and then 99% t.test(my.data) t.test(my.data, conf.level=.99) ## to perform a hypothesis test, we again pass the data and also provide ## the population mean under the null hypothesis t.test(my.data, mu = 1) ## here is a confidence interval for a population proportion, we are ## passing the number of "successes" (or the number of 1s) first, and ## then the number of trials prop.test(543,1000) ## to conduct a hypothesis test, all we have to do additional is provide ## the population proportion under the null hypothesis. This is the ## roulette example from class prop.test(1890, 3800, p = 18/38)