📚 PDF资源导航

A-Level Further Mathematics: Goodness of Fit Test for the Geometric Distribution | A-Level进阶数学:几何分布的拟合优度检验

📚 A-Level Further Mathematics: Goodness of Fit Test for the Geometric Distribution | A-Level进阶数学:几何分布的拟合优度检验

The chi-squared goodness of fit test is a powerful tool for deciding whether observed data can plausibly be modelled by a particular probability distribution. In this article, we focus specifically on testing whether a data set follows a geometric distribution — a discrete model often used for the number of trials until the first success.

卡方拟合优度检验是一种强有力的工具,用于判断观测数据是否能够合理地由某一特定概率分布来建模。本文专门讨论如何检验一组数据是否服从几何分布——这是一种常用于描述“直到首次成功所需试验次数”的离散模型。


1. What Is the Geometric Distribution? | 什么是几何分布?

The geometric distribution models the number of trials required to achieve the first success in a sequence of independent Bernoulli trials with constant success probability p. Its probability mass function is given by:

几何分布描述在一系列独立、成功概率恒为 p 的伯努利试验中,获得首次成功所需试验次数的概率。其概率质量函数为:

P(X = r) = p(1 − p)ʳ⁻¹, for r = 1, 2, 3, …

Here X is the random variable representing the trial number on which the first success occurs. The mean is E(X) = 1/p and the variance is Var(X) = (1 − p)/p².

这里 X 是表示首次成功出现于第几次试验的随机变量。其均值为 E(X) = 1/p,方差为 Var(X) = (1 − p)/p²。


2. Why Test Goodness of Fit? | 为什么要做拟合优度检验?

In practice, we may have collected data that we believe follows a geometric distribution — for example, the number of phone calls until the first wrong number, or the number of rolls of a die until a 6 appears. A goodness of fit test allows us to compare the observed frequencies with the frequencies we would expect under the geometric model.

在实际中,我们可能收集到一组数据,并认为它服从几何分布——例如,拨打电话直到第一次拨错号码的次数,或掷骰子直到出现 6 的次数。拟合优度检验使我们能够将观测频数与几何模型下的期望频数进行比较。

The null hypothesis is always that the data follows the specified distribution, and we use the chi-squared statistic to measure how far the observed frequencies deviate from the expected ones.

原假设始终是数据服从指定分布,我们使用卡方统计量来衡量观测频数与期望频数之间的偏差有多大。


3. Setting Up Hypotheses | 建立假设

For any chi-squared goodness of fit test, we begin by stating the hypotheses clearly.

对于任何卡方拟合优度检验,我们首先需要清楚地陈述假设。

  • H₀: The data follows a geometric distribution.

  • H₁: The data does not follow a geometric distribution.

  • H₀:数据服从几何分布。

  • H₁:数据不服从几何分布。

The test is always one-tailed in the upper tail, because we reject H₀ only when the chi-squared statistic is sufficiently large, indicating a poor fit.

该检验始终是右侧单尾检验,因为只有当卡方统计量足够大、表明拟合效果较差时,我们才拒绝原假设 H₀。


4. Estimating the Parameter p | 估计参数 p

Unless the value of p is specified in the null hypothesis, we must estimate it from the data. This is a crucial step because the degrees of freedom will be adjusted by the number of estimated parameters.

除非原假设中已经指定了 p 的值,否则我们必须从数据中估计它。这是关键一步,因为自由度需要减去被估计参数的个数。

For the geometric distribution, the method of moments gives a natural estimator. Since E(X) = 1/p, we can estimate p using the sample mean x̄:

对于几何分布,矩估计法给出一个自然的估计量。由于 E(X) = 1/p,我们可以用样本均值 x̄ 来估计 p:

p̂ = 1 / x̄

The sample mean is calculated from the grouped data as x̄ = Σ(fᵢxᵢ) / n, where fᵢ is the observed frequency of outcome xᵢ and n is the total sample size. This estimator is also the maximum likelihood estimator for the geometric distribution.

