📚 Difference between Means of Two Independent Normal Distributions | 两个独立正态分布均值之差的推断
In A-Level Statistics, comparing two population means is a core skill. When we take independent random samples from two normal populations, the difference between the sample means is itself a normal random variable. This allows us to construct confidence intervals and carry out hypothesis tests for the difference between the two population means. The same machinery answers a very practical question: is machine A really faster than machine B, or is the observed gap just sampling noise?
在 A-Level 统计学中,比较两个总体的均值是一项核心技能。当我们从两个正态总体中独立抽取随机样本时,样本均值之差本身也是一个正态随机变量。这使得我们能够为两个总体均值之差构造置信区间并进行假设检验。同一套工具也回答了一个非常实际的问题:机器 A 是否真的比机器 B 更快,还是观察到的差距只是抽样波动?
This article rebuilds the whole topic from the assumptions upwards: the sampling distribution of X̄₁ − X̄₂, its standard error, confidence intervals, hypothesis tests in both one-tailed and two-tailed forms, the large-sample approximation when variances are unknown, the pooled-variance t-procedure, and the exam errors that cost the most marks.
本文从假设出发,自下而上重建整个主题:X̄₁ − X̄₂ 的抽样分布、其标准误、置信区间、单侧与双侧形式的假设检验、方差未知时的大样本近似、合并方差的 t 方法,以及最容易丢分的考试错误。
1. Key Assumptions and Notation | 关键假设与符号
We consider two independent normal populations with means μ₁ and μ₂ and variances σ₁² and σ₂². Independent random samples of sizes n₁ and n₂ are drawn from these populations. The sample means are denoted by X̄₁ and X̄₂, and their observed values by x̄₁ and x̄₂.
我们考虑两个独立的正态总体,均值分别为 μ₁ 和 μ₂,方差分别为 σ₁² 和 σ₂²。从这两个总体中分别抽取容量为 n₁ 和 n₂ 的独立随机样本。样本均值记为 X̄₁ 和 X̄₂,其观测值记为 x̄₁ 和 x̄₂。
The key assumptions are independence of the two samples, normality of both populations, and known population variances. When variances are unknown, large sample sizes allow us to replace them with sample variances.
关键假设包括两个样本相互独立、两个总体均服从正态分布,以及总体方差已知。当方差未知时,在大样本条件下可以用样本方差替代。
It is worth separating the three assumptions clearly, because an examiner will award a mark for naming them correctly. First, the two samples must be independent of one another - no pairing, no matching, and no measurement in one sample influencing a measurement in the other. Second, each population must be normal, which guarantees that X̄₁ and X̄₂ are exactly normal for any sample size. Third, in the standard A-Level version the population variances σ₁² and σ₂² are treated as known constants.
把三条假设清楚分开是值得的,因为考官会因为正确说出它们而给分。第一,两个样本必须相互独立——不存在配对、匹配,也不存在一个样本中的测量影响另一个样本中的测量。第二,每个总体都必须是正态分布,这保证了 X̄₁ 与 X̄₂ 对任意样本容量都严格服从正态分布。第三,在 A-Level 标准版本中,总体方差 σ₁² 与 σ₂² 被当作已知常数处理。
2. Distribution of the Difference in Sample Means | 样本均值之差的分布
Since X̄₁ and X̄₂ are normally distributed and independent, their difference X̄₁ − X̄₂ is also normally distributed. The expected value is μ₁ − μ₂, and the variance is the sum of the individual variances: σ₁²/n₁ + σ₂²/n₂.
由于 X̄₁ 和 X̄₂ 均服从正态分布且相互独立,它们的差 X̄₁ − X̄₂ 也服从正态分布。其期望为 μ₁ − μ₂,方差为各自方差之和:σ₁²/n₁ + σ₂²/n₂。
This result follows from the linearity of expectation and the independence assumption, which makes the covariance zero. Write the two facts separately before combining them.
这一结果源于期望的线性性质以及独立性假设,该假设使协方差为零。在合并之前,先把这两个事实分别写出来。
E(X̄₁ − X̄₂) = E(X̄₁) − E(X̄₂) = μ₁ − μ₂
Var(X̄₁ − X̄₂) = Var(X̄₁) + Var(X̄₂) = σ₁²/n₁ + σ₂²/n₂
ent random variables always add under both addition and subtraction, because the covariance term vanishes: Var(A − B) = Var(A) + Var(B) − 2Cov(A, B), and Cov(A, B) = 0 here.
尽管我们是在对均值做减法,方差却是相加的。这是本主题中最容易被记错的一行。独立随机变量的方差在加法和减法下都始终相加,因为协方差项消失了:Var(A − B) = Var(A) + Var(B) − 2Cov(A, B),而此处 Cov(A, B) = 0。
Putting the two pieces together with the normal shape gives the full sampling distribution:
把这两部分与正态形状结合起来,就得到了完整的抽样分布:
X̄₁ − X̄₂ ~ N(μ₁ − μ₂, σ₁²/n₁ + σ₂²/n₂)
3. Standard Error and Standardisation | 标准误与标准化
The standard deviation of X̄₁ − X̄₂ is the square root of that variance, and it is called the standard error of the difference in sample means.
X̄₁ − X̄₂ 的标准差就是该方差的平方根,称为样本均值之差的标准误。
SE(X̄₁ − X̄₂) = √σ₁²/n₁ + σ₂²/n₂
Standardising converts the difference into a standard normal variable, which is what every table of critical values is written for.
标准化把该差值转换为标准正态变量,而所有临界值表都是为标准正态变量编写的。
Z = ((X̄₁ − X̄₂) − (μ₁ − μ₂)) ÷ √σ₁²/n₁ + σ₂²/n₂ ~ N(0, 1)
Notice how the standard error behaves. Doubling both sample sizes divides the variance by two and the standard error by √2, so precision improves only with the square root of the sample size. Also note that a large σ₂²/n₂ can dominate the standard error: if one sample is much noisier or much smaller than the other, that term controls the width of your interval.
注意标准误的行为。把两个样本容量都翻倍,会使方差变为原来的一半,而标准误变为原来的 1/√2,所以精度的提高只与样本容量的平方根成正比。还要注意,较大的 σ₂²/n₂ 可能主导标准误:如果其中一个样本噪声大得多或小得多,那么区间宽度就由这一项控制。
₁ = 1.6 and σ₂²/n₂ = 2, so the variance of the difference is 3.6 and the standard error is √3 east three significant figures matters, because it is later multiplied by a critical value close to 2.
做一个简单的算术核对。若 σ₁² = 64、n₁ = 40、σ₂² = 100、n₂ = 50,则 σ₁²/n₁ = 1.6,σ₂²/n₂ = 2,因此差值的方差为 3.6,标准误为 √3.6 ≈ 1.897。把这个数保留至少三位有效数字很重要,因为它之后会乘以接近 2 的临界值。
4. Confidence Interval for μ₁ − μ₂ | μ₁ − μ₂ 的置信区间
Because the sampling distribution is normal with a known standard error, a 100(1 − α)% confidence interval for μ₁ − μ₂ follows the usual point estimate plus or minus critical value times standard error pattern.
由于抽样分布是正态的且标准误已知,μ₁ − μ₂ 的 100(1 − α)% 置信区间遵循通常的“点估计 ± 临界值 × 标准误”模式。
(x̄₁ − x̄₂) ± z × √σ₁²/n₁ + σ₂²/n₂
Here z is the appropriate standard normal critical value, chosen so that the central area is 1 − α.
其中 z 是适当的标准正态临界值,其选取使得中间面积为 1 − α。
| Confidence level | 置信水平 | α | Two-tailed z | 双侧 z | One-tailed z | 单侧 z |
| 90% | 0.10 | 1.645 | 1.282 |
| 95% | 0.05 | 1.960 | 1.645 |
| 99% | 0.01 | 2.576 | 2.326 |
The interpretation is about the method, not about a single realised interval: if we repeated the whole sampling procedure many times and rebuilt the interval each time, 95% of those intervals would contain the true value of μ₁ − μ₂. An interval that contains zero is consistent with there being no difference between the two population means at that confidence level.
解释针对的是方法,而不是某一个已实现的区间:如果我们多次重复整个抽样过程并每次重建区间,那么其中 95% 的区间会包含 μ₁ − μ₂ 的真实值。若区间包含零,则说明在该置信水平下,两个总体均值之间没有差异这一结论是相容的。
5. Worked Example: a 95% Confidence Interval | 例题:95% 置信区间
wn from long production records. A random sample of n₁ = 40 bottles from machine 1 gives x̄₁ = 52.4 ml, and an independent random sample of n₂ = 50 bottles from machine 2 gives x̄₂ = 48.1 ml. Find a 95% confidence interval for μ₁ − μ₂.
两台机器灌装瓶子。总体 1 的 σ₁ = 8 毫升,总体 2 的 σ₂ = 10 毫升,二者都由长期生产记录已知。从机器 1 随机抽取 n₁ = 40 瓶,得 x̄₁ = 52.4 毫升;从机器 2 独立随机抽取 n₂ = 50 瓶,得 x̄₂ = 48.1 毫升。求 μ₁ − μ₂ 的 95% 置信区间。
Step 1, the point estimate: x̄₁ − x̄₂ = 52.4 − 48.1 = 4.3 ml. Step 2, the standard error: √8²/40 + 10²/50 = √1.6 + 2.0 = √3.6 ≈ 1.897 ml. Step 3, the critical value for 95% is z = 1.960.
第一步,点估计:x̄₁ − x̄₂ = 52.4 − 48.1 = 4.3 毫升。第二步,标准误:√8²/40 + 10²/50 = √1.6 + 2.0 = √3.6 ≈ 1.897 毫升。第三步,95% 对应的临界值为 z = 1.960。
4.3 ± 1.960 × 1.897 = 4.3 ± 3.718
The interval is approximately (0.58, 8.02) ml. Since the whole interval lies above zero, we have evidence at the 95% level that machine 1 fills more on average than machine 2. Note that the interval is fairly wide: the sample sizes are only moderate and the standard error is almost 2 ml.
区间约为 (0.58, 8.02) 毫升。由于整个区间都在零以上,我们在 95% 水平上有证据表明机器 1 的平均灌装量高于机器 2。注意该区间相当宽:样本容量只是中等,而标准误接近 2 毫升。
To narrow the interval you have three levers: increase n₁ and n₂, reduce the variability of the filling process, or accept a lower confidence level. Only the first two improve precision without weakening the claim.
要缩小区间,你有三个杠杆:增大 n₁ 与 n₂、降低灌装过程的波动性,或接受更低的置信水平。只有前两者能在不削弱结论的前提下提高精度。
6. Hypothesis Testing Framework | 假设检验框架
The default null hypothesis is that the two population means are equal, so the difference is zero.
默认的原假设是两个总体均值相等,即差值为零。
H₀: μ₁ − μ₂ = 0 H₁: μ₁ − μ₂ ≠ 0 (two-tailed)
If the question asks whether one mean is larger, use a one-tailed alternative, for example H₁: μ₁ − μ₂ > 0. Note carefully that the null hypothesis is always about the population parameters μ₁ and μ₂, never about the sample means x̄₁ and x̄₂.
如果题目问的是某个均值是否更大,就使用单侧备择假设,例如 H₁: μ₁ − μ₂ > 0。请务必注意,原假设始终是关于总体参数 μ₁ 与 μ₂ 的,绝不是关于样本均值 x̄₁ 与 x̄₂ 的。
The test statistic measures how many standard errors the observed difference sits away from the hypothesised difference. Under H₀ the hypothesised difference is zero.
检验统计量衡量观察到的差值偏离假设差值多少个标准误。在 H₀ 下,假设差值为零。
z = (x̄₁ − x̄₂) ÷ √σ₁²/n₁ + σ₂²/n₂
For a two-tailed test at the 5% level, reject H₀ if |z| > 1.960. For a one-tailed test at the 5% level, reject H₀ if z > 1.645 (upper tail) or z < −1.645 (lower tail). Always finish with a conclusion written in the context of the original problem, not simply "reject H₀".
对于 5% 水平的双侧检验,若 |z| > 1.960 则拒绝 H₀。对于 5% 水平的单侧检验,若 z > 1.645(上尾)或 z < −1.645(下尾)则拒绝 H₀。结论一定要结合原始问题的语境来写,而不能只写“拒绝 H₀”。
7. Worked Example: a Two-Tailed Test | 例题:双侧检验
Using the bottle-filling data above, test at the 5% significance level whether the two machines differ in mean fill. Here n₁ = 40, x̄₁ = 52.4, σ₁ = 8, n₂ = 50, x̄₂ = 48.1, σ₂ = 10.
使用上面的灌装数据,在 5% 显著性水平下检验两台机器的平均灌装量是否存在差异。此处 n₁ = 40、x̄₁ = 52.4、σ₁ = 8、n₂ = 50、x̄₂ = 48.1、σ₂ = 10。
State the hypotheses: H₀: μ₁ − μ₂ = 0 against H₁: μ₁ − μ₂ ≠ 0. The standard error is again √64/40 + 100/50 = √3.6 ≈ 1.897.
写出假设:H₀: μ₁ − μ₂ = 0,对立假设 H₁: μ₁ − μ₂ ≠ 0。标准误仍为 √64/40 + 100/50 = √3.6 ≈ 1.897。
z = (52.4 − 48.1) ÷ 1.897 = 4.3 ÷ 1.897 ≈ 2.267
Compare with the critical value: 2.267 > 1.960, so we reject H₀ at the 5% ately 2 × 0.0117 = 0.023, which is below 0.05 and agrees with the critical-value decision.
与临界值比较:2.267 > 1.960,因此在 5% 水平下拒绝 H₀。对应的双侧 p 值约为 2 × 0.0117 = 0.023,小于 0.05,与临界值法的结论一致。
Written as an exam conclusion: there is sufficient evidence at the 5% at the mean fill volumes of the two machines are different. Note that this test and the 95% interval excluding zero is equivalent to rejecting H₀: μ₁ − μ₂ = 0 at the matching level.
写成考试结论:在 5% 显著性水平下,有充分证据表明两台机器的平均灌装量不同。注意本检验与第 5 节的 95% 置信区间给出的判断完全一致,这是必然的:区间不含零,等价于在相应水平下拒绝 H₀: μ₁ − μ₂ = 0。
8. One-Tailed versus Two-Tailed Tests | 单侧检验与双侧检验
The choice between one-tailed and two-tailed depends entirely on the wording of the question before you look at the data. "Is there a difference" gives a two-tailed test; "is A greater than B" or "has the mean increased" gives a one-tailed test.
单侧与双侧之间的选择完全取决于题目措辞,而且要在看数据之前就定下来。“是否存在差异”对应双侧检验;“A 是否大于 B”或“均值是否提高了”对应单侧检验。
With the same test statistic z ≈ 2.267, an upper-tailed test at the 5% n machine 2. The one-tailed p-value is about 0.0117, roughly half of the two-tailed value.
对于相同的检验统计量 z ≈ 2.267,5% 水平的上尾检验使用 1.645,因此我们同样拒绝 H₀,此时结论是机器 1 的平均灌装量大于机器 2。单侧 p 值约为 0.0117,大约是双侧 p 值的一半。
| Test type | 检验类型 | Criterion at 5% | 5% 下的判据 | Conclusion in context | 语境化结论 |
| Two-tailed | 双侧 | |z| > 1.960 | means differ | 均值不同 |
| Upper-tailed | 上尾 | z > 1.645 | μ₁ > μ₂ |
| Lower-tailed | 下尾 | z < −1.645 | μ₁ < μ₂ |
A caution worth stating explicitly: it is not acceptable to switch from two-tailed to one-tailed after seeing the sign of your test statistic in order to obtain a rejection. The alternative hypothesis must be fixed in advance by the research question.
有一条值得明确说明的告诫:在看到检验统计量的符号之后,为了得到“拒绝”的结论而从双侧改为单侧,是不被接受的。备择假设必须由研究问题事先确定。
9. Unknown Variances with Large Samples | 方差未知时的大样本处理
In practice the population variances are rarely known. If both sample sizes are large - a common working rule is at least 30 each - the sample variances s₁² and s₂² are close to σ₁² and σ₂², and the Central Limit Theorem also protects the normality assumption.
实践中总体方差很少是已知的。如果两个样本容量都很大——常用的经验规则是各自至少 30——样本方差 s₁² 与 s₂² 就接近 σ₁² 与 σ₂²,中心极限定理也会为“正态”这一假设提供保障。
We then replace the population variances by the sample variances and still use the standard normal critical values.
此时我们用样本方差替代总体方差,并且仍然使用标准正态临界值。
SE ≈ √s₁²/n₁ + s₂²/n₂ z = (x̄₁ − x̄₂) ÷ √s₁²/n₁ + s₂²/n₂
Note the exact wording examiners like: the sample variances are unbiased estimators of the population variances, and because the samples are large the extra uncertainty introduced by estimating σ₁² and σ₂² is small enough to ignore. If the populations are not normal but the samples are large, the normal approximation still works because the sample means are approximately normal by the Central Limit Theorem.
注意考官喜欢的确切表述:样本方差是总体方差的无偏估计量,且由于样本很大,估计 σ₁² 与 σ₂² 所引入的额外不确定性小到可以忽略。如果总体不是正态分布但样本很大,正态近似仍然成立,因为由中心极限定理,样本均值近似服从正态分布。
One further practical point: the degrees of freedom correction is only needed when samples are small and the variances are estimated. In the large-sample case the correction has negligible effect, and A-Level questions at this level expect the z-procedure.
还有一点实务上的说明:只有当样本较小且方差为估计值时,才需要自由度修正。在大样本情形下,该修正的影响可以忽略,而且这一层次的 A-Level 题目期待使用 z 方法。
10. Pooled Variance and the t-Procedure | 合并方差与 t 方法
believe σ₁² = σ₂², the two sample variances can be combined into a single pooled estimate.
当样本较小、方差未知,且有充分理由相信 σ₁² = σ₂² 时,可以把两个样本方差合并为一个单一的合并估计量。
sₚ² = ((n₁ − 1)s₁² + (n₂ − 1)s₂²) ÷ (n₁ + n₂ − 2)
t = (x̄₁ − x̄₂) ÷ √sₚ²/n₁ + sₚ²/n₂, df = n₁ + n₂ − 2
The pooled variance is a weighted average, with weight n − 1 for each sample, and the degrees of freedom add. This is the two-sample t-test. It appears in some A-Level specifications and in most first-year university courses, so it is worth recognising even if your specification prefers the large-sample z-approach.
合并方差是一个加权平均,每个样本的权重为 n − 1,自由度相加。这就是双样本 t 检验。它出现在部分 A-Level 考纲以及大多数大学一年级课程中,所以即便你的考纲更偏向大样本 z 方法,也值得认识它。
If the population variances are clearly unequal and the samples are small, do not pool. Use the unpooled standard error √s₁²/n₁ + s₂²/n₂ with a t-distribution and a Welch-type degrees-of-freedom adjustment. The safe default in doubt is the unpooled version, since it makes fewer assumptions.
如果总体方差明显不相等且样本较小,就不要合并。使用未合并的标准误
更多咨询请联系16621398022(同微信)

或截图后用「扫一扫 → 相册」选择本图