The Problem
Example #463: Let us test whether the mean height of population 1 is 1 less than that of population 2. In symbols, this is:
H0 : μ1 − μ2 = -1
HA : μ1 − μ2 ≠ -1
To test this hypothesis, we collect data. The data from population 1 are:
40, 50, 48, 44, 56, 55, 50, 40, 31, 35, 48, 53, 40
The data from population 2 are:
30, 52, 31, 38, 35, 22, 45, 28, 21, 35, 33, 47, 50
In addition to these data, we also know one important thing: The data are generated from independent Normal processes; that is, the data in each sample come from independent Normal distributions. With this information, calculate the test statistic corresponding to the null hypothesis. Use the pooled variance.
Information given:
To summarize the above, the values of import are:
Summary statistics from the problem
\( \mu_d \)
| = |
-1 |
| | |
\( \bar{x}_1 \)
| = |
45.3846 |
\( \bar{x}_2 \)
| = |
35.9231 |
| | |
\( n_1 \)
| = |
13 |
\( n_2 \)
| = |
13 |
| | |
\( s_1 \)
| = |
7.7625 |
\( s_2 \)
| = |
10.061987 |
\( s_p \)
| = |
8.9861 |
| | |
\( t \)
| = |
2.9681 |
For assistance on calculating the pooled variance or the test statistic, see the tutorial for the Two-Sample T-Procedure Test Statistic. Calculate these values yourself then hover your mouse over the grey spaces to see if you calculated them correctly.
Assistance
Hide Solution
$$ \begin{align}
\text{p-value} &= 2 \times P[\ T \le -|t|\ ] \\[1em]
&= 2 \times P[\ T \le -|2.9681|\ ] \\[1em]
&= 2 \times P[\ T \le -(2.9681)\ ] \\[1em]
&= 2 \times P[\ T \le -2.9681\ ] \\[1em]
&= 2 \times 0.0033 \\[1em]
&= 0.0067 \\[1em]
\end{align} $$
Thus, the p-value for these data and this hypothesis is 0.0067. As this p-value is less than the usual α = 0.05, we reject the null hypothesis at that level. If the null hypothesis is true, what we observed is extremely uncommon. Because of this, we conclude that the difference in mean heights between the two populations is not -1 cm, but some other value.
To determine what values are reasonable for the difference in mean heights between the populations, one would need to calculate a confidence interval on that difference. This tutorial will help with that (opens as new page).
Hide the R Code
Copy and paste the following code into your R script window, then run it from there.
samp1 = c(40, 50, 48, 44, 56, 55, 50, 40, 31, 35, 48, 53, 40)
samp2 = c(30, 52, 31, 38, 35, 22, 45, 28, 21, 35, 33, 47, 50)
t.test(samp1, samp2, mu=-1, var.equal=TRUE)
In the R output, the p-value is the number that follows “p-value =
” near the top. Note that R will give you p-values that are more accurate and more precise than doing the calculations by hand. As such, these computer-calculated limits may differ slightly from those you calculate by hand.
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 sample1
ends up in A1
after pasting.
How to calculate the expected value in Excel.
sample1 | sample2 | sample2-mud | | |
40 |
30 |
29 |
p-value: |
=T.TEST(A:A,C:C,2,2) |
50 |
52 |
51 |
|
|
48 |
31 |
30 |
|
|
44 |
38 |
37 |
|
|
56 |
35 |
34 |
|
|
55 |
22 |
21 |
|
|
50 |
45 |
44 |
|
|
40 |
28 |
27 |
|
|
31 |
21 |
20 |
|
|
35 |
35 |
34 |
|
|
48 |
33 |
32 |
|
|
53 |
47 |
46 |
|
|
40 |
50 |
49 |
|
|
The test statistic is the number calculated in cell D6. The p-value is in cell D7. 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.