📚 A-Level Further Mathematics: Goodness-of-Fit Tests for Discrete Data | 离散数据的拟合优度检验
In A-Level Further Mathematics, a goodness-of-fit test is a statistical procedure used to decide whether observed discrete data are consistent with a proposed probability model. It is particularly useful when data are presented as frequencies in distinct categories, such as the number of goals scored per match or the number of defective items in a sample.
在进阶数学中,拟合优度检验是一种用于判断离散观测数据是否与某个概率模型相容的统计方法。当数据以不同类别中的频数形式呈现时,例如每场比赛的进球数或样本中的次品数量,这种检验尤其有用。
The usual approach is the chi-squared goodness-of-fit test. The test compares the observed frequencies with the frequencies that would be expected if the assumed model were true, and it measures how far apart these two sets of frequencies are.
最常用的方法是卡方拟合优度检验。该检验将观测频数与假设模型成立时应有的期望频数进行比较,并度量这两组频数之间的差异大小。
1. What is a Goodness-of-Fit Test? | 什么是拟合优度检验?
A goodness-of-fit test helps us answer a simple question: “Do the data come from the distribution I have claimed?” For example, a retailer may believe that daily sales follow a Poisson distribution, or a biologist may claim that the number of offspring follows a binomial distribution.
拟合优度检验帮助我们回答一个简单的问题:“这些数据是否来自我所假定的分布?”例如,零售商可能认为日销售量服从泊松分布,或者生物学家可能声称子代数量服从二项分布。
The test does not prove that a distribution is exactly correct. Instead, it provides evidence for or against the assumed model. A small test statistic suggests that the observed data are close to the expected pattern, while a large test statistic suggests a poor fit.
该检验并不能证明某个分布完全正确。相反,它只提供支持或反对假定模型的证据。较小的检验统计量表明观测数据与期望模式较为接近,而较大的检验统计量则表明拟合效果较差。
This test is applicable to discrete distributions such as the binomial, Poisson, and uniform distributions. The observed data must be counts, not proportions or continuous measurements.
该检验适用于二项分布、泊松分布和均匀分布等离散分布。观测数据必须是频数计数,而不能是比例或连续型测量值。
2. The Chi-Squared Test Statistic | 卡方检验统计量
Suppose a discrete distribution has n categories, and we collect a total of N observations. For each category i, let Oᵢ be the observed frequency and Eᵢ be the expected frequency under the proposed model. The expected frequency is calculated as Eᵢ = N × pᵢ, where pᵢ is the probability that a single observation falls into category i.
假设一个离散分布有 n 个类别,我们总共收集了 N 个观测值。对于第 i 个类别,设 Oᵢ 为观测频数,Eᵢ 为假设模型下的期望频数。期望频数按 Eᵢ = N × pᵢ 计算,其中 pᵢ 是单个观测落入第 i 个类别的概率。
The chi-squared test statistic is defined by the following formula:
卡方检验统计量由以下公式定义:
χ² = Σ (Oᵢ − Eᵢ)² / Eᵢ
where the summation is taken over all categories. If the observed frequencies are very close to the expected frequencies, each term will be small, and χ² will be small. If the model is poor, some terms will be large, and χ² will be large.
其中求和是对所有类别进行的。如果观测频数与期望频数非常接近,每一项都会很小,χ² 也会很小。如果模型拟合较差,某些项会较大,χ² 也会较大。
Notice that the test statistic is always positive. It can be zero only when every observed frequency exactly equals its expected frequency, which is extremely rare in real data.
注意,检验统计量总是非负的。只有当每个观测频数都恰好等于对应期望频数时,它才可能为零,而这种情况在真实数据中极为罕见。
3. Setting Up Hypotheses | 建立原假设与备择假设
The null hypothesis for a goodness-of-fit test always states that the observed data follow the specified discrete distribution. The alternative hypothesis states that the observed data do not follow that distribution.
拟合优度检验的原假设总是指定观测数据服从某个特定的离散分布。备择假设则指观测数据不服从该分布。
H₀ : The data follow the stated distribution
H₁ : The data do not follow the stated distribution
For example, when testing whether a die is fair, H₀ would be “the face values are uniformly distributed”, and H₁ would be “the face values are not uniformly distributed”.
例如,在检验一颗骰子是否公平时,H₀ 为“各面点数服从均匀分布”,H₁ 为“各面点数不服从均匀分布”。
The chi-squared test is a one-tailed test, because only unusually large values of χ² lead us to doubt the null hypothesis. Very small values of χ² indicate close agreement and therefore support H₀.
卡方检验是单尾检验,因为只有异常大的 χ² 值才会使我们怀疑原假设。非常小的 χ² 值表示观测值与期望值非常吻合,因此支持 H₀。
4. Degrees of Freedom and Critical Values | 自由度与临界值
The chi-squared distribution used for the test is indexed by a parameter called the degrees of freedom, often written as df. For a goodness-of-fit test with n categories, the basic degrees of freedom are n − 1.
用于检验的卡方分布由一个称为自由度的参数确定,通常记为 df。对于包含 n 个类别的拟合优度检验,基本自由度为 n − 1。
If k parameters of the distribution have been estimated from the same data, one further degree of freedom is subtracted for each estimated parameter, giving df = n − 1 − k.
如果从同一组数据中估计了该分布的 k 个参数,则每估计一个参数就再减去一个自由度,即 df = n − 1 − k。
Once df and the significance level α are known, the critical value can be found from a chi-squared table. The decision rule is:
一旦确定了 df 和显著性水平 α,就可以通过卡方分布表查出临界值。决策规则为:
If χ² > critical value, reject H₀.
如果 χ² 大于临界值,则拒绝 H₀。
Alternatively, a p-value can be calculated. Reject H₀ when the p-value is less than the chosen significance level, such as 0.05 or 0.01.
也可以计算 p 值。当 p 值小于所选显著性水平(例如 0.05 或 0.01)时,拒绝 H₀。
5. Conditions for Using the Test | 检验的适用条件
Before using the chi-squared goodness-of-fit test, the following conditions should be checked:
在使用卡方拟合优度检验之前,应检查以下条件:
-
Each observation must be independent of the others.
各观测值之间必须相互独立。
-
The categories must be mutually exclusive and exhaustive, so that every observation falls into exactly one category.
各个类别必须互斥且完备,使每个观测值只能落入一个类别。
-
The expected frequency in each category should be sufficiently large. In Edexcel style questions, expected frequencies are usually required to be at least 5.
每个类别的期望频数应足够大。在 Edexcel 风格的题目中,通常要求期望频数至少为 5。
-
The total sample size N must be reasonably large, because the chi-squared distribution is an approximation to the exact sampling distribution.
总样本量 N 必须足够大,因为卡方分布是对精确抽样分布的一种近似。
When one or more expected frequencies are below 5, it is common practice to combine adjacent categories before performing the test. The test statistic and degrees of freedom are then based on the reduced number of categories.
当一个或多个期望频数低于 5 时,通常的做法是在检验前合并相邻类别。此时检验统计量和自由度都基于合并后的类别数量计算。
6. Worked Example: Discrete Uniform Distribution | 实例:离散均匀分布
A die is rolled 60 times. The numbers of times each face appears are recorded as follows:
将一颗骰子掷 60 次,记录各面出现的次数如下:
| Face | 1 | 2 | 3 | 4 | 5 | 6 |
| Oᵢ | 8 | 12 | 10 | 9 | 13 | 8 |
| Eᵢ | 10 | 10 | 10 | 10 | 10 | 10 |
Under the uniform model, each face has probability 1/6, so the expected frequency for each face is 60 × 1/6 = 10. The contributions to χ² are:
在均匀分布模型下,每个面出现的概率为 1/6,因此每个面的期望频数为 60 × 1/6 = 10。各项对 χ² 的贡献为:
χ² = (8−10)²/10 + (12−10)²/10 + (10−10)²/10 + (9−10)²/10 + (13−10)²/10 + (8−10)²/10
This gives χ² = 0.4 + 0.4 + 0 + 0.1 + 0.9 + 0.4 = 2.2. There are 6 categories and no parameters have been estimated, so df = 6 − 1 = 5.
于是 χ² = 0.4 + 0.4 + 0 + 0.1 + 0.9 + 0.4 = 2.2。这里共有 6 个类别,且没有估计任何参数,因此 df = 6 − 1 = 5。
At the 5% significance level, the critical value from the chi-squared table is 11.070. Since 2.2 < 11.070, we do not reject H₀. There is insufficient evidence to say that the die is unfair.
在 5% 显著性水平下,卡方分布表的临界值为 11.070。由于 2.2 < 11.070,我们不能拒绝 H₀。没有足够证据表明骰子不公平。
7. Worked Example: Binomial Distribution | 实例:二项分布
A teacher believes that the number of correct answers in a five-question true-or-false test follows a binomial distribution with n = 5 and p = 0.5. A random sample of 50 students gives the following frequencies.
一位教师认为,五道判断题中的答对题数服从参数为 n = 5、p = 0.5 的二项分布。随机抽取 50 名学生,得到以下频数。
| Number correct | 0–1 | 2 | 3 | 4–5 |
| Observed Oᵢ | 12 | 17 | 13 | 8 |
| Expected Eᵢ | 更多咨询请联系16621398022(同微信)
CommentsMore posts |
屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导Cancel reply