样本均值由分组数据计算为 x̄ = Σ(fᵢxᵢ) / n,其中 fᵢ 是结果 xᵢ 的观测频数,n 是总样本量。该估计量同时也是几何分布的最大似然估计量。


5. Computing Expected Frequencies | 计算期望频数

Once p̂ has been obtained, we calculate the expected frequency for each outcome using the probability mass function.

一旦获得 p̂,我们就用概率质量函数计算每个结果的期望频数。

For each value r = 1, 2, 3, …, the expected frequency is:

对于每个取值 r = 1, 2, 3, …,期望频数为:

Eᵣ = n × p̂(1 − p̂)ʳ⁻¹

For the last class, which often takes the form “r or more” (e.g., X ≥ 6), we use the tail probability:

对于最后一个类别,通常采用“r 次或以上”的形式(例如 X ≥ 6),我们使用尾部概率:

P(X ≥ r) = (1 − p̂)ʳ⁻¹

so that the sum of all probabilities equals 1, and the sum of all expected frequencies equals n.

这样所有概率之和等于 1,所有期望频数之和等于 n。


6. Combining Categories | 合并类别

The chi-squared approximation is only valid when the expected frequencies are sufficiently large. A common rule is that all expected frequencies must be at least 5.

卡方近似仅在期望频数足够大时才有效。一个常用的规则是:所有期望频数都必须至少为 5。

If any expected frequency is less than 5, we combine that category with an adjacent category. This process is called pooling or grouping. After pooling, the number of classes m is reduced, and this must be reflected in the degrees of freedom.

如果某个期望频数小于 5,我们将该类别与相邻类别合并。这个过程称为合并或归组。合并后,类别数 m 会减少,这必须反映在自由度中。

It is important to combine in a way that maintains a meaningful order — typically pooling the smallest values into the next category or pooling the final tail classes together. Never merge non-adjacent categories.

重要的是合并且保持有意义顺序——通常将最小的值并入下一类,或将尾部类别合并在一起。切勿合并不相邻的类别。


7. The Chi-Squared Test Statistic | 卡方检验统计量

The test statistic measures the discrepancy between observed and expected frequencies. For each class i, we compute the contribution (Oᵢ − Eᵢ)² / Eᵢ, where Oᵢ is the observed frequency and Eᵢ the expected frequency for that class.

检验统计量衡量观测频数与期望频数之间的差异。对于每个类别 i,我们计算贡献量 (Oᵢ − Eᵢ)² / Eᵢ,其中 Oᵢ 是该类别的观测频数,Eᵢ 是期望频数。

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

The sum is taken over all m classes after pooling. The resulting statistic approximately follows a chi-squared distribution with the appropriate degrees of freedom, provided the expected frequencies are all at least 5.

求和是合并后的所有 m 个类别进行的。只要所有期望频数均至少为 5,所得的统计量近似服从具有相应自由度的卡方分布。

When calculating by hand, it is wise to verify that ΣEᵢ = n, as this serves as a useful arithmetic check before computing χ².

在手工计算时,最好验证 ΣEᵢ = n,这是计算 χ² 之前一个有用的算术检查。


8. Degrees of Freedom | 自由度

The degrees of freedom for a chi-squared goodness of fit test depend on the number of classes after pooling and the number of parameters estimated from the data.

卡方拟合优度检验的自由度取决于合并后的类别数和从数据中估计的参数个数。

df = m − k − 1

where m is the number of classes after pooling, and k is the number of parameters estimated from the data. For the geometric distribution, we typically estimate one parameter (p), so k = 1:

其中 m 是合并后的类别数,k 是从数据中估计的参数个数。对于几何分布,我们通常估计一个参数(p),因此 k = 1:

df = m − 2

If p were somehow known in advance and not estimated from the data, then k = 0 and df = m − 1. Always check which case applies in your exam.

如果 p 是预先已知的而并非从数据中估计,则 k = 0,df = m − 1。在考试中务必判断属于哪种情形。


9. Critical Values and Conclusion | 临界值与结论

The decision rule is to reject H₀ at the α significance level if the calculated test statistic exceeds the critical value χ²ₐ(d f).

