Setting Up a Test for a Difference in Means
How to choose the two-sample t-test, define μ₁ and μ₂ in context, write the hypotheses, and check the conditions for both samples.
To test whether two separate groups have different population means, assume they do not: \(H_0: \mu_1 - \mu_2 = 0\). The procedure is the two-sample t-test for a difference between two population means. It needs two independent random samples or a randomized experiment, the 10% condition for samples, and a sample data condition that applies to both groups.
1Which procedure, which parameters?
The appropriate test for the difference between two population means is a two-sample t-test. Define both parameters in context, naming the response variable and the populations (or treatments). Keep the same order of subtraction throughout.
Two fertilizers
Twenty seedlings were randomly assigned to fertilizer A or B, 10 each. The grower wants to know whether A produces taller seedlings after 4 weeks. State the parameters, hypotheses, and procedure.
- 1Parameters: \(\mu_A\), \(\mu_B\) = the true mean heights (cm) after 4 weeks of seedlings like these grown with fertilizer A and with fertilizer B.
- 2\(H_0: \mu_A - \mu_B = 0\). \(H_a: \mu_A - \mu_B \gt 0\), because the question asks whether A is taller.
- 3Two separate groups, \(\sigma\) unknown: two-sample t-test for a difference between two population means.
If each value in one group is linked to a value in the other (the same person twice, or twins), the samples are not independent. Use a one-sample t-test on the differences instead.
2Hypotheses
The null hypothesis says the means are equal: \(H_0: \mu_1 - \mu_2 = 0\), or \(H_0: \mu_1 = \mu_2\). The alternative is one-sided (\(\mu_1 \gt \mu_2\) or \(\mu_1 \lt \mu_2\)) or two-sided (\(\mu_1 \ne \mu_2\)), chosen from the question before the data are seen.
Commute times
Independent random samples of 40 students at School A (1,200 students) and 45 at School B (900 students) recorded commute times. Is there a difference in mean commute time? Set up the test.
- 1\(\mu_A\), \(\mu_B\) = the true mean commute times (minutes) of all students at School A and School B.
- 2\(H_0: \mu_A = \mu_B\). \(H_a: \mu_A \ne \mu_B\): no direction is given.
- 3Randomization: two independent random samples. 10% condition: 40 ≤ 120 and 45 ≤ 90. Sample data: both samples have at least 30.
\(H_0: \bar{x}_A = \bar{x}_B\) is wrong: the sample means are known and differ. Hypotheses are about the population means, \(\mu_A\) and \(\mu_B\).
3Conditions
| Condition | Check |
|---|---|
| Randomization | Two independent random samples, or a randomized experiment |
| 10% condition | \(n_1 \le 10\%N_1\) and \(n_2 \le 10\%N_2\) when sampling without replacement (not needed for an experiment) |
| Sample data | Both \(n_1 \ge 30\) and \(n_2 \ge 30\), or both populations approximately normal. If either sample is under 30, both samples’ data must be free from strong skewness and outliers |
Two fertilizers
Check the conditions for the fertilizer test. Heights (cm): A: 24.1, 26.3, 22.8, 25.5, 27.0, 23.9, 25.2, 26.8, 24.6, 25.8; B: 22.4, 23.9, 21.7, 24.8, 22.1, 23.0, 25.1, 21.9, 23.6, 22.5.
- 1Randomization: the fertilizers were randomly assigned. This is an experiment, so the 10% condition does not apply.
- 2Sample data: both samples have 10, fewer than 30, so graph both. Dotplots of A (22.8 to 27.0) and B (21.7 to 25.1) show no strong skewness or outliers.
Caffeine and typing speed
Twenty-four volunteers were randomly assigned to caffeine or a placebo, 12 each, and their typing speeds were recorded (Figure 3). Is a two-sample t-test appropriate?
- 1Randomization: random assignment, so this condition is met.
- 2Both samples are under 30, so both must be free from strong skewness and outliers.
- 3Placebo: Q1 = 53.5, Q3 = 59.5, IQR = 6, upper fence 68.5. The value 84 is an outlier.
When either sample is under 30, the condition covers both. A clean caffeine group does not make up for an outlier in the placebo group.
“Sample data condition: both samples have fewer than 30, but dotplots of the heights for fertilizer A and fertilizer B show no strong skewness or outliers, so a two-sample t-test is reasonable.”
Quick reference
| Step | What to write |
|---|---|
| Procedure | Two-sample t-test for a difference between two population means |
| Parameters | \(\mu_1\), \(\mu_2\): true mean [variable] for [population 1], [population 2] |
| Hypotheses | \(H_0: \mu_1 - \mu_2 = 0\); \(H_a: \mu_1 - \mu_2 \gt 0\), \(\lt 0\), or \(\ne 0\) |
| Conditions | Independent random samples or random assignment; 10% for each sample; sample data condition for both groups |