← 返回资讯屏轩教育 · 行业资讯

Degrees of Freedom and the Chi-Square Distribution Family | 自由度与卡方分布族

2026-08-30 12:20 · 本文部分内容由AI辅助创作

📚 Degrees of Freedom and the Chi-Square Distribution Family | 自由度与卡方分布族

The chi-square distribution family is one of the cornerstones of statistical inference in A-Level Further Mathematics. It is not a single curve but a family of curves indexed by a single parameter: the degrees of freedom. This article explains the concept of degrees of freedom, the mathematical structure of the chi-square family, and its central role in hypothesis testing, including goodness-of-fit tests and tests of independence.

卡方分布族是A-Level进阶数学中统计推断的基石之一。它不是单一曲线,而是由单一参数——自由度——索引的一族曲线。本文将解释自由度的概念、卡方分布族的数学结构,以及它在拟合优度检验和独立性检验等假设检验中的核心作用。


1. At a Glance: Key Facts | 总览:关键事实

Before delving into details, let us record the most important results that will be used throughout this article. These facts form a compact revision toolkit.

在深入细节之前,我们先记录本文中反复使用的最重要结果。这些事实构成了一个紧凑的复习工具包。

Property Result Note
Definition χ²(k) = Z₁² + Z₂² + … + Zk² Zᵢ independently follow N(0,1)
Mean E(X) = k Mean equals degrees of freedom
Variance Var(X) = 2k Variance is twice the df
Additivity χ²(m) + χ²(n) ~ χ²(m + n) Requires independence
Sample variance (n − 1)s²/σ² ~ χ²(n − 1) Normal data assumed

In the table above, k is the degrees of freedom. When working with statistical tables, the row labelled 'df' gives the relevant member of the chi-square family.

上表中,k为自由度。使用统计表时,标记为'df'的行给出卡方族中对应的成员。


2. Degrees of Freedom Explained | 详解自由度

Degrees of freedom (df) can be understood as the number of independent pieces of information that are free to vary when estimating a population parameter. Suppose you have n observations and you already know their mean. If you know n − 1 of the values, the final value is forced by the requirement that the sum equals n times the mean. Therefore only n − 1 values can vary freely.

自由度(df)可以理解为在估计总体参数时可以自由变化的独立信息数量。假设你有n个观测值且已知其均值。如果你知道其中n − 1个值,最后一个值由"总和等于n倍均值"这一约束强制确定。因此只有n − 1个值可以自由变化。

This explains why the sample variance s² = Σ(xᵢ − x̄)²/(n − 1) uses n − 1 in the denominator. The deviations xᵢ − x̄ always sum to zero, so one degree of freedom is lost when the sample mean x̄ is calculated.

这解释了为什么样本方差s² = Σ(xᵢ − x̄)²/(n − 1)在分母中使用n − 1。偏差xᵢ − x̄的总和恒为零,因此在计算样本均值x̄时损失了一个自由度。

In chi-square tests, degrees of freedom also count how many categories can vary after fixing totals and estimated parameters. We will see this explicitly in Sections 7 and 8.

在卡方检验中,自由度同样计算在固定总数和估计参数后可以变化的类别数。我们将在第7节和第8节中明确看到这一点。


3. The Chi-Square Distribution Family | 卡方分布族

If Z₁, Z₂, …, Zk are independent standard normal variables, then the random variable

若Z₁, Z₂, …, Zk是独立标准正态变量,则随机变量

Q = Z₁² + Z₂² + … + Zk²

follows a chi-square distribution with k degrees of freedom, written Q ~ χ²(k).

服从自由度为k的卡方分布,记为Q ~ χ²(k)。

ewed to the right. For larger k, the skewness gradually decreases and the curve becomes more bell-shaped.

由于k可以是任意正整数,卡方分布实际上是一个分布族。参数k同时控制形状、离散程度和位置。对于k = 1和k = 2,曲线严重右偏。对于较大的k,偏度逐渐减小,曲线变得更接近钟形。

The graph of a chi-square density starts at zero, rises to a peak near k − 2, and then decays with a long right tail. Since the variable is a sum of squares, it can never be negative.

卡方密度曲线从零开始,在接近k − 2处达到峰值,随后以长右尾衰减。由于该变量是平方和,它永远不会取负值。


4. Mean and Variance | 均值与方差

For X ~ χ²(k), the mean and variance are:

对于X ~ χ²(k),均值和方差为:

E(X) = k, Var(X) = 2k

n E(Z²) = Var(Z) + [E(Z)]² = 1. Also E(Z⁴) = 3, so Var(Z²) = E(Z⁴) − [E(Z²)]² = 3 − 1 = 2.

为了理解这一点,回忆标准正态Z有E(Z) = 0和Var(Z) = 1。于是E(Z²) = Var(Z) + [E(Z)]² = 1。又有E(Z⁴) = 3,所以Var(Z²) = E(Z⁴) − [E(Z²)]² = 3 − 1 = 2。

