b. Confidence Interval
Math 115
The hypothesis test answers “Is there a difference?”
But we also want to know “How big is the difference?”
Solution: a confidence interval for \mu_1 - \mu_2 using the t-distribution.
Same machinery as 12a — same conditions, same s_p, same SE = s_p\sqrt{1/n_1 + 1/n_2}, same df = n_1 + n_2 - 2. New piece: a t critical value t^* replaces the test statistic.
Do infants born to smokers have different mean birth weights than nonsmokers? Random sample of 981 U.S. births from 2014.
Hypotheses (two-sided), with \mu_n, \mu_s = mean birth weight for nonsmokers / smokers:
H_0: \mu_n - \mu_s = 0 vs H_A: \mu_n - \mu_s \neq 0
The data:
| Group | n | \bar{x} (lbs) | s (lbs) |
|---|---|---|---|
| Nonsmoker | 867 | 7.27 | 1.23 |
| Smoker | 114 | 6.68 | 1.6 |
From 12a: T \approx 4.65, p-value < 0.0001 → rejected H_0. The population means differ. Today: by how much?
When conditions are met:
\text{CI} = (\bar{x}_1 - \bar{x}_2) \pm t^*_{df} \times SE
Confidence level → multiplier. 90% → narrower CI · 95% → standard · 99% → wider CI. For large df, t^* approaches the familiar z^* values (1.645 / 1.96 / 2.576).
Same three conditions as the hypothesis test in 12a:
All conditions met. No new check; we can build the interval.
Samples (from 12a): n_n = 867, s_n = 1.23; n_s = 114, s_s = 1.6; \bar{x}_n - \bar{x}_s \approx 0.59 lbs.
The CI uses the same s_p and SE as the 12a test — worth rebuilding once in the CI setting.
Pooled SD
s_p = \sqrt{\frac{(867 - 1)(1.23)^2 + (114 - 1)(1.6)^2}{867 + 114 - 2}} \approx 1.28
Standard error
SE = 1.28 \times \sqrt{\frac{1}{867} + \frac{1}{114}} \approx 0.128 \text{ lbs}
(Degrees of freedom: df = n_n + n_s - 2 = 979.)
From the previous slide: \bar{x}_n - \bar{x}_s \approx 0.59 lbs, SE \approx 0.128 lbs, df = 979.
t critical value: t^*_{979} \approx 1.962 (95% confidence; very close to z^* = 1.96 since df is large).
Margin of error: ME = t^* \times SE \approx 1.962 \times 0.128 \approx 0.25 lbs.
95% CI: (\bar{x}_n - \bar{x}_s) \pm ME = 0.59 \pm 0.25 \approx (0.34, 0.84) lbs.
95% CI: (0.34, 0.84) pounds.
Interpretation: We are 95% confident that the true mean birth weight for U.S. babies born to nonsmokers is between 0.34 and 0.84 pounds higher than for U.S. babies born to smokers.
Does the CI include 0? No — zero sits well below the entire interval.
This agrees with the hypothesis test in 12a: rejected H_0 ↔︎ zero is outside the CI.
Scope: random sample of 2014 U.S. births → the interval generalizes to all 2014 U.S. births. Observational → the gap isn’t necessarily caused by smoking (prenatal care, nutrition, age may contribute).
By how much do stock-photo and no-stock auctions differ in mean price? Same Mario Kart data as 12a.
| Photo | n | \bar{x} ($) | s ($) |
|---|---|---|---|
| Stock (yes) | 105 | 48.50 | 9.47 |
| No stock (no) | 36 | 44.33 | 7.25 |
Recall (from 12a): observed difference \bar{x}_y - \bar{x}_n = \$4.17; df = 139; hypothesis test gave T \approx 2.41, p-value \approx 0.017 → rejected H_0.
Recall: stock: n_y = 105, s_y = 9.47; no stock: n_n = 36, s_n = 7.25; df = n_y + n_n - 2 = 139.
The CI uses the same s_p and SE as the 12a test — rebuild them:
Compute the pooled SD s_p. s_p = \sqrt{\dfrac{(105-1)\,9.47^2 + (36-1)\,7.25^2}{139}} \approx 8.96
Compute the standard error SE. SE = s_p\sqrt{\tfrac{1}{n_y} + \tfrac{1}{n_n}} = 8.96\sqrt{\tfrac{1}{105} + \tfrac{1}{36}} \approx 1.73
Recall: \bar{x}_y - \bar{x}_n = \$4.17, SE \approx 1.73, df = 139. Use t^*_{139} \approx 1.977 for 95% confidence.
Compute the margin of error and 95% CI for \mu_y - \mu_n. ME = 1.977 \times 1.73 \approx 3.42; 95% CI = 4.17 \pm 3.42 \approx (0.75, 7.59) dollars.
Interpret the interval and check consistency with the 12a hypothesis test. We’re 95% confident the true mean price for stock-photo auctions is between about $0.75 and $7.59 higher than for no-stock auctions. The CI excludes 0 — consistent with rejecting H_0 in 12a. The interval is fairly wide (more than $6 wide) and the lower bound is close to zero, so the practical size of the gap is somewhat uncertain.
State the scope of inference. Scope: these are eBay Mario Kart Wii auctions from one specific window — not a random sample of any wider population — so the interval is most defensible for similar listings. Observational (sellers chose how to photograph), so we can’t claim the stock photo causes higher prices.
H-tests — larger |T| → smaller p-value
T = \dfrac{\bar{x}_1 - \bar{x}_2}{SE}
CIs — narrower = more precise
(\bar{x}_1 - \bar{x}_2) \pm t^* \times SE
Birth Weights recap: n_n = 867, n_s = 114, \bar{x}_n - \bar{x}_s \approx 0.59, s_n \approx 1.23, s_s \approx 1.6 → T \approx 4.65, p-value < 0.0001.
For each variant (others held constant), does the evidence become stronger or weaker?
The smoker sample had been 400 mothers instead of 114 (same group means and SDs). Stronger. Larger n_s → smaller SE → larger |T|. The “bottleneck” group is the small one, so growing it helps the most.
The observed difference had been only 0.20 lbs instead of 0.59 (same ns, same SDs). Weaker. Smaller effect size |\bar{x}_n - \bar{x}_s| → smaller |T| directly.
Both group SDs had been twice as large (same ns, same observed difference). Weaker. Larger SDs → larger s_p → larger SE → smaller |T|.
Birth Weights recap: 95% CI = (0.34,\ 0.84) lbs — width about 0.5 lbs.
For each variant (others held constant), does the CI become narrower or wider?
The smoker sample had been 400 mothers instead of 114 (same group means and SDs). Narrower. Larger n_s → smaller SE and slightly smaller t^* → narrower CI.
They build a 99% CI instead of 95%. Wider. Higher confidence → larger t^* → wider CI. (More confidence costs precision.)
Both group SDs had been twice as large (same ns, same observed difference). Wider. Larger SDs → larger s_p → larger SE → wider CI.
| Two Proportions (topic 10) | Two Means (topic 12) | |
|---|---|---|
| Statistic | \hat{p}_1 - \hat{p}_2 | \bar{x}_1 - \bar{x}_2 |
| H-test SE | \sqrt{\hat{p}_{pool}(1-\hat{p}_{pool})(1/n_1 + 1/n_2)} | s_p \sqrt{1/n_1 + 1/n_2} |
| CI SE | \sqrt{\hat{p}_1(1-\hat{p}_1)/n_1 + \hat{p}_2(1-\hat{p}_2)/n_2} | s_p \sqrt{1/n_1 + 1/n_2} |
| Reference distribution | normal (z) | t (df = n_1 + n_2 - 2) |
| CI | (\hat{p}_1 - \hat{p}_2) \pm z^* \cdot SE | (\bar{x}_1 - \bar{x}_2) \pm t^* \cdot SE |
Same skeleton — only the statistic, SE, and reference distribution change.
We’ve now done inference for one proportion, two proportions, one mean, and two independent means — all with the same framework.
Next time: paired means — comparing two measurements on the same subjects (before/after, twin pairs, matched designs). The trick: reduce to one mean by taking the difference within each pair.