a. Hypothesis Test
Math 115
| Topic | Variables | Statistic | Example |
|---|---|---|---|
| 6 | One binary categorical | \hat{p} | Payday loans — fraction supporting regulation |
| 10 | Two binary categorical | \hat{p}_1 - \hat{p}_2 | CPR — survival rates by treatment |
| 11 | One numerical | \bar{x} | Cherry Blossom — mean finish time |
| 12 (today) | Numerical + binary categorical | \bar{x}_1 - \bar{x}_2 | Birth weights — by smoking habit |
| 13 | Numerical, paired | \bar{x}_d | Textbook prices — UCLA vs Amazon |
Same framework throughout — only the statistic changes row to row.
Do infants born to smokers have different mean birth weights than those born to nonsmokers? Random sample of 981 U.S. births from 2014.
Hypotheses (two-sided). Let \mu_n, \mu_s = mean birth weight for all U.S. babies born to nonsmoking / smoking mothers.
| Group | n | \bar{x} (lbs) | s (lbs) |
|---|---|---|---|
| Nonsmoker | 867 | 7.27 | 1.23 |
| Smoker | 114 | 6.68 | 1.6 |
Observed difference: \bar{x}_n - \bar{x}_s = 7.27 - 6.68 \approx 0.59 lbs. Babies born to nonsmokers weigh a little over half a pound more on average. Real shift, or sampling noise?
When conditions are met, the sampling distribution of \bar{x}_1 - \bar{x}_2 is approximately normal with:
Another CLT result. Just like \bar{x} in topic 11 and \hat{p}_1 - \hat{p}_2 in topic 10, the difference of two sample means becomes approximately normal under independence + adequate sample sizes.
Same catch as topic 11: we don’t know the population SDs \sigma_1, \sigma_2. We estimate from the sample SDs s_1, s_2 — then use a t-distribution to account for the extra uncertainty.
When the two groups have similar SDs, treat them as sharing a common population SD. Estimate it by pooling the two sample SDs:
s_p = \sqrt{\frac{(n_1 - 1) s_1^2 + (n_2 - 1) s_2^2}{n_1 + n_2 - 2}}
Then the standard error for the difference is:
SE = s_p \sqrt{\frac{1}{n_1} + \frac{1}{n_2}}
And use a t-distribution with df = n_1 + n_2 - 2.
“Pooled” parallel. Same idea as the pooled \hat{p} in topic 10 — combine information from both groups to estimate a common population value.
Three conditions for inference about \mu_1 - \mu_2 from two independent samples:
| Condition | Rule |
|---|---|
| Independence | Observations independent within and across groups — typically from random samples (each n < 10\% of population) or random assignment, otherwise justified from study context |
| Normality | Each group: n \geq 30 → sample data may show mild skew, but no extreme outliers. If n < 30, group data should look roughly normal. |
| Equal variance | Group SDs similar (within a factor of \approx 2) — used for the pooled SE |
Try it: do all three conditions hold for the Birth Weights sample?
Independence: random sample of 2014 U.S. births (well under 10% of all 2014 U.S. births) ✓. Normality: n_n = 867, n_s = 114 — both well above 30, no extreme outliers in the histograms ✓. Equal variance: s_n \approx 1.23, s_s \approx 1.6 — within a factor of 2 ✓. All three met.
The T-statistic measures how far the observed difference is from the null value, in SE units:
T = \frac{(\bar{x}_1 - \bar{x}_2) - 0}{SE} = \frac{\bar{x}_1 - \bar{x}_2}{s_p \sqrt{1/n_1 + 1/n_2}}
Same formula structure as Z and the one-mean T — observed minus null over SE. Because we estimate \sigma_1, \sigma_2 from samples, the reference distribution is a t-distribution (with df = n_1 + n_2 - 2 here) — coming up next.
Under H_0, T = (\bar{x}_1 - \bar{x}_2)/SE follows a t-distribution with df = n_1 + n_2 - 2.
For Birth Weights, df = 979 — the t curve is essentially normal here.
For each scenario, identify the statistic of interest and the test statistic (Z or T).
A campus survey asks 600 students whether they have used a generative AI tool. Is the rate different from 50%? Statistic: \hat{p} (single proportion). Test statistic: Z — normal model (topic 6).
50 plots are randomly assigned to two fertilizer treatments. Do the mean yields differ? Statistic: \bar{x}_1 - \bar{x}_2 (difference of means). Test statistic: T — t-distribution with df = n_1 + n_2 - 2 (today).
A nutrition study measures sodium in 40 fast-food burgers. Is the mean sodium different from 1200 mg? Statistic: \bar{x} (single mean). Test statistic: T — t-distribution with df = n - 1 (topic 11).
Hypotheses (two-sided): H_0: \mu_n - \mu_s = 0 vs H_A: \mu_n - \mu_s \neq 0
Samples
Conditions met (random sample; both group sizes ≥ 30; similar SDs). Coming up: compute s_p → SE → T → p-value → conclude.
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}
Try it: plug into T = \dfrac{\bar{x}_n - \bar{x}_s}{SE}.
T = \dfrac{\bar{x}_n - \bar{x}_s}{SE} \approx 4.65 — observed difference sits about 4.6 SEs from zero.
Two-sided p-value = 2 × (smaller-tail area) ≈ < 0.0001 — the observed difference sits far out in the tail.
Results: T \approx 4.65 (df = 979), p-value < 0.0001 — well below 0.05 → reject H_0.
Conclusion: Convincing evidence that mean birth weight differs between U.S. babies born to nonsmoking vs. smoking mothers.
In plain terms: nonsmokers’ babies averaged about 0.59 pounds heavier in the sample; a gap this large is extremely unlikely if the population means were equal.
Scope: random sample of 2014 U.S. births → conclusion generalizes to all 2014 U.S. births. Observational data → cannot conclude that smoking causes lower birth weight (third-variable explanations like prenatal care, nutrition, alcohol use, age remain possible).
You’ve been collecting copies of Mario Kart for the Nintendo Wii and decide to sell them on eBay. Should you bother photographing each disc yourself, or just use a stock photo of the box? Does using a stock photo affect the selling price?
Data (Diez et al., OpenIntro):
| Photo | n | \bar{x} ($) | s ($) |
|---|---|---|---|
| Stock (yes) | 105 | 48.50 | 9.47 |
| No stock (no) | 36 | 44.33 | 7.25 |
State H_0 and H_A for \mu_y - \mu_n (two-sided). H_0: \mu_y - \mu_n = 0 H_A: \mu_y - \mu_n \neq 0.
What’s the observed difference? 48.50 - 44.33 = \$4.17 — stock-photo auctions averaged about four dollars more in the sample.
Take a moment with the shapes and spreads of each group — you’ll use what you see on the next slide.
Recall: stock (yes): n_y = 105, \bar{x}_y = 48.50, s_y = 9.47. No stock: n_n = 36, \bar{x}_n = 44.33, s_n = 7.25.
Recall: stock (yes): n_y = 105, \bar{x}_y = 48.50, s_y = 9.47. No stock: n_n = 36, \bar{x}_n = 44.33, s_n = 7.25. Observed diff \bar{x}_y - \bar{x}_n = \$4.17; conditions met.
Compute the degrees of freedom. df = n_y + n_n - 2 = 105 + 36 - 2 = 139
Compute the pooled SD s_p. s_p = \sqrt{\dfrac{104 \cdot 9.47^2 + 35 \cdot 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 \times \sqrt{\tfrac{1}{105} + \tfrac{1}{36}} \approx 1.73
Compute T. T = \dfrac{\bar{x}_y - \bar{x}_n}{SE} = \dfrac{4.17}{1.73} \approx 2.41
Recall: T \approx 2.41, df = 139. Observed diff \bar{x}_y - \bar{x}_n = \$4.17 (stock-photo higher); hypotheses two-sided.
We’ve tested “Are the two means different?” using the t-distribution with df = n_1 + n_2 - 2.
Next time: a confidence interval for \mu_1 - \mu_2 — “By how much do the two means differ?” — using the same machinery.