The main thing I was fuzzy on today was actually using R to do the hypothesis tests. When I took STAT 314, I had Dr. Shemyakin who encouraged us, but did not help us, to use R for our homework and labs. At that time I also had little to no experience using R on my own so I was not willing to venture into the R world without any help. Fast forward a year and a half and I now have ample experience with R through different classes I’ve taken and research I’ve done. The classes I took abroad were especially helpful in teaching me R. Now I feel a lot more comfortable in R, but I still lack the experience in using these basic tests. So now I will run through a quick example of how to do a t-test in R.
library(MASS)
t.test(anorexia$Prewt, mu=60, conf.level=.95)
##
## One Sample t-test
##
## data: anorexia$Prewt
## t = 36.689, df = 71, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 60
## 95 percent confidence interval:
## 81.19051 83.62615
## sample estimates:
## mean of x
## 82.40833
In this example, I am looking at the whether the mean pre-weight of a group of anorexic women is equal to or not equal to 60 pounds using an alpha of .05. Interpreting the output, we see that the test statistic is 36.689 with 71 degrees of freedom and a very small p-value, far smaller than .05. The 95% conficence interval is [81.19, 83.63] and the point estimate of the mean is 82.41. Looking at the point estimate for the mean, it is obvious why the p-value is so low. Given the p-value, I would reject the null hypothesis that the mean pre-weight of a group of anorexic women is 60 pounds.