决策规则是:在 α 显著性水平下,若计算得到的检验统计量超过临界值 χ²ₐ(df),则拒绝原假设 H₀。

Reject H₀ if χ²_calc > χ²_crit

若 χ²_计算值 > χ²_临界值,则拒绝 H₀

Critical values for the chi-squared distribution are found from statistical tables using the row corresponding to the degrees of freedom and the column for the required significance level (commonly 5% or 1%).

卡方分布的临界值可从统计表中查找,使用自由度对应的行和所需显著性水平(通常为 5% 或 1%)对应的列。

If we reject H₀, we conclude that there is significant evidence that the data does not follow a geometric distribution. If we fail to reject H₀, we conclude that the geometric distribution provides a reasonable fit to the data — we do not “prove” the distribution is correct.

若拒绝 H₀,我们得出结论:有显著证据表明数据不服从几何分布。若无法拒绝 H₀,我们得出结论:几何分布对数据提供了合理拟合——但我们并不能“证明”该分布是正确的。


10. Worked Example | 完整例题

A dice is rolled repeatedly until a 6 is obtained. The number of rolls needed, X, is recorded for 100 independent trials. The results are:

一枚骰子被反复掷出直到出现 6。所需的掷骰次数 X 在 100 次独立试验中被记录。结果如下:

X 1 2 3 4 5 ≥ 6
Frequency 20 18 15 12 10 25

Test at the 5% significance level whether X can be modelled by a geometric distribution.

在 5% 显著性水平下检验 X 是否可以用几何分布建模。

Step 1 — Estimate p: First compute the sample mean treating the final class as X = 6:

第一步——估计 p:首先计算样本均值,将最后一类视为 X = 6:

x̄ = (20×1 + 18×2 + 15×3 + 12×4 + 10×5 + 25×6) / 100 = 349 / 100 = 3.49

p̂ = 1 / x̄ = 1 / 3.49 ≈ 0.2865

Step 2 — Compute expected frequencies: Using P(X = r) = p̂(1 − p̂)ʳ⁻¹:

第二步——计算期望频数:使用 P(X = r) = p̂(1 − p̂)ʳ⁻¹:

r 1 2 3 4 5 ≥ 6
P(X = r) 0.2865 0.2044 0.1458 0.1041 0.0742 0.1850
Eᵢ = 100 × P 28.65 20.44 14.58 10.41 7.42 18.50

All expected frequencies exceed 5, so no pooling is required. The expected frequencies sum to 28.65 + 20.44 + 14.58 + 10.41 + 7.42 + 18.50 = 100.00 ✓

所有期望频数均大于 5,因此无需合并。期望频数之和为 28.65 + 20.44 + 14.58 + 10.41 + 7.42 + 18.50 = 100.00 ✓

Step 3 — Compute χ²:

第三步——计算 χ²:

Class Oᵢ Eᵢ (Oᵢ − Eᵢ)² / Eᵢ
1 20 28.65 (20 − 28.65)² / 28.65 = 2.612
2 18 20.44 (18 − 20.44)² / 20.44 = 0.291
3 15 14.58 (15 − 14.58)² / 14.58 = 0.012
4 12 10.41 (12 − 10.41)² / 10.41 = 0.243
5 10 7.42 (10 − 7.42)² / 7.42 = 0.897
≥ 6 25 18.50 (25 − 18.50)² / 18.50 = 2.284

χ²_calc = 2.612 + 0.291 + 0.012 + 0.243 + 0.897 + 2.284 = 6.339

Step 4 — Degrees of freedom and critical value: There are m = 6 classes and k = 1 estimated parameter, so df = 6 − 1 − 1 = 4. From tables, χ²₀.₀₅(4) = 9.488.

第四步——自由度和临界值:合并后有 m = 6 个类别,估计了 k = 1 个参数,因此 df = 6 − 1 − 1 = 4。查表得 χ²₀.₀₅(4) = 9.488。

