A-Level Further Maths 9231 / Topic 4.2 / AS & A Level
Two samples, one difference to test.
Is the new fertiliser better than the old one? Do two machines fill bags to the same mean mass? With two independent samples you test the difference of population means. Small samples from normal populations with a common variance call for a pooled variance and a 2-sample t-test; large samples, or known variances, call for a normal test.
Two independent samples, sizes \(n_x\) and \(n_y\). Small samples, both populations normal with a common variance: pool the variance, \(s_p^{2} = \dfrac{\sum (x - \bar x)^{2} + \sum (y - \bar y)^{2}}{n_x + n_y - 2}\), and use \(t = \dfrac{\bar x - \bar y - k}{\sqrt{s_p^{2}\left(\frac{1}{n_x} + \frac{1}{n_y}\right)}}\) with \(n_x + n_y - 2\) degrees of freedom. Large samples (or known variances): use \(z = \dfrac{\bar x - \bar y - k}{\sqrt{\frac{\sigma_x^{2}}{n_x} + \frac{\sigma_y^{2}}{n_y}}}\) with the normal distribution, replacing \(\sigma^{2}\) by \(s^{2}\) when it is unknown. Here \(k\) is the difference \(\mu_x - \mu_y\) stated in \(\mathrm{H}_0\), usually 0.
Fig. 1: choosing a test for a difference of two population means from two independent samples. Known variances with small samples need normal populations; large samples do not, thanks to the Central Limit Theorem
Section 01
Pooling two samples into one variance.
If two populations share the same variance \(\sigma^{2}\), each sample gives an estimate of it, and the best single estimate combines both. Add the two sums of squared deviations and divide by the total degrees of freedom, \((n_x - 1) + (n_y - 1) = n_x + n_y - 2\). Each sample loses one degree of freedom because its own mean was estimated.
The pooled estimate of the common population variance, in three equivalent forms:
Here \(s_x^{2}\) and \(s_y^{2}\) are the unbiased estimates from each sample (divisor \(n - 1\)). The pooled value always lies between \(s_x^{2}\) and \(s_y^{2}\), closer to the one from the larger sample.
Worked example From raw data
Two independent samples are taken from populations with a common variance. Sample \(X\): 12, 15, 11, 14, 13. Sample \(Y\): 10, 13, 9, 12. Find the pooled estimate of the common variance.
\(\bar x = \dfrac{65}{5} = 13\), \(\bar y = \dfrac{44}{4} = 11\).
For sample \(X\): \(n_x = 10\), \(\sum x = 152\), \(\sum x^{2} = 2350\). For sample \(Y\): \(n_y = 12\), \(\sum y = 168\), \(\sum y^{2} = 2412\). Find the pooled estimate of the common population variance.
A sample of 9 has unbiased variance estimate \(s_x^{2} = 3.2\) and an independent sample of 7 has \(s_y^{2} = 4.5\). Find the pooled estimate of the common variance.
Do not average the two variances, and do not divide by \(n_x + n_y\) or \(n_x + n_y - 1\). Weight each \(s^{2}\) by its own \(n - 1\), and divide by \(n_x + n_y - 2\). If you are given standard deviations, square them first.
Section 02
The 2-sample t-test.
When both samples are small and the population variances are unknown, use the \(t\)-distribution. The test is valid when the two samples are independent random samples, both populations are normally distributed, and they have a common variance (which is why you may pool). Define \(\mu_x\) and \(\mu_y\) in words, then follow the usual structure.
\(\mathrm{H}_0: \mu_x - \mu_y = k\) (often \(k = 0\), that is \(\mu_x = \mu_y\)).
\(\mathrm{H}_1: \mu_x - \mu_y > k\), \(< k\) (one-tailed) or \(\ne k\) (two-tailed), read from the wording.
Critical value from the \(t\) table with \(\nu = n_x + n_y - 2\).
Worked example One-tailed test, not significant
Tomato plants grown with a new feed (\(X\)) and the standard feed (\(Y\)) give heights in cm: \(n_x = 8\), \(\bar x = 24.6\), \(s_x^{2} = 4.2\); \(n_y = 10\), \(\bar y = 22.9\), \(s_y^{2} = 5.0\). Assuming normal populations with a common variance, test at the 5% level whether the new feed gives a greater mean height.
\(\mathrm{H}_0: \mu_x = \mu_y\), \(\mathrm{H}_1: \mu_x > \mu_y\), where \(\mu_x\), \(\mu_y\) are the population mean heights with the new and standard feeds.
\(1.662 < 1.746\), so do not reject \(\mathrm{H}_0\).
Answer: There is insufficient evidence at the 5% level that the new feed gives a greater mean height.
Worked example Testing a difference other than zero
A training firm claims its new method cuts the mean time for a task by more than 2 minutes. Times in minutes, old method (\(X\)): 18.2, 20.1, 19.4, 21.0, 17.9, 19.8. New method (\(Y\)): 16.0, 15.2, 17.1, 14.8, 16.5, 16.2, 16.2. Assuming normal populations with a common variance, test the claim at the 5% level.
\(\mathrm{H}_0: \mu_x - \mu_y = 2\), \(\mathrm{H}_1: \mu_x - \mu_y > 2\), where \(\mu_x\), \(\mu_y\) are the population mean times for the old and new methods.
\(\nu = 11\); one-tailed 5% critical value \(t_{11} = 1.796\). \(2.573 > 1.796\), so reject \(\mathrm{H}_0\).
Answer: There is sufficient evidence at the 5% level that the new method reduces the mean time by more than 2 minutes.
Examiner trap
Subtract \(k\) in the numerator: testing 'more than 2 minutes' with \(\bar x - \bar y = 3.4\) on top would wildly overstate the evidence. And the degrees of freedom are \(n_x + n_y - 2\), not \(n_x + n_y - 1\) or \(n - 1\) for one sample.
Stage 1 · Learn
Check your understanding
Four quick checks. Each correct answer earns XP and records this skill on your profile.
Quick check+10 XP
A 2-sample \(t\)-test uses independent samples of sizes 9 and 7. How many degrees of freedom does the test statistic have?
Quick check+10 XP
Two samples of sizes 8 and 6 have \(\sum (x - \bar x)^{2} = 30\) and \(\sum (y - \bar y)^{2} = 26\). Find the pooled estimate of the common variance.
Quick check+10 XP
Independent samples of 80 and 120 are used to test whether two population means differ, with the variances unknown. Which of these is NOT required?
Quick check+10 XP
For large samples, which statistic tests \(\mathrm{H}_0: \mu_x - \mu_y = k\)?
Section 03
Large samples: the normal test.
If the population variances are known, \(\bar X - \bar Y \sim \mathrm{N}\!\left(\mu_x - \mu_y,\ \frac{\sigma_x^{2}}{n_x} + \frac{\sigma_y^{2}}{n_y}\right)\) exactly for normal populations. If both samples are large, the Central Limit Theorem makes \(\bar X - \bar Y\) approximately normal whatever the populations, and \(s_x^{2}\), \(s_y^{2}\) are close enough to the true variances to replace them. No common variance is needed, so do not pool.
\[z = \frac{(\bar x - \bar y) - k}{\sqrt{\dfrac{s_x^{2}}{n_x} + \dfrac{s_y^{2}}{n_y}}}\ \text{compared with } \mathrm{N}(0, 1)\]
Situation
Test
variances known, populations normal
normal test with \(\sigma_x^{2}\), \(\sigma_y^{2}\)
variances unknown, both samples large
normal test with \(s_x^{2}\), \(s_y^{2}\) (Central Limit Theorem)
variances unknown, samples small
2-sample \(t\)-test, pooled \(s_p^{2}\), normal populations with common variance
Worked example Large samples, two-tailed
Test scores at two schools: school \(A\), \(n_x = 50\), \(\bar x = 63.2\), \(s_x^{2} = 40.5\); school \(B\), \(n_y = 60\), \(\bar y = 60.1\), \(s_y^{2} = 52.0\). Test at the 5% level whether the population mean scores differ.
\(\mathrm{H}_0: \mu_A = \mu_B\), \(\mathrm{H}_1: \mu_A \ne \mu_B\), where \(\mu_A\), \(\mu_B\) are the population mean scores.
The samples are large, so by the Central Limit Theorem use a normal test with the sample variances.
Answer: There is sufficient evidence at the 5% level that the mean scores at the two schools differ.
Worked example Known variances and a difference k
Bolt lengths from machine \(P\) are normal with standard deviation 1.5 mm, and from machine \(Q\) normal with standard deviation 2.0 mm. Samples of 6 from \(P\) and 8 from \(Q\) give means 14.9 mm and 11.3 mm. Test at the 5% level whether the mean length from \(P\) exceeds that from \(Q\) by more than 2 mm.
\(\mathrm{H}_0: \mu_P - \mu_Q = 2\), \(\mathrm{H}_1: \mu_P - \mu_Q > 2\), where \(\mu_P\), \(\mu_Q\) are the population mean lengths.
Variances known and populations normal, so the normal test is exact even for these small samples.
One-tailed 5% critical value 1.645. \(1.710 > 1.645\), so reject \(\mathrm{H}_0\).
Answer: There is sufficient evidence at the 5% level that the mean from \(P\) exceeds the mean from \(Q\) by more than 2 mm.
Your turn
Samples of 40 and 50 give \(\bar x - \bar y = 5.8\), \(s_x^{2} = 12\), \(s_y^{2} = 15\). Find the test statistic for \(\mathrm{H}_0: \mu_x - \mu_y = 4\) and state the conclusion against \(\mathrm{H}_1: \mu_x - \mu_y > 4\) at the 1% level.
\(z = \dfrac{1.8}{\sqrt{0.3 + 0.3}} = 2.324\). The 1% one-tailed critical value is 2.326, so \(2.324 < 2.326\): do not reject \(\mathrm{H}_0\) (only just). There is insufficient evidence at the 1% level that the difference exceeds 4.
Examiner trap
A normal test with \(s^{2}\) in place of \(\sigma^{2}\) needs LARGE samples. With samples of 6 and 8 and unknown variances you must use the 2-sample \(t\)-test, and then you must state the normal and common-variance assumptions.
Stage 2 · Exam
Exam-style questions
Unlocks once the four checks above are done. Worth more XP, written to AS & A Level Further Mathematics Paper 1 to 4 standard.
Finish the four checks above to unlock the exam questions
Exam style+20 XP
Independent samples from normal populations with a common variance give \(n_x = 10\), \(\bar x = 52.4\), \(s_x^{2} = 6.5\) and \(n_y = 12\), \(\bar y = 50.1\), \(s_y^{2} = 8.1\). Find the value of the 2-sample \(t\) statistic for testing \(\mathrm{H}_0: \mu_x = \mu_y\).
Exam style+20 XP
A 2-sample \(t\)-test with samples of sizes 6 and 8 is carried out at the 5% level with \(\mathrm{H}_1: \mu_x \ne \mu_y\). What is the critical value?
Exam style+20 XP
Samples of 8 and 10 are taken from two normal populations whose variances are unknown but believed equal. Which test should be used for the difference of the means?
Exam style+20 XP
Large independent samples of 40 and 50 give \(\bar x = 30.8\), \(\bar y = 25.0\), \(s_x^{2} = 12\), \(s_y^{2} = 15\). Find the test statistic for \(\mathrm{H}_0: \mu_x - \mu_y = 4\).
Skill unlocked
Two samples compared, one difference tested.
This skill is now recorded on your profile. Keep the chain going.