# 几何分布

几何分布是一种离散概率分布，用于刻画独立试验序列中直到首次成功所需的等待时间，其中每次试验只有两种可能结果，且成功概率 p 固定<sup>[1](https://www.britannica.com/topic/geometric-distribution)</sup>。它是唯一具有无记忆性的离散分布，也是指数分布的离散对应物<sup>[2](https://mathworld.wolfram.com/GeometricDistribution.html)</sup>。

| 关键事实 | 详情 |
|---|---|
| 定义 | 成功概率 p 恒定的独立伯努利试验中首次成功所在的试验序号；三个条件：两种结果、独立性、p 恒定<sup>[3](https://online.stat.psu.edu/stat414/book/export/html/679)</sup> |
| 两种约定 | N = 首次成功所在的试验序号，取值于 {1, 2, …}；或 M = N − 1 = 首次成功前的失败次数，取值于 {0, 1, …}<sup>[4](https://stats.libretexts.org/Bookshelves/Probability_Theory/Probability_Mathematical_Statistics_and_Stochastic_Processes_(Siegrist)/11%3A_Bernoulli_Trials/11.03%3A_The_Geometric_Distribution)</sup> |
| 概率质量函数与尾概率 | 对 k ≥ 1，f(k) = (1−p)^(k−1) p；P(N > n) = (1−p)^n<sup>[5](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.geom.html)</sup><sup> • </sup><sup>[4](https://stats.libretexts.org/Bookshelves/Probability_Theory/Probability_Mathematical_Statistics_and_Stochastic_Processes_(Siegrist)/11%3A_Bernoulli_Trials/11.03%3A_The_Geometric_Distribution)</sup> |
| 均值与方差 | E(N) = 1/p，var(N) = (1−p)/p²；对于失败次数约定，E(M) = (1−p)/p，方差相同<sup>[4](https://stats.libretexts.org/Bookshelves/Probability_Theory/Probability_Mathematical_Statistics_and_Stochastic_Processes_(Siegrist)/11%3A_Bernoulli_Trials/11.03%3A_The_Geometric_Distribution)</sup> |
| 无记忆性 | P(N > n + m \| N > m) = P(N > n)；几何分布是唯一的离散无记忆分布<sup>[4](https://stats.libretexts.org/Bookshelves/Probability_Theory/Probability_Mathematical_Statistics_and_Stochastic_Processes_(Siegrist)/11%3A_Bernoulli_Trials/11.03%3A_The_Geometric_Distribution)</sup><sup> • </sup><sup>[2](https://mathworld.wolfram.com/GeometricDistribution.html)</sup> |
| 与负二项分布的联系 | geometric(p) 等于 negative_binomial(1, p)<sup>[6](https://live.boost.org/doc/libs/1_85_0/libs/math/doc/html/math_toolkit/dist_ref/dists/geometric_dist.html)</sup> |
| 软件注意事项 | SciPy 和 NumPy 计数的是试验次数；MATLAB 和 TensorFlow Probability 计数的是失败次数；Boost.Math 将失败次数作为连续参数使用<sup>[5](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.geom.html)</sup><sup> • </sup><sup>[7](https://uk.mathworks.com/help/stats/geometric-distribution.html)</sup><sup> • </sup><sup>[8](https://www.tensorflow.org/probability/api_docs/python/tfp/distributions/Geometric)</sup><sup> • </sup><sup>[9](https://www.boost.org/doc/libs/latest/libs/math/doc/html/math_toolkit/stat_tut/weg/geometric_eg.html)</sup> |

## 定义与参数化

设 N = min{n ∈ ℕ₊ : Xₙ = 1}，即伯努利序列中首次成功所在的试验序号；并设 M = N − 1，即首次成功前的失败次数。N 的分布是正整数上的几何分布，M 的分布是非负整数上的几何分布；“几何分布”一词对两者均可使用<sup>[4](https://stats.libretexts.org/Bookshelves/Probability_Theory/Probability_Mathematical_Statistics_and_Stochastic_Processes_(Siegrist)/11%3A_Bernoulli_Trials/11.03%3A_The_Geometric_Distribution)</sup>。不同作者所指的约定不尽相同；MathWorld 举出 Beyer（1987）和 Zwillinger（2003）作为参数化方式不同的例子<sup>[2](https://mathworld.wolfram.com/GeometricDistribution.html)</sup>。

该分布适用于以下三个条件同时成立的情形：每次试验有两种可能结果，各次试验相互独立，成功概率 p 在每次试验中保持不变<sup>[3](https://online.stat.psu.edu/stat414/book/export/html/679)</sup>。在试验次数约定下，概率质量函数为

\[ P(N = k) = (1-p)^{k-1} p, \quad k = 1, 2, 3, \ldots \]

其中 0 < p ≤ 1<sup>[5](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.geom.html)</sup>。尾概率可由独立性直接推出：前 n 次试验全部失败，故 P(N > n) = (1−p)^n，累积分布函数为 F(n) = 1 − (1−p)^n<sup>[4](https://stats.libretexts.org/Bookshelves/Probability_Theory/Probability_Mathematical_Statistics_and_Stochastic_Processes_(Siegrist)/11%3A_Bernoulli_Trials/11.03%3A_The_Geometric_Distribution)</sup>。两种约定相差一个平移：M = N − 1，因此软件中的位置参数可在两者之间转换（SciPy 的 geom.pmf(k, p, loc) 等于 geom.pmf(k − loc, p)）<sup>[5](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.geom.html)</sup>。

名称来自概率本身：各值 (1−p)^(k−1) p 构成一个和为 1 的几何级数<sup>[10](https://scisim.org/sims/statistics/23_geometric)</sup>。

## 性质

对于“直到成功所需试验次数”变量 N，均值为 E(N) = 1/p，方差为 var(N) = (1−p)/p²；对于失败次数变量 M，E(M) = (1−p)/p，方差相同<sup>[4](https://stats.libretexts.org/Bookshelves/Probability_Theory/Probability_Mathematical_Statistics_and_Stochastic_Processes_(Siegrist)/11%3A_Bernoulli_Trials/11.03%3A_The_Geometric_Distribution)</sup>。SciPy 的文档在其试验次数约定下给出偏度 γ₁ = (2−p)/√(1−p)，峰度 γ₂ = (p² − 6p + 6)/(1−p)<sup>[11](https://docs.scipy.org/doc/scipy/tutorial/stats/discrete_geom.html)</sup>。

N 的概率生成函数为

\[ P(t) = pt / (1 − (1−p)t), \quad |t| < 1/(1−p) \]

<sup>[4](https://stats.libretexts.org/Bookshelves/Probability_Theory/Probability_Mathematical_Statistics_and_Stochastic_Processes_(Siegrist)/11%3A_Bernoulli_Trials/11.03%3A_The_Geometric_Distribution)</sup>。在 SciPy 的约定下，逆累积分布函数为 G(q; p) = ceil(log(1−q)/log(1−p))<sup>[11](https://docs.scipy.org/doc/scipy/tutorial/stats/discrete_geom.html)</sup>。

## 无记忆性

其定义性性质是：已经等待的时间对将要等待的时间不提供任何信息：

\[ P(N > n + m \mid N > m) = P(N > n) \]

换言之，在给定 N > m 的条件下，N − m 的条件分布与 N 的分布相同<sup>[4](https://stats.libretexts.org/Bookshelves/Probability_Theory/Probability_Mathematical_Statistics_and_Stochastic_Processes_(Siegrist)/11%3A_Bernoulli_Trials/11.03%3A_The_Geometric_Distribution)</sup>。若到第 m 次试验时首次成功尚未出现，则剩余所需试验次数的分布与一个全新序列相同<sup>[12](https://www.randomservices.org/random/bernoulli/Geometric.html)</sup>。该性质来自建模假设：每次试验独立且成功概率固定，因此一次失败既不会提高也不会降低下一次试验成功的概率<sup>[1](https://www.britannica.com/topic/geometric-distribution)</sup>。

几何分布是唯一的离散无记忆分布<sup>[2](https://mathworld.wolfram.com/GeometricDistribution.html)</sup>。《应用概率杂志》上的一项刻画结果表明，该性质甚至可以替换为条件方差为常数：非负整数上条件方差恒定的分布必为几何分布<sup>[13](https://www.cambridge.org/core/journals/journal-of-applied-probability/article/abs/characterization-of-the-geometric-distribution/CD4376651482B3A85C99E043AA8B039B)</sup>。

**赌徒谬误与真正的无记忆性。** 由于伯努利试验没有记忆，任何基于对过去结果之观察的下注策略——例如在轮盘赌或掷骰子中——都不可能对赌徒有所帮助<sup>[4](https://stats.libretexts.org/Bookshelves/Probability_Theory/Probability_Mathematical_Statistics_and_Stochastic_Processes_(Siegrist)/11%3A_Bernoulli_Trials/11.03%3A_The_Geometric_Distribution)</sup>。同样的逻辑在应用中也指向另一面：模型假定 p 恒定，因此无法表示学习效应。OpenStax 给出的例子是一名棒球击球手，在几何模型下，他此前十次失败与下一次击球成功的概率无关；如果过去的击球确实会改变概率，则该模型不适用<sup>[14](https://stats.libretexts.org/Bookshelves/Introductory_Statistics/Introductory_Statistics_2e_(OpenStax)/04%3A_Discrete_Random_Variables/4.05%3A_Geometric_Distribution)</sup>。

## 数值示例

均值 1/p 决定了实际尺度。当 p = 0.8 时，期望等待为 1/0.8 = 1.25 次试验；当 p = 0.1 时，为 1/0.1 = 10 次试验<sup>[15](https://stats.libretexts.org/Bookshelves/Introductory_Statistics/Introduction_to_Statistics_4e_(Diez_et_al.)/04%3A_Distributions_of_Random_Variables/4.02%3A_Geometric_Distribution)</sup>。随着 p 减小，均值增大，右尾拉长：当 p = 0.05 时，均值升至 20，尾部明显很长<sup>[10](https://scisim.org/sims/statistics/23_geometric)</sup>。

尾概率按每次试验 (1−p) 的速率几何衰减。一个质量控制方面的实例计算中，p = 0.02，估计需要联系多少客户才能找到一位产品有缺陷者，得到的 99% 分位数约为 228<sup>[9](https://www.boost.org/doc/libs/latest/libs/math/doc/html/math_toolkit/stat_tut/weg/geometric_eg.html)</sup>。

## 与其他分布的关系

**负二项分布。** 几何分布是负二项分布的一个特例，即计数直到首次成功所需试验次数的情况<sup>[3](https://online.stat.psu.edu/stat414/book/export/html/679)</sup>。Boost.Math 直接给出这一恒等式：geometric(p) 等于 negative_binomial(1, p)<sup>[6](https://live.boost.org/doc/libs/1_85_0/libs/math/doc/html/math_toolkit/dist_ref/dists/geometric_dist.html)</sup>。斯坦福概率编程笔记同样指出，当 r = 1 时，计数直到出现 r 次正面所需抛币次数的负二项分布与几何分布完全相同<sup>[16](https://probabilitycoders.stanford.edu/win26/more_discrete)</sup>。

**指数分布。** 几何分布是指数分布的离散对应物：指数分布建模连续时间中事件发生前经过的时间，而几何分布建模离散时间中的等待<sup>[17](https://www.statlect.com/probability-distributions/geometric-distribution)</sup>。这一联系是定量的。若 n → ∞ 且 n·pₙ → r > 0，则缩放变量 Uₙ/n 收敛到速率为 r 的指数分布；该指数分布的均值为 1/r，方差为 1/r²，与几何分布的均值 1/p 和方差 (1−p)/p² 相对应<sup>[4](https://stats.libretexts.org/Bookshelves/Probability_Theory/Probability_Mathematical_Statistics_and_Stochastic_Processes_(Siegrist)/11%3A_Bernoulli_Trials/11.03%3A_The_Geometric_Distribution)</sup>。

## 估计与推断

将基于几何分布的模型拟合到计数数据是一个活跃的研究领域。一项关于零一膨胀几何分布的研究采用了最大似然、EM 算法和贝叶斯估计，并通过模拟加以验证；将其应用于 1994 年底特律交通事故死亡数据集时，膨胀模型比替代模型拟合得更好<sup>[18](https://xuebao.sues.edu.cn/en/article/doi/10.12299/jsues.23-0213)</sup>。

近期的扩展为含有过多零值的数据增加了结构。2025 年，研究者提出了零膨胀变换几何（ZITG）分布，推导了其矩生成函数，并研究了可靠性与精算性质，还通过模拟在三个经验数据集上评估了若干估计策略<sup>[19](https://link.springer.com/article/10.1007/s10985-025-09683-w)</sup>。同样在 2025 年，有人提出了零膨胀右删失几何回归（ZIRCGeR）模型，用于含大量零值的计数数据，其中包括一种区分结构零与随机零的新检验，在大多数模拟情形下其第一类错误控制优于 Wald 检验、似然比检验和得分检验<sup>[20](https://ideas.repec.org/a/spr/stpapr/v66y2025i7d10.1007_s00362-025-01771-1.html)</sup>。

## 应用

经典的教科书例子会问：系统在失效前能运行多少次，射击多少次才能命中目标，民调抽样多少次才能找到某一政党的选民，以及数据包在成功到达目的地之前需要重传多少次<sup>[21](https://courses.cs.washington.edu/courses/cse312/24wi/files/Berkeley-notes/Berkeley6-n19.pdf)</sup>。

Boost 的实例展示了质量检验和客户联系规划中的模式：在 2% 的缺陷率下，p = 0.02 的几何分布给出了在找到一位产品有缺陷的客户之前需要联系的客户数的 80%、95% 和 99% 置信分位数<sup>[9](https://www.boost.org/doc/libs/latest/libs/math/doc/html/math_toolkit/stat_tut/weg/geometric_eg.html)</sup>。其他被引用的应用领域包括可靠性（直到失效的试验次数）、排队论和密码学（哈希尝试次数）<sup>[10](https://scisim.org/sims/statistics/23_geometric)</sup>。

该分布还可用作计数模型的构件。近期工作将整数值自回归模型建立在零膨胀几何分布 ZiGeom(φ, λ₁+λ) 之上，其混合参数 φ ∈ (0,1) 控制零膨胀或零缩减；对于这一新息，E(ε) = (1−φ)λ，Var(ε) = (1−φ)λ((1+φ)λ+1)<sup>[22](https://pmc.ncbi.nlm.nih.gov/articles/PMC12035957/)</sup>。

## 软件实现

各库对支撑集约定并不一致<sup>[5](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.geom.html)</sup><sup> • </sup><sup>[7](https://uk.mathworks.com/help/stats/geometric-distribution.html)</sup>。

- **SciPy**（Python）采用“直到首次成功所需试验次数”的约定，概率质量函数为 f(k) = (1−p)^(k−1) p（k ≥ 1），并提供 loc 平移，使得 geom.pmf(k, loc) 等于 geom.pmf(k − loc, p)<sup>[5](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.geom.html)</sup>。
- **NumPy** 的 Generator.geometric 同样抽取成功所需试验次数，支撑集为正整数<sup>[23](https://numpy.org/doc/stable/reference/random/generated/numpy.random.Generator.geometric.html)</sup>。
- **MATLAB** 采用相反的约定：一次成功之前的失败次数，概率质量函数为 f(x|p) = p(1−p)^x（x = 0, 1, 2, …），累积分布函数 F(x|p) = 1 − (1−p)^(x+1)，均值 (1−p)/p，方差 (1−p)/p²。它提供 geocdf、geopdf、geoinv、geostat 和 geornd，以及包括以 'Geometric' 为名称的 mle 在内的通用函数<sup>[7](https://uk.mathworks.com/help/stats/geometric-distribution.html)</sup>。
- **TensorFlow Probability** 以 p 参数化 Geometric，概率质量函数为 pmf(k; p) = (1−p)^k · p，计数的是首次成功之前的失败试验次数 k<sup>[8](https://www.tensorflow.org/probability/api_docs/python/tfp/distributions/Geometric)</sup>。
- **Boost.Math**（C++）将几何分布实现为连续函数，使用失败次数作为实数参数，这与 R 的整数约定不同，因此用户可能需要向下取整以获得整数行为<sup>[9](https://www.boost.org/doc/libs/latest/libs/math/doc/html/math_toolkit/stat_tut/weg/geometric_eg.html)</sup>。

## References

1. [Geometric distribution, Britannica](https://www.britannica.com/topic/geometric-distribution)
2. [Geometric Distribution, Wolfram MathWorld](https://mathworld.wolfram.com/GeometricDistribution.html)
3. [Lesson 11: Geometric and Negative Binomial Distributions, Penn State STAT 414](https://online.stat.psu.edu/stat414/book/export/html/679)
4. [11.3: The Geometric Distribution, Siegrist, LibreTexts](https://stats.libretexts.org/Bookshelves/Probability_Theory/Probability_Mathematical_Statistics_and_Stochastic_Processes_(Siegrist)/11%3A_Bernoulli_Trials/11.03%3A_The_Geometric_Distribution)
5. [scipy.stats.geom, SciPy v1.18.0 Manual](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.geom.html)
6. [geometric_distribution, Boost C++ Libraries 1.85.0](https://live.boost.org/doc/libs/1_85_0/libs/math/doc/html/math_toolkit/dist_ref/dists/geometric_dist.html)
7. [Geometric Distribution, MATLAB & Simulink, MathWorks](https://uk.mathworks.com/help/stats/geometric-distribution.html)
8. [tfp.distributions.Geometric, TensorFlow Probability](https://www.tensorflow.org/probability/api_docs/python/tfp/distributions/Geometric)
9. [Geometric Distribution Examples, Boost.Math documentation](https://www.boost.org/doc/libs/latest/libs/math/doc/html/math_toolkit/stat_tut/weg/geometric_eg.html)
10. [Geometric Distribution, SciSim interactive simulation](https://scisim.org/sims/statistics/23_geometric)
11. [Geometric Distribution tutorial, SciPy v1.18.0 Manual](https://docs.scipy.org/doc/scipy/tutorial/stats/discrete_geom.html)
12. [The Geometric Distribution, Random Services (Siegrist)](https://www.randomservices.org/random/bernoulli/Geometric.html)
13. [A characterization of the geometric distribution, Journal of Applied Probability](https://www.cambridge.org/core/journals/journal-of-applied-probability/article/abs/characterization-of-the-geometric-distribution/CD4376651482B3A85C99E043AA8B039B)
14. [4.5: Geometric Distribution, OpenStax Introductory Statistics 2e](https://stats.libretexts.org/Bookshelves/Introductory_Statistics/Introductory_Statistics_2e_(OpenStax)/04%3A_Discrete_Random_Variables/4.05%3A_Geometric_Distribution)
15. [4.2: Geometric Distribution, Diez et al., Introduction to Statistics 4e](https://stats.libretexts.org/Bookshelves/Introductory_Statistics/Introduction_to_Statistics_4e_(Diez_et_al.)/04%3A_Distributions_of_Random_Variables/4.02%3A_Geometric_Distribution)
16. [More discrete distributions, Stanford Probability Coders](https://probabilitycoders.stanford.edu/win26/more_discrete)
17. [Geometric distribution, StatLect](https://www.statlect.com/probability-distributions/geometric-distribution)
18. [Statistical analysis and application of zero-and-one-inflated geometric distribution, Journal of Shanghai University of Engineering Science](https://xuebao.sues.edu.cn/en/article/doi/10.12299/jsues.23-0213)
19. [Reliability and estimation of the zero-inflated transmuted geometric distribution, Lifetime Data Analysis (2025)](https://link.springer.com/article/10.1007/s10985-025-09683-w)
20. [Testing inflated zeros and applications in right-censored geometric regression models, Statistical Papers (2025)](https://ideas.repec.org/a/spr/stpapr/v66y2025i7d10.1007_s00362-025-01771-1.html)
21. [CS 70 Note 19: Geometric Distribution, UC Berkeley course notes](https://courses.cs.washington.edu/courses/cse312/24wi/files/Berkeley-notes/Berkeley6-n19.pdf)
22. [A non-linear integer-valued autoregressive model with zero-inflated data series, PMC](https://pmc.ncbi.nlm.nih.gov/articles/PMC12035957/)
23. [numpy.random.Generator.geometric, NumPy v2.5 Manual](https://numpy.org/doc/stable/reference/random/generated/numpy.random.Generator.geometric.html)

---
*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 统计学与概率论 › Probability theory › Probability distributions › Distribution families and classification › Discrete distribution families

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/geometric-distribution

English original: https://www.edgepedia.org/geometric-distribution
