R Instructions: Hypothesis Testing for the Population Mean

To open R with the data set preloaded, right-click here and choose "Save Target As" to download the file to your computer. Then find the downloaded file and double-click it to open it in R.

The data have been loaded into the data frame drinks. Enter the command drinks to see the data. The variable in the data frame is drinks.per.week.

To use R to perform a t-test for the population mean using our data and the designated alternate hypotheses, enter the command:

R returns all the information you need to complete your t-test, including:

Note: Using R, the possible values for the alternative hypothesis are "less", "greater", and "two.sided", corresponding to the three types of alternative hypotheses in a t-test. If "two.sided" is the alternative, then the appropriate confidence interval is returned. If "less" or "greater" is the alternative, then the returned confidence interval is what is known as a one-sided confidence interval, which we have not discussed.