Chapter 3 The One-sample \(t\)-test: An example
Recall our proposed null and alternative hypotheses for the cholesterol example:
\[H_0:\mu = 5\;\;\text{versus}\;\;H_1:\mu \neq 5.\]
In order to determine whether or not we have enough evidence to reject the null hypothesis, we could use the one-sample \(t\)-test.
In more general terms, suppose we have a sample of \(n\) observations that have been independently sampled from a population with mean \(\mu\). Consider the hypotheses
\[H_0:\mu = \mu_0\;\;\text{versus}\;\;H_1:\mu \neq \mu_0,\]
where:
- \(\mu_0\) denotes the mean under the null hypothesis.
Then a commonly used statistical test for this type of hypothesis test is the one-sample \(t\)-test based on the data observed in the sample, provided either the sample was large or the underlying distribution of the population from which the sample was taken is normally distributed. Note: we will learn how to check these assumptions later on in this topic.
Your turn
In our cholesterol example above, what is the value of \(\mu_0\)?
5
Now back to our example. The data set called heartattack
from the R package called datarium
(Kassambara 2019) contains cholesterol measurements of 72 patients. Based on this data, the sample mean and standard deviation are:
- \(\bar{x} = 5.13\)
- \(s = 0.5\)
Do you think this sample mean of \(\bar{x} = 5.13\) is different enough from \(\mu_0 = 5\) to be able to reject \(H_0\) and conclude that we have evidence that \(\mu \neq 5\)?
The results of a one-sample \(t\)-test are provided below, along with some highlighted key details. These details will be further explained in the following sections.
One Sample t-test
data: heartattack$cholesterol
t = 2.2063, df = 71, p-value = 0.0306
alternative hypothesis: true mean is not equal to 5
95 percent confidence interval:
5.012405 5.245325
sample estimates:
mean of x
5.128865
We note the following:
- The test statistic is \(t = 2.2063\)
- The degrees of freedom is \(n - 1 = 72 - 1 = 71\)
- The \(p\)-value is \(p = 0.0306\). Since this \(p\)-value is less than 0.05, we can reject \(H_0\) and conclude that the average cholesterol for this population is different from 5 (explanations will follow shortly)
- The sample mean is \(\bar{x} = 5.13\)
- The 95% confidence interval is (5.01, 5.25). This means we are 95% confident that the true average cholesterol level for this particular population lies within the interval (5.01, 5.25).
We will now consider these concepts more thoroughly.