5.3 Testing the difference when σ is known
We have a sampling distribution. What is the test?
The argument is the one from Section 4.4, with the new standard error in place of the old one. We reject when the observed difference is too large:
\[|\bar{x} - \bar{y}| \geq c\]
and we choose \(c\) so that, if the null were true, a gap that large would arise with probability only \(\alpha\).
Standardising the difference gives a quantity with no unknowns in it:
\[Z = \frac{(\bar{X} - \bar{Y}) - (\mu_x - \mu_y)}{\sqrt{\dfrac{\sigma_x^2}{n} + \dfrac{\sigma_y^2}{m}}} \;\sim\; N(0,1)\]
Under \(H_0\) the term \((\mu_x - \mu_y)\) is zero and drops out. Setting
\[P\big[\,|\bar{X} - \bar{Y}| \geq c\,\big] = \alpha\]
and dividing through by the standard error,
\[P\left[\,|Z| \geq \frac{c}{\sqrt{\sigma_x^2/n + \sigma_y^2/m}}\,\right] = \alpha\]
The two tails carry \(\alpha/2\) each, so the bracketed quantity is \(Z_{\alpha/2}\), giving
\[c = Z_{\alpha/2}\sqrt{\frac{\sigma_x^2}{n} + \frac{\sigma_y^2}{m}}\]
The test statistic and the interval for the difference are
\[Z_{calc} = \frac{\bar{x} - \bar{y}}{\sqrt{\dfrac{\sigma_x^2}{n} + \dfrac{\sigma_y^2}{m}}} \qquad\qquad (\bar{x} - \bar{y}) \pm Z_{\alpha/2}\sqrt{\frac{\sigma_x^2}{n} + \frac{\sigma_y^2}{m}}\]
Reject \(H_0\) when \(|Z_{calc}| > Z_{\alpha/2}\), which happens exactly when the interval excludes zero — the same equivalence as Section 4.6, now about a difference rather than a mean.
Conventional against high-yielding wheat
Twelve plots are sown with conventional seed and fourteen with a high-yielding variety. The conventional plots average 45.2 kg per hectare and the HYV plots 48.6 kg. From long agronomic experience the standard deviations are known: \(\sigma_x = 0.8\) for conventional and \(\sigma_y = 1.0\) for HYV.
Are these data consistent, at the 5% level, with the two varieties yielding the same on average?
xbar <- 45.2; sx <- 0.8; n <- 12 # conventional
ybar <- 48.6; sy <- 1.0; m <- 14 # high-yielding
se_diff <- sqrt(sx^2 / n + sy^2 / m)
z_calc <- (xbar - ybar) / se_diff
c(difference = xbar - ybar,
se = se_diff,
z_calc = z_calc,
p_value = 2 * pnorm(-abs(z_calc)))#> difference se
#> -3.3999999999999985789145285 0.3532165125838608865649348
#> z_calc p_value
#> -9.6258240452242969098506364 0.0000000000000000000006221
\(Z_{calc} = -9.63\), far beyond \(-1.96\), and the \(p\)-value is smaller than any conventional threshold. We reject the claim that the two varieties yield the same.
The interval says how much the varieties differ, which is the more useful statement:
#> [1] -4.092 -2.708
The HYV seed yields between 2.7 and 4.1 kg per hectare more than the conventional variety, with 95% confidence. Note that the interval lies entirely below zero and so excludes it — the same verdict the test reached.
Report the interval, not just the rejection. “The varieties differ significantly” is a much weaker statement than “the HYV variety yields 2.7 to 4.1 kg per hectare more,” and a farmer deciding what to sow needs the second.