The Problem
Example #77: Let us test the null hypothesis that the mean height of a population is 19 cm. In symbols, this is:
H0 : μ = 19 cm
To test this hypothesis, we collect data. These data are the heights of a sample from this population. The sample values are:
4, 18, 17, 9, 22, 15, 11, 17, 6, 16, 33, 20, 25, 18, 18, 33, 16, 24, 21, 24, 18, 29, 21, 20
In addition to these data, we also know that the data are generated from a Normal process (they come from a Normally distributed population). With this information, calculate the test statistic corresponding to the null hypothesis.
Information given:
To summarize the above, the values of import are:
Summary statistics from the problem
\( \mu_0 \)
| = |
19 |
\( \bar{x} \)
| = |
18.9583 |
\( s \)
| = |
7.226035 |
\( n \)
| = |
24 |
Calculate these values yourself then hover your mouse over the grey spaces to see if you calculated them correctly.
Your Answer
You got the correct answer of t = -0.0282. Congratulations!
Unfortunately, your answer was not correct. Either try again or click on “Show Solution” below to see how to obtain the correct answer.
Assistance
Hide Solution
$$ \begin{align}
t &= \frac{ \bar{x} - \mu_0}{s}\ \sqrt{\phantom{I}n\phantom{^-}} \\[1em]
&= \frac{ 18.9583 - 19}{ 7.226035}\ \sqrt{\phantom{I}24\phantom{^-}} \\[1em]
&= \frac{ -0.0417}{ 7.226035}\ \times\ 4.899 \\
\end{align} $$
Thus, the t test statistic for these data and this hypothesis is -0.0282.
Hide the R Code
The following code makes use of R’s built-in t-test function. Copy and paste the following code into your R script window, then run it from there.
sample = c(4, 18, 17, 9, 22, 15, 11, 17, 6, 16, 33, 20, 25, 18, 18, 33, 16, 24, 21, 24, 18, 29, 21, 20)
t.test(sample, mu=19)
The test statistic follows “t =
” near the top of the output. Note that this function also calculates the number of degrees of freedom for you. It is the number following “df =
” near the top.
Hide the Excel Code
The z-procedures are sensitive to knowing the population variance. Logic dictates that if we do not know the population mean, then we will not know the population variance. As such, the z-procedures are rarely used now. As such, there is no z-test in the base Excel program.
Copy and paste the following code into your Excel spreadsheet window, making sure the value sample
ends up in A1
after pasting.
How to calculate the test statistic in Excel.
sample | | |
4 |
mu0: |
19 |
18 |
s: |
=STDEV.S(A:A) |
17 |
ts: |
=(AVERAGE(A:A)-C2)/C3*SQRT(COUNT(A:A)) |
9 |
|
|
22 |
|
|
15 |
|
|
11 |
|
|
17 |
|
|
6 |
|
|
16 |
|
|
33 |
|
|
20 |
|
|
25 |
|
|
18 |
|
|
18 |
|
|
33 |
|
|
16 |
|
|
24 |
|
|
21 |
|
|
24 |
|
|
18 |
|
|
29 |
|
|
21 |
|
|
20 |
|
|
The t test statistic is the number calculated in cell C4.
Again, when you paste this code into Excel, make sure that you start the pasting in cell A1. To help with that, you may want to also copy this notice. It seems to help.