Step 5 — Conclusion: Since 6.339 < 9.488, we do not reject H₀. There is insufficient evidence at the 5% significance level that the data does not follow a geometric distribution. The geometric model provides a good fit.

第五步——结论:由于 6.339 < 9.488,我们不拒绝 H₀。在 5% 显著性水平下没有充分证据表明数据不服从几何分布。几何模型提供了良好的拟合。


11. Common Pitfalls | 常见错误

Students often make a number of predictable mistakes in this type of question. Being aware of these can help you avoid losing marks.

学生在此类题目中经常犯一些可预见性的错误。了解这些错误可以帮助你避免失分。

  • Forgetting to estimate p: Always check whether p is given or must be estimated from the data. If estimated, remember to subtract 1 extra degree of freedom.

  • 忘记估计 p:始终检查 p 是已知的还是需要从数据中估计。如果被估计,记得自由度要额外减 1。

  • Incorrect tail probability: For the last class “X ≥ r”, the probability is (1 − p̂)ʳ⁻¹, not 1 − P(X ≤ r − 1) computed incorrectly. Both give the same answer, but the direct formula is simpler.

  • 尾部概率计算错误:对于最后一个类别“X ≥ r”,概率为 (1 − p̂)ʳ⁻¹,而非错误地计算 1 − P(X ≤ r − 1)。两者结果相同,但直接公式更简单。

  • Not pooling when needed: If any expected frequency is below 5, you must combine categories. Leaving small expected frequencies invalidates the chi-squared approximation.

  • 需要合并却不合并:如果有任何一个期望频数低于 5,你必须合并类别。保留小期望频数会使卡方近似失效。

  • Wrong degrees of freedom: The most common error is using df = m − 1 instead of df = m − 2 when p is estimated. Always ask: “How many parameters did I estimate?”

  • 自由度错误:最常见的错误是在估计了 p 的情况下使用了 df = m − 1 而非 df = m − 2。始终问自己:“我估计了多少个参数?”

  • Using expected frequency instead of probability: When calculating expected frequencies, make sure you multiply the probability by the total sample size n. Forgetting the factor of n is a fatal error.

  • 误用期望频数而不是概率:在计算期望频数时,确保将概率乘以总样本量 n。忘记乘以 n 是一个致命错误。


12. Summary and Exam Tips | 总结与考试技巧

The goodness of fit test for the geometric distribution follows a systematic procedure. First, estimate p from the sample mean. Second, calculate expected frequencies using the geometric probability formula and the tail probability for the final class. Third, pool any classes with expected frequency below 5. Fourth, compute the chi-squared statistic. Fifth, determine the degrees of freedom as m − 2 (when p is estimated). Finally, compare with the critical value and write a conclusion in the context of the question.

几何分布的拟合优度检验遵循系统化的步骤。首先,从样本均值估计 p。其次,使用几何概率公式和尾类概率计算期望频数。第三,合并任何期望频数低于 5 的类别。第四,计算卡方统计量。第五,确定自由度为 m − 2(当 p 被估计时)。最后,与临界值比较并在题目语境中写出结论。

In the exam, always show your hypotheses, your estimated parameter, the expected frequency table, and your conclusion with reference to the significance level. Marks are awarded for each of these stages, so even if you make an arithmetic slip earlier, you can still earn credit for the correct method and structure.

在考试中,始终写出假设、估计的参数、期望频数表,以及参考显著性水平的结论。每个阶段都有相应分值,因此即使你在之前的计算中出现失误,只要方法和结构正确,仍然可以获得分数。

Remember that failing to reject H₀ does not prove that the geometric distribution is correct — it merely means that there is not enough evidence against it. This subtlety is important for full marks in interpretation questions.

请记住:无法拒绝 H₀ 并不证明几何分布是正确的——它仅仅意味着没有足够的证据否定它。这一点细微差别对于在解释类题目中获得满分至关重要。

Published by TutorHao | Further Mathematics Revision Series | aleveler.com

更多咨询请联系16621398022(同微信)

Comments

屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from aleveler.com

Subscribe now to keep reading and get access to the full archive.

Continue reading