Carrying Out a Test for a Difference in Means
How to compute the two-sample t statistic and p-value, interpret the p-value, and write a conclusion in context about the difference between two population means.
Assume the population means are equal. Measure how far the observed difference \(\bar{x}_1 - \bar{x}_2\) is from 0 in standard errors: that is the two-sample t statistic. The p-value is the area beyond it, in the direction of Hₐ, under a t-distribution whose degrees of freedom come from technology. A small p-value is convincing evidence that the means differ.
1The test statistic
When the null hypothesis is true, this statistic has a t-distribution. Technology finds its degrees of freedom, which fall between the smaller of \(n_1 - 1\) and \(n_2 - 1\) and \(n_1 + n_2 - 2\). Without technology, use the smaller \(n - 1\): it gives a slightly larger, more cautious p-value (0.0026 instead of 0.0009 for the fertilizer data).
2The p-value
The p-value comes from the t-distribution using a table or technology. It is the probability of a test statistic as extreme as or more extreme than the one observed, in the direction of Hₐ, assuming H₀ is true, that is, assuming the two population means are equal.
Two fertilizers
Interpret the p-value of 0.0009.
- 1Start from H₀ in context: the two fertilizers give the same mean height.
- 2Then the observed difference, the direction of Hₐ, and the group sizes.
“Assuming that the true mean heights after 4 weeks are the same for both fertilizers, there is a 0.0009 probability of getting a difference in sample means (A minus B) of 2.1 cm or more in groups of 10 and 10.”
0.0009 is computed assuming the means are equal. It describes how unusual the data would be under that assumption, not the probability that the assumption is true.
3The decision and the conclusion
Compare the p-value with α: if the p-value ≤ α, reject \(H_0: \mu_1 - \mu_2 = 0\); if the p-value \(\gt\) α, fail to reject it. State the conclusion in context, in terms of Hₐ, with non-definitive language, naming both populations or treatments.
Two fertilizers
Twenty seedlings were randomly assigned to fertilizer A or B, 10 each. After 4 weeks: \(\bar{x}_A = 25.2\) cm, \(s_A = 1.35\); \(\bar{x}_B = 23.1\) cm, \(s_B = 1.20\); dotplots of both groups show no strong skewness or outliers. Do the data give convincing evidence at \(\alpha = 0.05\) that A produces taller seedlings?
- 1State. \(H_0: \mu_A - \mu_B = 0\), \(H_a: \mu_A - \mu_B \gt 0\), where \(\mu_A\), \(\mu_B\) are the true mean heights after 4 weeks of seedlings like these with fertilizer A and B. \(\alpha = 0.05\).
- 2Plan. Two-sample t-test for a difference between two population means. Randomization: random assignment. Sample data: both groups are under 30, and neither shows strong skewness or outliers.
- 3Do. \(SE = \sqrt{1.35^2/10 + 1.20^2/10} \approx 0.573\). \(t = \dfrac{(25.2 - 23.1) - 0}{0.573} \approx 3.67\). Technology: df ≈ 17.8, p-value ≈ 0.0009.
- 4Conclude. Because the p-value of 0.0009 is less than \(\alpha = 0.05\), we reject \(H_0\). There is convincing evidence that fertilizer A produces a greater mean height after 4 weeks than fertilizer B for seedlings like these.
STAT, TESTS, 2-SampTTest. Enter the summary statistics (Inpt: Stats) or two data lists, choose μ1 > μ2, set Pooled: No, Calculate. Fertilizer data: t = 3.667, p = 0.0009, df = 17.76.
Pooling assumes the two populations have exactly equal standard deviations, which is rarely known. The unpooled two-sample t-test does not need that assumption; leave Pooled set to No.
4Two more tests
Commute times
Independent random samples of 40 students at School A and 45 at School B: \(\bar{x}_A = 24.6\), \(s_A = 8.4\); \(\bar{x}_B = 18.7\), \(s_B = 6.1\) minutes. Test \(H_0: \mu_A = \mu_B\) against \(H_a: \mu_A \ne \mu_B\) at \(\alpha = 0.05\).
- 1Conditions: independent random samples; 40 ≤ 120 and 45 ≤ 90; both samples have at least 30.
- 2\(SE \approx 1.610\), \(t = 5.9/1.610 \approx 3.67\), df ≈ 70.4.
- 3Two-sided: p-value \(= 2P(t \ge 3.67) \approx 0.0005\).
The commute data come from random samples, not random assignment. The test gives convincing evidence that the two schools’ mean commute times differ, and the result generalizes to all students at the two schools, but it says nothing about why.
Study app
Sixty-eight students were randomly assigned to use a study app (35) or not (33). Quiz scores: app \(\bar{x} = 78.4\), \(s = 9.2\); no app \(\bar{x} = 77.0\), \(s = 10.1\). Is there convincing evidence at \(\alpha = 0.05\) that the app raises the mean score?
- 1\(H_0: \mu_{\text{app}} - \mu_{\text{no}} = 0\), \(H_a: \mu_{\text{app}} - \mu_{\text{no}} \gt 0\). Random assignment; both groups have at least 30.
- 2\(SE = \sqrt{9.2^2/35 + 10.1^2/33} \approx 2.35\), \(t = 1.4/2.35 \approx 0.60\), df ≈ 64.5.
- 3p-value \(= P(t \ge 0.60) \approx 0.276\).
A p-value of 0.276 means a gap of 1.4 points is easy to get by chance. It does not show the app is useless; a modest benefit is still plausible. Write “there is not convincing evidence that the app increases the mean score.”
Quick reference
| Step | What to write |
|---|---|
| Test statistic | \(t = [(\bar{x}_1 - \bar{x}_2) - 0] / \sqrt{s_1^2/n_1 + s_2^2/n_2}\) |
| Degrees of freedom | Technology (between smaller \(n - 1\) and \(n_1 + n_2 - 2\)); conservative: smaller \(n - 1\) |
| p-value | t-distribution tail(s) in the direction of Hₐ |
| Interpretation | Assuming [equal means in context], there is a [p] probability of getting a difference in sample means of [value] or more in groups of [n₁] and [n₂]. |
| Conclusion | There is (not) convincing evidence that [Hₐ in context]. |
| Calculator | 2-SampTTest, Pooled: No |