Most real questions compare two groups: a new drug against a placebo, one school against another, before against after. Two-sample methods combine the one-sample t procedures with the rule that variances of independent quantities add. But first you must decide whether the data are two independent samples or pairs.
🔑 Key idea
Independent samples: for means, $$SE = \sqrt{\dfrac{s_1^2}{n_1} + \dfrac{s_2^2}{n_2}}, \quad t = \dfrac{\bar{x}_1 - \bar{x}_2}{SE}$$ (df from software, or conservatively the smaller $n - 1$). For proportions, $$SE = \sqrt{\hat{p}_1(1 - \hat{p}_1)/n_1 + \hat{p}_2(1 - \hat{p}_2)/n_2}$$ for an interval; a test uses the pooled $\hat{p}$. Paired data (the same subjects twice, or matched pairs): take the differences and run a one-sample t procedure on them.
💡 Why it works
$\bar{x}_1$ and $\bar{x}_2$ come from independent samples, so the variance of their difference is the sum of their variances, $s_1^2/n_1 + s_2^2/n_2$. In paired data the two measurements on one person are strongly related: a strong reader scores high both before and after. Taking differences cancels that person-to-person variation, leaving only the change, so the standard error is much smaller. Treating paired data as independent throws that advantage away.
✏️ Worked example: Two independent groups
Group 1: $n_1 = 25$, $\bar{x}_1 = 78$, $s_1 = 10$. Group 2: $n_2 = 16$, $\bar{x}_2 = 70$, $s_2 = 12$. Find the standard error, t, and a 95% interval for $\mu_1 - \mu_2$ (conservative df $= 15$, $t^* = 2.131$).
Interval: $8 \pm 2.131 \times 3.61 \approx 8 \pm 7.68$, from about 0.32 to 15.68.
The interval is entirely above 0, consistent with a two-sided test rejecting "no difference" at the 0.05 level.
Answer: SE ≈ 3.61, t ≈ 2.22, interval (0.3, 15.7).
The two-sided p-value for t = 2.22 with 15 degrees of freedom: about 0.04 in the two shaded tails.
Reading scores for 8 students before and after a summer program.
Student
1
2
3
4
5
6
7
8
Before
62
70
55
81
74
68
59
77
After
66
73
57
85
75
72
64
78
Difference
4
3
2
4
1
4
5
1
✏️ Worked example: Paired data
Use the table to test whether scores rose. Compare with the (wrong) independent-samples analysis.
Differences: mean $\bar{d} = 3$, standard deviation $s_d \approx 1.51$.
Paired t: $SE = 1.51/\sqrt{8} \approx 0.53$, so $t = 3/0.53 \approx 5.61$ with 7 df: a p-value well below 0.01.
Treated as independent: the SDs of the before and after scores are about 9.1 and 8.7, so $SE \approx 4.45$ and $t \approx 0.67$: no evidence at all.
The students differ a lot from each other, but each one improved a little. Only the paired analysis sees that.
Answer: Paired: t ≈ 5.6, strong evidence; independent (wrong): t ≈ 0.7.
⚠️ Common mistake
Treating paired data as two independent samples. When each value in one group is linked to one value in the other (same person, twins, matched plots), analyze the differences. Check: could you draw a line from each "before" value to its own "after" value?
For two proportions, for example 60 of 200 against 45 of 200: $\hat{p}_1 = 0.30$, $\hat{p}_2 = 0.225$, and the pooled $\hat{p} = 105/400 = 0.2625$ gives $$SE = \sqrt{0.2625 \cdot 0.7375\,(1/200 + 1/200)} \approx 0.044$$ and $z \approx 1.70$ (two-sided p ≈ 0.09).
Practice
Pass with 3 right answers, the last 2 in a row. Each right answer earns 3 XP.