Hypothesis tests for the difference between two means

Hypothesis tests for the difference between two means

Spec 3.7–8 · Edexcel International A Level Further Maths: Revision notes

Studying this course? Keep your progress in one place.

Key facts

  • H0:μx=μyH_0:\mu_x=\mu_y against H1H_1 about the population means.
  • Xˉ−Yˉ∼N(μx−μy, σx2nx+σy2ny)\bar X-\bar Y\sim N\left(\mu_x-\mu_y,\ \frac{\sigma_x^2}{n_x}+\frac{\sigma_y^2}{n_y}\right): means subtract but variances add.
  • Under H0H_0: Z=Xˉ−Yˉσx2/nx+σy2/ny∼N(0,1)Z=\frac{\bar X-\bar Y}{\sqrt{\sigma_x^2/n_x+\sigma_y^2/n_y}}\sim N(0,1).
  • With unknown variances and large samples, use sx2s_x^2 and sy2s_y^2.

Comparing two means

Two independent samples test whether the population means differ.

Two independent random samples are taken, one from each population. XX has mean μx\mu_x, variance σx2\sigma_x^2, sample size nxn_x and sample mean Xˉ\bar X; similarly for YY. The statistic tested is the difference of the sample means, Xˉ−Yˉ\bar X-\bar Y.

The null hypothesis holds the equality, and the hypotheses concern population means, not sample means.

68101214160.10.20.30.40.5xyμxμyX̄ (mean μx)Ȳ (mean μy)
Illustrative: sampling distributions of two sample means. The test asks whether the gap between the population means is real or just chance.
  • H₀μx=μy\mu_x=\mu_y
  • H₁μx≠μy\mu_x\ne\mu_y, μx>μy\mu_x>\mu_y or μx<μy\mu_x<\mu_y

Which hypotheses are correct for comparing two population means?

The distribution of the difference

The means subtract but the variances add.

If X∼N(μx,σx2)X\sim N(\mu_x,\sigma_x^2) and Y∼N(μy,σy2)Y\sim N(\mu_y,\sigma_y^2) are independent, then Xˉ∼N(μx,σx2nx)\bar X\sim N\left(\mu_x,\frac{\sigma_x^2}{n_x}\right) and Yˉ∼N(μy,σy2ny)\bar Y\sim N\left(\mu_y,\frac{\sigma_y^2}{n_y}\right).

Variances add, because subtracting independent random variables does not remove any variability. The standard error of the difference is σx2nx+σy2ny\sqrt{\frac{\sigma_x^2}{n_x}+\frac{\sigma_y^2}{n_y}}.

−6−4−22468101214160.10.20.30.40.5xymean −2X̄ȲX̄ − Ȳ
Illustrative: X̄ ~ N(10, 1) and Ȳ ~ N(12, 1). X̄ − Ȳ ~ N(−2, 2): the means subtract, the variances add, so it is wider.
  • X̄ − Ȳ∼N(μx−μy, σx2nx+σy2ny)\sim N\left(\mu_x-\mu_y,\ \frac{\sigma_x^2}{n_x}+\frac{\sigma_y^2}{n_y}\right)

Worked example

σx=4\sigma_x=4, nx=20n_x=20, σy=5\sigma_y=5, ny=25n_y=25. Find the variance of Xˉ−Yˉ\bar X-\bar Y.

If Var⁡(Xˉ)=0.8\operatorname{Var}(\bar X)=0.8 and Var⁡(Yˉ)=1\operatorname{Var}(\bar Y)=1, then Var⁡(Xˉ−Yˉ)\operatorname{Var}(\bar X-\bar Y) is:

Carrying out the test

Under H0H_0 the statistic ZZ is N(0,1)N(0,1); compare it with the critical value.

Under H0H_0 (μx=μy\mu_x=\mu_y), the test statistic is Z=Xˉ−Yˉσx2nx+σy2ny∼N(0,1)Z=\frac{\bar X-\bar Y}{\sqrt{\frac{\sigma_x^2}{n_x}+\frac{\sigma_y^2}{n_y}}}\sim N(0,1).

