📚 The F-test: Comparing Two Variances | F 检验:比较两个总体方差
In A-level statistics, the F-test is a hypothesis test used to compare two population variances. It helps decide whether two independent samples come from populations with the same spread, or whether an entire regression model has explanatory power. Because it deals with spread rather than averages, the F-test plays a supporting role in many other procedures - most importantly in checking the equal-variance assumption before a two-sample t-test.
在 A-level 统计学中,F 检验是一种用于比较两个总体方差的假设检验。它帮助我们判断两个独立样本是否来自具有相同离散程度的总体,或者判断整个回归模型是否具有解释能力。由于它考察的是离散程度而不是平均水平,F 检验在许多其他检验中扮演着支持性角色——最重要的一点,就是在做双样本 t 检验之前检查方差相等的假设。
1. What is the F-test? | 什么是 F 检验?
The F-test uses the ratio of two sample variances to test a claim about two population variances. Instead of comparing means, it compares how spread out the data are. If the two samples have similar variability, the ratio is close to 1; if one sample is far more variable than the other, the ratio becomes much larger than 1.
F 检验使用两个样本方差的比值来检验关于两个总体方差的论断。它不是比较均值,而是比较数据的离散程度。如果两个样本的波动程度相近,这个比值就接近 1;如果一个样本的波动远大于另一个,比值就会远大于 1。
The test statistic is named F after Sir Ronald Fisher, who developed the analysis of variance (ANOVA) in the early twentieth century. The F distribution therefore sits at the heart of a whole family of tests, from simple two-sample comparisons to multiple regression.
检验统计量以 Ronald Fisher 爵士的名字命名为 F,他创立了方差分析(ANOVA)方法。因此 F 分布是一整族检验的核心,从简单的双样本比较到多元回归都离不开它。
Unlike the normal or t distributions, the F distribution is positively skewed and only takes non-negative values. A small F value suggests the two variances are similar; a large F value suggests they are different.
与正态分布或 t 分布不同,F 分布是正偏态的,并且只取非负值。F 值很小说明两个方差相近;F 值很大则说明它们存在差异。
2. When to use the F-test | 何时使用 F 检验
Use an F-test when you need to compare the variances of two independent random samples. A common application is checking the assumption of equal variances before a two-sample t-test, because the pooled form of the t-test is only valid when the two population variances can be assumed equal.
当你需要比较两个独立随机样本的方差时,可以使用 F 检验。常见应用是在进行双样本 t 检验之前,检验方差相等的假设,因为合并方差形式的 t 检验只有在两个总体方差可以认为相等时才成立。
It is also used in regression ANOVA to test whether all slope coefficients are simultaneously zero. In that setting the F-test does not compare two samples directly; instead it compares the variability explained by the model with the variability left unexplained.
它也用于回归方差分析中,检验所有斜率系数是否同时为零。在这种情形下,F 检验并不直接比较两个样本,而是把模型解释的变异性与未被解释的残差变异性进行比较。
The conditions required before you carry out the test are straightforward:
进行该检验前需要满足的条件很明确:
- The two samples must be independent of each other. | 两个样本必须相互独立。
- Each sample must come from an approximately normal population. | 每个样本都必须来自近似正态的总体。
- The data should be collected as a random sample from each population. | 数据应当来自每个总体的随机抽样。
- The samples may have different sizes, which is one of the test's advantages. | 两个样本的容量可以不同,这是该检验的优点之一。
3. The F-distribution | F 分布
The F distribution is the probability distribution of the ratio of two independent chi-squared variables, each divided by its own degrees of freedom. In practice you never build it from scratch - you look up critical values in tables or read them from a calculator.
F 分布是两个相互独立的卡方变量各自除以其自由度之后,所得比值的概率分布。实际做题时你不需要从头构造它——只需查临界值表,或用计算器读出临界值。
Its key properties are worth memorising, because exam questions often ask you to describe the shape or justify a choice of test.
它的几个关键性质值得记住,因为考题常常要求你描述其形状,或说明选择该检验的理由。
- Non-negative: F can never be negative, since it is a ratio of two squared quantities. | 非负性:F 永远不可能为负,因为它是两个平方量的比值。
- Positively skewed: the long tail stretches to the right, and the distribution is never symmetric. | 正偏态:长尾向右延伸,分布永远不对称。
- Two degrees of freedom: ν₁ for the numerator and ν₂ for the denominator. | 两个自由度:分子自由度 ν₁ 与分母自由度 ν₂。
- Reciprocal property: if F follows F(ν₁, ν₂), then 1 ÷ F follows F(ν₂, ν₁). | 倒数性质:若 F 服从 F(ν₁, ν₂),则 1 ÷ F 服从 F(ν₂, ν₁)。
- Mean: the mean equals ν₂ ÷ (ν₂ − 2), which exists only when ν₂ > 2. | 均值:均值等于 ν₂ ÷ (ν₂ − 2),仅当 ν₂ > 2 时存在。
As both degrees of freedom increase, the distribution becomes less skewed and more bell-shaped, but it remains strictly positive.
当两个自由度都增大时,分布会变得不那么偏斜、更接近钟形,但仍然严格取正值。
4. Hypotheses and the test statistic | 原假设与检验统计量
The null hypothesis always states that the two population variances are equal. The alternative hypothesis states that they differ, or - if the question specifies a direction - that one is greater than the other.
原假设总是断言两个总体方差相等。备择假设则断言它们不相等,或者当题目指定了方向时,断言其中一个大于另一个。
H₀: σ₁² = σ₂² H₁: σ₁² ≠ σ₂² (or σ₁² > σ₂²)
e numerator, so that F ≥ 1 and only the upper tail of the F distribution needs to be used.
检验统计量是两个样本方差的比值。习惯上把较大的样本方差放在分子,使 F ≥ 1,从而只需使用 F 分布的上尾。
F = s₁² ÷ s₂²
Here s₁² and s₂² are the two sample variances, calculated with the divisor (n − 1). Note carefully that the symbol s² denotes a sample variance, while σ² denotes a population variance - mixing the two up is a very common exam error.
其中 s₁² 和 s₂² 是两个样本方差,计算时除以 (n − 1)。要特别注意:s² 表示样本方差,σ² 表示总体方差——把两者混淆是考试中非常常见的错误。
5. Degrees of freedom | 自由度
The F distribution needs two degrees of freedom: one for the numerator and one for the denominator. Each is one less than the corresponding sample size, because one degree of freedom is used up by estimating the sample mean.
F 分布需要两个自由度:一个属于分子,一个属于分母。每个自由度都比对应的样本容量小 1,因为计算样本均值时用掉了一个自由度。
ν₁ = n₁ − 1 ν₂ = n₂ − 1
The order matters enormously. If you write the degrees of freedom the wrong way round, you will look up a different critical value and reach the wrong conclusion. Always write them as (numerator df, denominator df) using the same order as your F statistic.
顺序极其重要。如果把自由度写反了,查到的就是另一个临界值,结论也会出错。始终按(分子自由度, 分母自由度)的顺序书写,与 F 统计量的顺序保持一致。
e has 12 observations and the second has 10, then ν₁ = 11 and ν₂ = 9, written as F(11, 9).
例如,第一个样本有 12 个观测值,第二个有 10 个,则 ν₁ = 11,ν₂ = 9,记作 F(11, 9)。
6. Critical values and rejection regions | 临界值与拒绝域
Once you have calculated F and identified the two degrees of freedom, you compare the statistic with the critical value from the F tables at your chosen significance level α. For a one-tailed test the rejection region lies entirely in the upper (right-hand) tail.
算出 F 并确定两个自由度之后,就要把统计量与所选显著性水平 α 下的 F 表临界值进行比较。对于单尾检验,拒绝域完全位于上尾(右尾)。
Reject H₀ if F > Fα(ν₁, ν₂)
Because the larger variance is placed in the numerator, the calculated F is always at least 1, and the tables needed are the upper-tail tables only. This convention is why A-level questions never require you to use the lower tail.
由于把较大的方差放在分子,算出的 F 总是至少为 1,因而只需使用上尾表格。正因如此,A-level 题目从不要求你使用下尾。
If the calculated value falls in the rejection region, you reject H₀ and conclude there is sufficient evidence that the population variances differ. If it does not, you fail to reject H₀ - which means there is insufficient evidence of a difference, not proof that the variances are equal.
如果计算值落入拒绝域,就拒绝 H₀,并得出结论:有充分证据表明两个总体方差不同。如果没有落入拒绝域,则不拒绝 H₀——这意味着没有足够证据说明存在差异,而不是证明了方差相等。
7. A worked example | 一个计算示例
Two machines fill bottles with a liquid, and an engineer suspects that machine A is less consistent than machine B. A random sample of 12 bottles from machine A gives a sample variance of 8.4, and a random sample of 10 bottles from machine B gives a sample variance of 3.2. Test at the 5% significance level.
两台机器为瓶子灌装液体,工程师怀疑机器 A 的稳定性不如机器 B。从机器 A 随机抽取 12 瓶,样本方差为 8.4;从机器 B 随机抽取 10 瓶,样本方差为 3.2。在 5% 显著性水平下进行检验。
Step 1: state the hypotheses in terms of the population variances of the two machines, using a one-tailed alternative because the engineer believes A varies more than B.
第一步:用两台机器总体的方差写出原假设与备择假设;由于工程师认为 A 的波动大于 B,使用单尾备择假设。
H₀: σ₁² = σ₂² H₁: σ₁² > σ₂²
Step 2: calculate the test statistic, putting the larger variance on top.
第二步:计算检验统计量,把较大的方差放在分子。
F = 8.4 ÷ 3.2 = 2.625
dentify the degrees of freedom and read the critical value. With ν₁ = 11 and ν₂ = 9, the 5% upper-tail critical value is approximately F₀.₀₅(11, 9) ≈ 3.01.
第三步:确定自由度并读出临界值。ν₁ = 11、ν₂ = 9 时,5% 上尾临界值约为 F₀.₀₅(11, 9) ≈ 3.01。
Step 4: compare and conclude. Since 2.625 < 3.01, the calculated value does not lie in the rejection region, so we do not reject H₀. There is insufficient evidence at the 5% level that the two machines have different variability.
第四步:比较并得出结论。由于 2.625 < 3.01,计算值不在拒绝域内,因此不拒绝 H₀。在 5% 水平下没有足够证据表明两台机器的波动程度不同。
Notice how the conclusion is phrased in terms of the original context, not just as 'reject' or 'accept'. Marks are awarded for that context sentence.
注意结论要用原始情境来表述,而不是只写「拒绝」或「接受」。这个情境句是得分点。
8. One-tailed and two-tailed versions | 单尾与双尾检验
cance level is then split between the two tails, so with α = 0.05 each tail carries 0.025.
当你只想判断方差是否不同、并不指定哪一个更大时,使用双尾 F 检验。此时显著性水平被分到两尾,α = 0.05 时每尾各占 0.025。
In practice, because the larger sample variance is always placed in the numerator, the calculated F is always at least 1 and the lower tail can never be reached. The two-tailed test therefore reduces to comparing F with the upper-tail critical value at α ÷ 2.
实际上,由于总是把较大的样本方差放在分子,算出的 F 至少为 1,永远不可能落到下尾。因此双尾检验就简化为把 F 与 α ÷ 2 水平的上尾临界值进行比较。
A one-tailed test is used when a direction is stated in the question, for example 'test whether the variability of process A is greater than that of process B'. Look for comparison words such as greater, larger, more variable or exceeds.
当题目明确给出方向时使用单尾检验,例如「检验工序 A 的波动是否大于工序 B」。注意 greater、larger、more variable、exceeds 这类比较词。
9. Comparing the F-test with the t-test | F 检验与 t 检验的比较
Students often confuse the two tests because both use sample data to compare two groups. The distinction is simple: the t-test compares centre (means), while the F-test compares spread (variances).
学生常把这两种检验弄混,因为两者都用样本数据比较两组。区别其实很简单:t 检验比较位置(均值),F 检验比较离散程度(方差)。
| Feature | 项目 | F-test | F 检验 | Two-sample t-test | 双样本 t 检验 |
| Quantity compared | 比较的量 | Variances σ₁² and σ₂² | 方差 σ₁² 与 σ₂² | Means μ₁ and μ₂ | 均值 μ₁ 与 μ₂ |
| Test statistic | 检验统计量 | F = s₁² ÷ s₂² | t = (x̄₁ − x̄₂) ÷ standard error |
| Degrees of freedom | 自由度 | Two: ν₁ and ν₂ | 两个:ν₁ 与 ν₂ | One: n₁ + n₂ − 2 | 一个:n₁ + n₂ − 2 |
| Shape of distribution | 分布形状 | Positively skewed, one-sided support | 正偏态,仅取正值 | Symmetric, bell-shaped | 对称的钟形 |
The link between them is that the F-test is normally carried out first, to justify the equal-variance assumption that the pooled t-test depends on.
两者之间的联系是:通常先做 F 检验,以验证合并方差 t 检验所依赖的方差相等假设是否成立。
10. The F-test in regression (ANOVA) | 回归中的 F 检验(方差分析)
In regression, the F-test asks a global question: does the model as a whole explain a significant amount of the variation in the response variable? The hypotheses concern all the slope coefficients at once
更多咨询请联系16621398022(同微信)

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