ances add, summing k independent Zᵢ² terms gives E(X) = k × 1 = k and Var(X) = k × 2 = 2k.

由于和的期望等于期望的和,且独立性使方差可以相加,将k个独立的Zᵢ²相加得到E(X) = k × 1 = k和Var(X) = k × 2 = 2k。

er H₀, a test statistic near 10 is expected; a value above 30 would be extremely unusual because the standard deviation is √2 × 10 ≈ 4.47.

这两个简单量出人意料地强大。例如,在df = 10的拟合优度检验中,H₀下检验统计量接近10是预期的;超过30的值将极其异常,因为标准差为√2 × 10 ≈ 4.47。


广告 / Sponsored

5. The Additive Property | 可加性

One of the most useful properties of the chi-square family is additivity. If X ~ χ²(m) and Y ~ χ²(n) are independent, then

卡方族最有用的性质之一是可加性。若X ~ χ²(m)和Y ~ χ²(n)独立,则

X + Y ~ χ²(m + n)

This follows directly from the defining sum of squares: X is a sum of m squared normals, Y is a sum of n squared normals, and together they form a sum of m + n squared normals.

这直接从平方和的定义得出:X是m个正态平方之和,Y是n个正态平方之和,合在一起构成m + n个正态平方之和。

In practice, this property allows us to combine independent test statistics. For example, when several independent contingency tables are analysed, their chi-square statistics and degrees of freedom may be added.

在实践中,该性质允许我们合并独立的检验统计量。例如,在分析多个独立列联表时,可以将其卡方统计量和自由度相加。


6. Relationship with the Sample Variance | 与样本方差的关系

Let x₁, x₂, …, xₙ be a random sample from a normal distribution N(μ, σ²). The sample variance is defined as

设x₁, x₂, …, xₙ是来自正态分布N(μ, σ²)的随机样本。样本方差定义为

s² = Σ(xᵢ − x̄)² / (n − 1)

Then the following crucial identity holds:

那么以下关键恒等式成立:

(n − 1)s² / σ² ~ χ²(n − 1)

Notice that the degrees of freedom are n − 1, not n. The reason is that the sample mean must be estimated before the deviations xᵢ − x̄ can be formed, costing one degree of freedom.

注意自由度是n − 1,而不是n。原因在于必须首先估计样本均值才能形成偏差xᵢ − x̄,这消耗了一个自由度。

This relationship underpins confidence intervals for the population variance. For a 95% confidence interval for σ², we use

这一关系支撑着总体方差的置信区间。对于σ²的95%置信区间,我们使用

( (n − 1)s² / χ²ₙ₋₁(0.025) , (n − 1)s² / χ²ₙ₋₁(0.975) )

where χ²ₙ₋₁(p) denotes the value such that P(X ≤ value) = p for X ~ χ²(n − 1).

其中χ²ₙ₋₁(p)表示对于X ~ χ²(n − 1),满足P(X ≤ value) = p的数值。


7. Chi-Square Goodness-of-Fit Test | 卡方拟合优度检验

The goodness-of-fit test determines whether observed categorical data are consistent with a proposed theoretical distribution. It compares observed frequencies Oᵢ with expected frequencies Eᵢ under the null hypothesis.

拟合优度检验用于判断观测的类别数据是否与建议的理论分布一致。它将观测频数Oᵢ与零假设下的期望频数Eᵢ进行比较。

The test statistic is:

检验统计量为:

χ²_calc = Σ (Oᵢ − Eᵢ)² / Eᵢ

Under H₀ and when all expected frequencies are sufficiently large, this statistic approximately follows a chi-square distribution. The approximation improves as the sample size increases.

在H₀下且所有期望频数足够大时,该统计量近似服从卡方分布。随着样本量增大,近似程度改善。

The steps of the test are as follows:

检验步骤如下:

For a die fairness test, H₀ would state that each face has probability 1/6. The expected frequency for each face is n/6. This is a simple chi-square test with no parameters estimated from the data.

对于骰子公平性检验,H₀声明每个面概率为1/6。每个面的期望频数为n/6。这是一个简单的卡方检验,无需从数据中估计参数。


8. Degrees of Freedom in Goodness-of-Fit Tests | 拟合优度检验中的自由度

The number of degrees of freedom in a goodness-of-fit test is not simply the number of categories. It depends on how many parameters of the hypothesised distribution have been estimated from the data.

拟合优度检验中的自由度并非简单地等于类别数。它取决于从数据中估计了假设分布的多少个参数。

In general, for m categories:

一般地,对于m个类别:

df = m − 1 − p

where p is the number of parameters estimated from the data to calculate the expected frequencies.

其中p是为计算期望频数而从数据中估计的参数个数。

Examples:

例子: