b. Confidence Interval
Math 115
Still paired data: one within-pair difference d per unit, and we ask about \mu_d, the mean of those differences.
The 13a test answered “Is the mean paired difference zero?”
Now: “How big is the mean paired difference?” → a confidence interval for \mu_d.
Same paired machinery as 13a — work with the within-pair differences, then use the same SE = s_d / \sqrt{n} and df = n - 1. New piece: a t critical value t^* replaces the test statistic. Just like 11b’s one-mean CI, with the “mean” being the mean of the differences.
How do textbook prices compare between the UCLA bookstore and Amazon? Sample of 68 UCLA-course textbooks priced at both stores; d = UCLA − Amazon.
| n | \bar{x}_d ($) | s_d ($) |
|---|---|---|
| 68 | 3.58 | 13.42 |
From 13a: T \approx 2.2, p-value \approx 0.031 → rejected H_0 at \alpha = 0.05 (with a caution about skew + outliers). Today: how big is the typical price gap?
When conditions are met:
\text{CI} = \bar{x}_d \pm t^*_{df} \times \frac{s_d}{\sqrt{n}}
Identical to one-mean CI from 11b, with \bar{x} \to \bar{x}_d and s \to s_d. The “reduce to differences” trick gives back the full one-mean toolkit.
Same conditions as the hypothesis test in 13a — applied to the differences:
Same caution as 13a. With n = 68 the CLT provides cover for the sampling distribution of \bar{x}_d, but the borderline result invites careful interpretation.
From 13a: \bar{x}_d = 3.58 dollars, s_d = 13.42 dollars, n = 68, df = 67.
Standard error: SE = \dfrac{s_d}{\sqrt{n}} = \dfrac{13.42}{\sqrt{68}} \approx 1.63 dollars.
t critical value: t^*_{67} \approx 1.996 (95% confidence; very close to z^* = 1.96 since df is large).
Margin of error: ME = t^* \times SE \approx 1.996 \times 1.63 \approx 3.25 dollars.
95% CI: \bar{x}_d \pm ME = 3.58 \pm 3.25 \approx (0.33, 6.83) dollars.
95% CI: (\$0.33, \$6.83) per book.
Interpretation: We are 95% confident that, on average, a textbook costs between $0.33 and $6.83 more at the UCLA bookstore than on Amazon.
Does the CI include 0? No — zero sits just below the entire interval.
This agrees with the 13a hypothesis test: rejected H_0 ↔︎ zero is outside the CI. But the interval is wide — the data only pin the gap down to somewhere between about $0.30 and $7 per book.
Scope — generalization: not a documented random sample → the result covers only these books, not all UCLA Fall 2018 textbooks.
Scope — causation: not a randomized experiment → we can’t say the bookstore causes the higher price.
How much more sleep, on average, does Drug 2 produce than Drug 1? Same 10-patient study as 13a (Cushny & Peebles, 1905; used as Student’s 1908 t-test example).
Recall the variable: each drug’s value is that patient’s extra sleep vs. no drug; the paired difference d = (Drug 2 extra) − (Drug 1 extra) — a difference in extra hours of sleep.
Recall: n = 10, \bar{x}_d = 1.58 hours, s_d = 1.23 hours, df = 9.
From 13a: T \approx 4.06, p-value \approx 0.003 → rejected H_0.
Recall: \bar{x}_d = 1.58, s_d = 1.23, n = 10, df = 9. Use t^*_{9} \approx 2.262 for 95% confidence (df is small, so t^* is noticeably larger than 1.96).
Compute SE, then the margin of error and 95% CI for \mu_d. SE = \dfrac{s_d}{\sqrt{n}} = \dfrac{1.23}{\sqrt{10}} \approx 0.389; ME = 2.262 \times 0.389 \approx 0.88; 95% CI = 1.58 \pm 0.88 \approx (0.7, 2.46) hours.
Interpret and check consistency with the 13a hypothesis test. We’re 95% confident Drug 2 gives, on average, between about 0.7 and 2.46 hours more extra sleep than Drug 1 — roughly 40 minutes to 2.5 hours. The CI excludes 0, consistent with rejecting H_0 in 13a.
State the scope of inference. Scope: each patient is their own control (removes between-patient differences). But order wasn’t randomized (alternate nights) → order/carryover effects aren’t ruled out; and no random sample → strongest for patients like this group.
H-tests — larger |T| → smaller p-value
T = \dfrac{\bar{x}_d}{SE}
CIs — narrower = more precise
\bar{x}_d \pm t^* \times SE
Imagine analyzing the textbooks the wrong way — as two independent samples of 68 prices (ignore which book is which).
Books vary enormously: prices run from about $7 to $229 (SD ≈ $57). But the two stores track each other — a pricey book is pricey at both, a cheap book cheap at both.
Which analysis gives the smaller SE — and why?
Paired wins, by a lot. Subtracting within each book removes the $7–$229 book-to-book variation, leaving only the $13 spread in the differences: paired SE \approx \$1.63 vs. \approx \$9.52 if treated as independent — about 6× larger. Ignoring the pairing would bury the real $3.58 gap in noise.
Textbooks recap: n = 68 pairs, \bar{x}_d \approx 3.58, s_d \approx 13.42 → T \approx 2.2, p-value \approx 0.031.
For each variant (others held constant), does the evidence become stronger or weaker?
The researchers had sampled 272 textbooks instead of 68 (same \bar{x}_d, same s_d). Stronger. Quadrupling n halves SE → |T| doubles. The original p-value of about 0.03 would drop well below 0.001.
The observed mean difference had been $7 per book instead of about $3.58 (same n, same s_d). Stronger. Larger |\bar{x}_d| → larger |T| directly.
The differences had been more variable: s_d \approx \$25 instead of \$13.42 (same n, same \bar{x}_d). Weaker. Larger s_d → larger SE → smaller |T|. Pairing controls for between-subject variability, but the random scatter from book to book in the price difference itself still hurts.
Textbooks recap: 95% CI for \mu_d = (0.33,\ 6.83) dollars — width about $6.5.
For each variant (others held constant), does the CI become narrower or wider?
The researchers had sampled 272 textbooks instead of 68 (same \bar{x}_d, same s_d). Narrower. Larger n → smaller SE and slightly smaller t^* → narrower CI.
They build a 90% CI instead of 95%. Narrower. Lower confidence → smaller t^* → narrower CI. (Less confidence buys precision.)
The differences had been more variable: s_d \approx \$25 instead of \$13.42. Wider. Larger s_d → larger SE → wider CI.
Across the model-based topics (6, 10, 11, 12, 13), every inference question has the same shape:
| Question | Tool |
|---|---|
| Is there a difference / departure from null? | Test statistic = (observed − null) / SE; reference distribution (normal or t) |
| How big is the effect? | CI = statistic ± multiplier × SE |
Only two things change topic-to-topic:
Conditions, reference distribution, and decision rules follow the same pattern every time.
That completes our work on single and paired groups: one proportion, two proportions, one mean, two independent means, and paired means. (Means and proportions aren’t gone for good — they resurface in later topics.)
Next: contingency tables — testing for an association between two categorical variables with more than two levels each. New reference distribution: chi-squared.