Compare zz with the critical value: ±1.96\pm1.96 (two-tailed 5%5\%), ±1.645\pm1.645 (one-tailed 5%5\%), 2.3262.326 (one-tailed 1%1\%), ±2.576\pm2.576 (two-tailed 1%1\%).

−4−3−2−112340.10.20.30.4xyz = 1.48N(0, 1)
Fertiliser example: z=1.48z=1.48 lies below the one-tailed 5%5\% critical value 1.6451.645 (shaded).

Worked example

σA=2.1\sigma_A=2.1, σB=2.4\sigma_B=2.4, nA=30n_A=30, nB=40n_B=40, xˉA=14.6\bar x_A=14.6, xˉB=13.8\bar x_B=13.8. Test H0:μA=μBH_0:\mu_A=\mu_B against H1:μA>μBH_1:\mu_A>\mu_B at 5%5\%.

In the fertiliser test, z=1.48z=1.48 and the critical value is 1.6451.645. What is the conclusion?

Large samples, unknown variances

With both samples large, use the sample variances sx2s_x^2 and sy2s_y^2.

Use the unbiased estimates sx2s_x^2 and sy2s_y^2. If both samples are large, the Central Limit Theorem makes Xˉ\bar X and Yˉ\bar Y approximately Normal, and Z=(Xˉ−Yˉ)−(μx−μy)Sx2nx+Sy2ny≈N(0,1)Z=\frac{(\bar X-\bar Y)-(\mu_x-\mu_y)}{\sqrt{\frac{S_x^2}{n_x}+\frac{S_y^2}{n_y}}}\approx N(0,1).

Example: nP=60n_P=60, sP2=81s_P^2=81, nQ=50n_Q=50, sQ2=64s_Q^2=64, xˉP=42.5\bar x_P=42.5, xˉQ=39.8\bar x_Q=39.8. The variance is 2.632.63 and z=2.71.622=1.66<1.96z=\frac{2.7}{1.622}=1.66<1.96, so insufficient evidence of a difference at 5%5\%.

−4−3−2−112340.10.20.30.4xy1.96−1.96z = 1.66N(0, 1)
Two-tailed 5% test: reject H₀ if |z| > 1.96 (shaded tails). The example z = 1.66 is not in the critical region.
  • Large samplesz=xˉ−yˉsx2/nx+sy2/nyz=\dfrac{\bar x-\bar y}{\sqrt{s_x^2/n_x+s_y^2/n_y}}

Two large samples, variances unknown. What replaces σ2\sigma^2 in the standard error?

Conclusions and assumptions

Conclude in context at the stated level, and state the assumptions made.

Give the conclusion in context: "there is evidence that method AA gives a shorter mean time than method BB", or "there is insufficient evidence that the mean masses differ". Never claim H0H_0 is proved.

A test about means says nothing about every individual: some members of the population with the smaller mean may still exceed some with the larger mean. A result can be significant at 5%5\% but not at 1%1\%.

00.511.522.533.54z = 1.665% critical value 1.961% critical value 2.576

Small samples

  • Populations Normal
  • Variances known
  • Samples random and independent

Large samples

  • Central Limit Theorem used
  • Sample variances may replace σ²
  • Samples random and independent

z=−2.37z=-2.37 in a one-tailed (lower) test. The result is significant at:

Try an exam question

Machine XX fills tins with standard deviation 33 g, and machine YY with standard deviation 44 g. A random sample of 3636 tins from XX has mean 102.4102.4 g and a random sample of 6464 tins from YY has mean 101.1101.1 g. Test, at the 5%5\% level, whether the means of the two machines differ.

[5 marks]

That's the notes covered.

Carry on to the next subtopic.

Try a question

Under H0H_0, what is the variance of Xˉ−Yˉ\bar X-\bar Y?

1 mark, marked against the mark scheme

Revision notes