📚 Testing a Poisson Distribution as a Model | 检验泊松分布模型
In applied statistics, we frequently encounter count data, such as the number of emails received per hour or the number of defects on a production line. The Poisson distribution often serves as a natural candidate to model these random events. However, proposing a model is not enough — we must formally test whether the observed pattern is consistent with a Poisson process. This article explains the chi-squared goodness-of-fit test designed specifically for this purpose, a core topic in Edexcel AS Mathematics.
在应用统计中,我们经常遇到计数数据,比如每小时收到的邮件数量或生产线上缺陷的个数。泊松分布常常是模拟这些随机事件的候选模型。然而,仅仅提出模型还不够——我们必须正式检验观察到的模式是否与泊松过程相符。本文专门讲解用于此目的的卡方拟合优度检验,这是Edexcel AS数学的核心主题。
1. Introduction to Model Testing | 模型检验简介
When we claim that a Poisson distribution is a suitable model, we mean that the probability of observing x events in a fixed interval is given by P(X = x) = (e−λ λx) / x!. However, real data will never match this theoretical distribution perfectly. A goodness-of-fit test assesses whether the discrepancies between observed frequencies and the frequencies we would expect under the Poisson model are small enough to be attributed to chance.
当我们声称泊松分布是一个合适的模型时,意味着在固定区间内观察到x个事件的概率由 P(X = x) = (e−λ λx) / x! 给出。然而真实数据永远不会与这个理论分布完全吻合。拟合优度检验评估的是观察到的频数与我们在泊松模型下期望的频数之间的差异是否小到可以归因于随机性。
2. Setting Up Hypotheses | 假设设定
Every statistical test begins with a pair of competing claims. For modelling with the Poisson distribution, the hypotheses are stated as follows:
- H₀: The data follow a Poisson distribution.
- H₁: The data do not follow a Poisson distribution.
The null hypothesis represents the status quo, and we will only reject it if the evidence against it is strong. The test we use is the chi-squared (χ2) goodness-of-fit test.
每个统计检验都始于一对对立的陈述。对于泊松分布的建模,假设陈述如下:
- H₀:数据服从泊松分布。
- H₁:数据不服从泊松分布。
原假设代表现状,只有当反对它的证据足够强时我们才会拒绝它。我们使用的检验是卡方(χ2)拟合优度检验。
3. Estimating the Poisson Parameter λ | 估计泊松参数 λ
Rarely do we know the true rate λ in advance. We therefore estimate it from the sample. Given a frequency distribution where each value x occurs with frequency f, the maximum likelihood (and most convenient) estimator is the sample mean:
λ̂ = (Σ x·f) / Σ f = (Σ x·f) / n
Here, x represents the observed value (e.g., 0, 1, 2, …) and f its frequency. The total number of observations is n.
我们很少能预先知道真实的率参数 λ。因此我们用样本来估计它。给定一个频数分布,其中每个值x的频数为f,极大似然(也是最方便的)估计量就是样本均值:
λ̂ = (Σ x·f) / Σ f = (Σ x·f) / n
这里x代表观测值(例如0, 1, 2, …),f是其频数。总观测次数为n。
4. Calculating Expected Frequencies | 计算期望频数
Once we have λ̂, we compute the probability for each category x using the Poisson probability mass function. The expected frequency for category x is then:
Ex = n × P(X = x) = n × (e−λ̂ λ̂x) / x!
These expected frequencies represent what we would expect to observe if the null hypothesis were true. They should be calculated for all x from 0 up to the maximum observed value, and often for one category beyond for pooling purposes.
一旦求得 λ̂,我们就使用泊松概率质量函数计算每个类别x的概率。类别x的期望频数为:
Ex = n × P(X = x) = n × (e−λ̂ λ̂x) / x!
这些期望频数表示如果原假设成立,我们期望观察到的频数。应该对x从0到最大观测值进行计算,通常还要为合并目的多算一个类别。
5. Combining Categories (Pooling) | 合并类别
The chi-squared approximation is reliable only when all expected frequencies are at least 5. If some categories have Ex < 5, we must pool 5. The usual practice is to combine the tail of the distribution into one category such as "x ≥ k". This ensures the test statistic approximates a χ2 distribution well.
卡方近似仅在所有期望频数至少为5时可靠。如果某些类别的 Ex < 5,我们必须合并相邻类别,直到每个合并组的 E ≥ 5。常见做法是将分布尾部合并为一个“x ≥ k”类别。这样确保检验统计量良好地近似 χ2 分布。
6. Observed and Expected Frequencies Table | 观察频数与期望频数表
Presenting data in a clear table is essential. The columns should include the value x, observed frequency O, and expected frequency E (after pooling). Both the sum of O and the sum of E must equal n. Below is a generic structure:
| x (or pooled category) | Observed O | Expected E |
|---|---|---|
| 0 | O₀ | E₀ |
| 1 | O₁ | E₁ |
| … | … | … |
| ≥ k | Otail | Etail |
| Total | n | n |
以清晰表格呈现数据非常重要。列应包括值x、观察频数 O、以及期望频数 E(合并后)。O的总和与E的总和都必须等于n。上面是一个通用结构。
7. The Chi-Squared Test Statistic | 卡方检验统计量
The test statistic measures the total relative squared deviation between observed and expected frequencies. It is computed as:
χ2 = Σ ((Oi − Ei)2 / Ei)
The summation runs over all pooled categories. A large χ2 value indicates a big discrepancy, casting doubt on the Poisson model. A small value suggests the data fit the model well.
检验统计量衡量观察频数与期望频数之间总的相对平方偏差。计算公式为:
χ2 = Σ ((Oi − Ei)2 / Ei)
求和包括所有合并后的类别。较大的 χ2 值表示很大的差异,让人对泊松模型产生怀疑。较小的值则表明数据拟合得很好。
8. Degrees of Freedom | 自由度
The distribution of the test statistic under H₀ is approximately χ2 with degrees of freedom given by:
ν = (number of pooled categories) − 1 − m
Here, m is the number of parameters that we estimated from the data. For the Poisson model we estimate one parameter, λ, so m = 1 The subtraction of 1 accounts for the constraint Σ O = Σ E = n. If, after pooling, we have k categories, then ν = k − 2 when λ is estimated.
在原假设下,检验统计量的分布近似于 χ2,其自由度为:
ν = (合并后的类别数) − 1 − m
这里m是我们从数据中估计的参数个数。对于泊松模型我们估计了一个参数 λ,因此m = 1。减1是因为存在 Σ O = Σ E = n 的约束。如果合并后有k个类别,那么当 λ 被估计时,ν = k − 2。
9. Rejection Region and Critical Value | 拒绝域与临界值
We conduct the test at a chosen significance level α, commonly 5% (α = 0.05). The critical value χ2α(ν) is obtained from chi-squared distribution tables. The rejection region is the upper tail:
Reject H₀ if χ2 > χ2α(ν)
A calculated χ2 larger than this critical value means the observed differences are too extreme to be explained by randomness alone.
我们在选定的显著性水平 α 下进行检验,通常取5%(α = 0.05)。临界值 χ2α(ν) 从卡方分布表中查得。拒绝域位于上尾:
若 χ2 > χ2α(ν),则拒绝 H₀
计算出的 χ2 大于此临界值,意味着观察到的差异太大,不能仅由随机性解释。
10. Making a Conclusion | 得出结论
The conclusion must be stated in the context of the problem. If χ2 exceeds the critical value, we say: “There is sufficient evidence at the α level to reject H₀; the data do not follow a Poisson distribution.” If χ2 does not exceed the critical value: “There is insufficient evidence to reject H₀; it is plausible that the data follow a Poisson distribution.” We never “accept” H₀ — we simply fail to reject it.
结论必须结合问题背景陈述。如果 χ2 超过临界值,我们说:“在 α 水平下有充分证据拒绝 H₀;数据不服从泊松分布。”如果 χ2 未超过临界值,我们说:“没有充分证据拒绝 H₀;数据服从泊松分布是可信的。”我们从不“接受” H₀——只是未能拒绝它。
11. Conditions and Assumptions | 条件与假设
For the test to be valid we require:
- Observations are independent of each other (e.g., arrivals in non-overlapping intervals are independent).
- The sample size n is reasonably large so that the χ2 approximation holds.
- After pooling, every expected frequency is at least 5.
- The parameter λ has been estimated from the same data, which reduces the degrees of freedom.
Note that the test is approximate — the χ2 distribution is the limiting distribution of the test statistic. Caution is needed when expected frequencies are close to the threshold.
检验有效的条件包括:
- 观测值彼此独立(例如,非重叠区间内的事件独立)。
- 样本量n足够大,使 χ2 近似成立。
- 合并后每个期望频数至少为5。
- 参数 λ 是从同一数据估计的,这会减少自由度。
注意该检验是近似的——χ2 分布是检验统计量的极限分布。当期望频数接近阈值时需要谨慎。
12. Worked Example | 实例解析
A shop records the number of customer arrivals during 100 separate ten-minute intervals. The observed frequencies are:
| Arrivals (x) | 0 | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|---|
| Frequency (O) | 15 | 32 | 28 | 15 | 7 | 3 |
Total observations n = 100. Estimate λ̂:
λ̂ = (0×15 + 1×32 + 2×28 + 3×15 + 4×7 + 5×3) / 100 = 176 / 100 = 1.76
Next, calculate Poisson probabilities for x = 0 to 5 using λ̂ = 1.76. For example, P(X=0) = e−1.76 ≈ 0.1720, P(X=1) = 0.1720 × 1.76 ≈ 0.3027, continuing gives:
ities: 0.1720, 0.3027, 0.2664, 0.1563, 0.0688, 0.0242. Now expected frequencies E = n × P:
E₃ ≈ 15.63, E₄ ≈ 6.88, E₅ ≈ 2.42. Since E₅ < 5, we pool x = 4 and x = 5 into a category “≥4” = 10, and the pooled expected is 6.88 + 2.42 = 9.30. All pooled expectations now exceed 5.
The table after pooling:
| x | Observed O | Expected E |
|---|---|---|
| 0 | 15 | 17.20 |
| 1 | 32 | 30.27 |
| 2 | 28 | 26.64 |
| 3 | 15 | 15.63 |
广告 / Sponsored 培生爱德思计算机科学学生用书教材Pearson Edexcel International GCSE Computer… 计算机 备考教辅 · 正版现货 · 与本文内容相关 查看详情 / View on Taobao参考价 ¥349.0
更多咨询请联系16621398022(同微信) 备考资讯每日更新,关注不错过 考纲变化 · 科目分析 · 学习方法 ![]() 在微信里长按二维码识别关注 或截图后用「扫一扫 → 相册」选择本图 公众号:tutorhao |
