# 负二项分布

负二项分布是定义在非负整数上的离散概率分布，计数的是独立伯努利试验序列中，在固定次数的成功发生之前所出现的失败次数，每次试验的成功概率为 p。在现代统计学中，它作为过离散计数数据的模型同样重要——这类数据的方差大于均值——因为它可以推导为泊松分布的伽马混合。<sup>[1](https://stat.ethz.ch/R-manual/R-devel/library/stats/help/dnbinom.html)</sup>

| 关键事实 | 详情 |
|---|---|
| 试验解释 | 在成功概率为 p 的独立伯努利试验中，第 r 次成功之前的失败次数；等价地，第 k 次成功发生的那次试验。<sup>[1](https://stat.ethz.ch/R-manual/R-devel/library/stats/help/dnbinom.html)</sup><sup> • </sup><sup>[3](https://www.itl.nist.gov/div898/software/dataplot/refman2/ch8/nbpdf.pdf)</sup> |
| 概率质量函数 | 设规模为 n、概率为 p：对 \( x = 0, 1, 2, \ldots \)，\( n > 0 \)，\( 0 < p \le 1 \)，有 \( p(x) = \frac{\Gamma(x+n)}{\Gamma(n)\, x!} \, p^{n} (1-p)^{x} \)。<sup>[1](https://stat.ethz.ch/R-manual/R-devel/library/stats/help/dnbinom.html)</sup> |
| 均值和方差 | \( \mu = n(1-p)/p \) 和 \( \sigma^{2} = n(1-p)/p^{2} \)，因此方差总是大于均值。<sup>[1](https://stat.ethz.ch/R-manual/R-devel/library/stats/help/dnbinom.html)</sup><sup> • </sup><sup>[2](https://docs.scipy.org/doc/scipy/tutorial/stats/discrete_nbinom.html)</sup> |
| 泊松–伽马混合 | 若泊松分布的均值抽取自形状参数为 size、尺度为 (1 − prob)/prob 的伽马分布，则得到负二项分布；这一推导允许 size 为非整数。<sup>[1](https://stat.ethz.ch/R-manual/R-devel/library/stats/help/dnbinom.html)</sup> |
| 均值–离散度形式 | 在 NB2 回归参数化中，方差为 \( \mu(1 + \alpha\mu) \)；泊松模型是 \( \alpha = 0 \) 的特例。<sup>[6](https://www.stata.com/manuals/rnbreg.pdf)</sup> |
| 偏度 | \( \gamma_{1} = (2-p)/\sqrt{n(1-p)} \)，总是正值。<sup>[2](https://docs.scipy.org/doc/scipy/tutorial/stats/discrete_nbinom.html)</sup> |
| 软件 | 密度、累积分布、分位数和随机生成函数在 R（dnbinom、pnbinom、qnbinom、rnbinom）、SciPy（scipy.stats.nbinom）、Stata（nbreg）和 DATAPLOT（NBPDF）中都是标准功能。<sup>[1](https://stat.ethz.ch/R-manual/R-devel/library/stats/help/dnbinom.html)</sup><sup> • </sup><sup>[2](https://docs.scipy.org/doc/scipy/tutorial/stats/discrete_nbinom.html)</sup><sup> • </sup><sup>[3](https://www.itl.nist.gov/div898/software/dataplot/refman2/ch8/nbpdf.pdf)</sup> |

## 同一分布的两种定义

教科书和软件使用两种计数约定，它们给出同一族概率，只是支撑集有平移。在 R 和 SciPy 使用的“成功前失败次数”形式中，随机变量 X 计数的是第 n 次成功之前累积的失败次数，因此 X 取值为 0、1、2 等，质量函数为 \( p(x) = \frac{\Gamma(x+n)}{\Gamma(n)\, x!} p^{n}(1-p)^{x} \)。<sup>[1](https://stat.ethz.ch/R-manual/R-devel/library/stats/help/dnbinom.html)</sup><sup> • </sup><sup>[2](https://docs.scipy.org/doc/scipy/tutorial/stats/discrete_nbinom.html)</sup> 在 NIST DATAPLOT 参考手册使用的“直到成功的试验次数”形式中，变量计数的是第 k 次成功发生的那次试验，质量函数为 \( \binom{x-1}{k-1} p^{k} (1-p)^{x-k} \)，其中 \( x = k, k+1, \ldots \)。<sup>[3](https://www.itl.nist.gov/div898/software/dataplot/refman2/ch8/nbpdf.pdf)</sup> 两者只相差固定的 k 次成功，因此一种约定下引用的均值 \( k(1-p)/p \) 与另一种约定下的 \( r/p \) 描述的是同一个底层过程。<sup>[3](https://www.itl.nist.gov/div898/software/dataplot/refman2/ch8/nbpdf.pdf)</sup>

这个名字来自代数，而非数据中的任何负数量：质量函数中的二项式系数可以用上参数为负的二项式系数 \( \binom{-r}{x} \) 改写，这就是该分布被称为负二项分布的原因。<sup>[2](https://docs.scipy.org/doc/scipy/tutorial/stats/discrete_nbinom.html)</sup>

## 泊松–伽马混合

驱动大多数应用工作的推导把负二项分布视为一个泊松分布，其率本身是随机的。如果泊松均值抽取自伽马分布，则计数的边际分布为负二项分布，伽马形状参数成为规模参数或离散度参数。<sup>[1](https://stat.ethz.ch/R-manual/R-devel/library/stats/help/dnbinom.html)</sup> 这一构造解释了该分布的方差结构。将泊松均值写为 μ、伽马过离散参数写为 γ，该混合的均值为 \( E(Y) = \mu \)，方差为 \( V(Y) = \mu(1 + \gamma) \)，即个体内泊松方差与率在个体间方差之和。<sup>[11](https://link.springer.com/article/10.1186/s40488-014-0019-z)</sup> 当离散度参数无界增长时，伽马混合分布集中，负二项分布趋近于泊松分布。<sup>[6](https://www.stata.com/manuals/rnbreg.pdf)</sup>

由于伽马密度具有闭式，所得混合具有闭式概率质量函数，这相对于其他泊松混合——如对数正态–泊松混合和广义逆高斯–泊松混合，其质量函数更复杂——是一个实际优势。<sup>[14](https://dspace.library.uvic.ca/bitstreams/015b8ce4-bec3-4d6f-8f39-d6e4f856a274/download)</sup> 混合形式还允许规模参数取非整数值，R 文档记录了按均值 μ 和离散度参数 size 的另一种参数化，其中 \( p = n/(n + \mu) \)，这在生态学中很常见。<sup>[1](https://stat.ethz.ch/R-manual/R-devel/library/stats/help/dnbinom.html)</sup>

## 过离散与回归

泊松分布将方差固定为等于均值。真实计数数据经常违反这一约束，这种情况称为过离散，而忽略它的泊松模型会低估标准误，从而可能使预测变量在并不显著时看起来统计显著。<sup>[4](https://esajournals.onlinelibrary.wiley.com/doi/10.1890/10-1831.1)</sup><sup> • </sup><sup>[15](https://www.sciencedirect.com/science/article/pii/S0213911101715993)</sup> 负二项回归通过在泊松回归模型中加入一个反映未解释的受试者间差异的随机项来处理这一问题。<sup>[16](https://pubmed.ncbi.nlm.nih.gov/7501743/)</sup>

**两种方差函数。** 软件实现区分两种参数化。Stata 默认的均值–离散度模型是通过让一个被省略的、服从伽马分布的变量乘以每个观测的泊松均值而导出的，其方差为 \( \mathrm{Var}(y_{j}) = \mu_{j}(1 + \alpha\mu_{j}) \)；这就是卡梅伦和特里维迪（Cameron and Trivedi）的 NB2 模型。常数离散度替代模型假设 \( \mathrm{Var}(y_{j}) = \mu_{j}(1 + \delta) \)，即 NB1 模型。两种情况下，泊松模型都是离散度参数为零的极限情形，而该参数的似然比检验使用边界校正的零分布，即零点处的点质量与 \( \chi^{2}_{1} \) 的 50:50 混合。<sup>[6](https://www.stata.com/manuals/rnbreg.pdf)</sup><sup> • </sup><sup>[7](https://www.stata.com/support/faqs/statistics/nbreg-variance-function/)</sup> statsmodels 库实现了相同的 NB2 方差函数 \( V(\mu) = \mu + \alpha\mu^{2} \)，其中 α 被视为固定的辅助参数。<sup>[17](https://www.statsmodels.org/stable/generated/statsmodels.genmod.families.varfuncs.NegativeBinomial.html)</sup>

**来自混合模型理论的告诫。** 负二项回归模型是一个混合泊松模型，其伽马混合分布是为易处理性而选择的。兰德、麦考尔和纳金（Land, McCall, and Nagin）表明，错误设定混合分布虽然不影响平均率或其回归参数化的最大似然估计量的一致性，但可能夸大回归系数的 t 比率并导致错误推断。<sup>[13](https://journals.sagepub.com/doi/10.1177/0049124196024004001)</sup>

## 在生态学中的应用

生态学计数数据是负二项分布的自然栖息地。个体聚集在偏好的生境中，观测通过空间或时间自相关而相互依赖，零计数大量存在，所有这些都产生大于均值的方差。2022 年的一篇综述认为，在生态学和生物多样性研究中，负二项分布而非泊松分布应作为计数数据的默认起始分布，并指出在 Google Scholar 上搜索 1990 至 2021 年间的“negative binomial”“ecology”和“biodiversity”返回超过 15,900 条结果，而同样词条下“quasi-Poisson”为 2,970 条。<sup>[5](https://www.mdpi.com/1424-2818/14/5/320)</sup>

**建模均值–方差关系。** 林登和曼蒂涅米（Lindén and Mäntyniemi）提出了一种具有两个过离散参数的参数化，将方差写为 \( \sigma^{2} = \omega\mu + \theta\mu^{2} \)，它涵盖准泊松回归的线性关系（θ = 0）和经典负二项回归的二次关系（ω = 1）。他们表明，鸟类迁徙计数中的抽样误差、集群行为和环境变异性都产生可用这种形式描述的均值–方差关系，并将该模型拟合到芬兰（Finland）汉科鸟类观测站（Hanko bird observatory）2007 至 2009 年的林百灵（Woodlark）秋季迁徙计数。<sup>[4](https://esajournals.onlinelibrary.wiley.com/doi/10.1890/10-1831.1)</sup>

**零膨胀。** 当数据集包含的零甚至多于负二项分布所预测时，称为零膨胀，多出的零可能来自真零（物种确实不存在）或来自不完全检测的假零。<sup>[18](https://onlinelibrary.wiley.com/doi/10.1111/j.1461-0248.2005.00826.x)</sup> 零膨胀负二项（ZINB）模型为额外的零增加一个单独过程，而用于估计动物丰度的 N-混合模型使用负二项分布建模站点水平丰度，但零膨胀版本尽管拟合良好，却可能产生不现实的参数估计，应谨慎使用。<sup>[19](https://besjournals.onlinelibrary.wiley.com/doi/10.1111/2041-210X.12333)</sup> 在一项对四种林地鸟类的比较中，负二项分布对噪矿鸟（noisy miner）拟合最好，零膨胀负二项分布对华丽细尾鹩莺（superb fairy-wren）和棕啸鹟（rufous whistler）拟合最好，零膨胀泊松分布对零膨胀最严重的物种褐刺嘴莺（brown thornbill）拟合最好，而标准泊松模型在所有情况下拟合最差。<sup>[18](https://onlinelibrary.wiley.com/doi/10.1111/j.1461-0248.2005.00826.x)</sup>

## 在基因组学中的应用

高通量测序计数数据用负二项模型分析，因为样本间的生物学和技术变异性使基因水平计数相对于泊松分布过离散。DESeq2 包估计测序计数数据中的方差–均值依赖关系，并在负二项模型下检验差异表达，edgeR 使用同一分布。<sup>[8](https://www.bioconductor.org/packages/release/bioc/html/DESeq2.html)</sup><sup> • </sup><sup>[20](https://pmc.ncbi.nlm.nih.gov/articles/PMC7195715/)</sup> 这一假设并非无可置疑：2019 年发表在 PLOS One 上的一项拟合优度研究发现，在若干公开 RNA-Seq 和微生物组数据集中，负二项分布无法良好拟合许多特征，并指出使用现实模拟数据的比较研究发现，基于 NB 的检验 edgeR 和 DESeq2 对错误发现率的控制不佳。<sup>[12](https://doi.org/10.1371/journal.pone.0224909)</sup>

## 历史

该分布的试验计数形式出现在早期概率论文献中：皮埃尔·雷蒙·德·蒙莫尔（Pierre Rémond de Montmort）在其《赌博分析论》（Essay d'analyze sur les jeux de hazard）以及与尼古拉·伯努利（Niklaus Bernoulli）的通信中，于十八世纪初得到了负二项分布。<sup>[21](https://www.probabilityandfinance.com/sheynin/049_hist_stat.pdf)</sup> 它的统计学生涯始于事故和疾病计数。格林伍德和伍兹（Greenwood and Woods）在 1919 年一份关于工业事故的报告中引入了混合泊松分布，而伦敦卫生与热带医学院（London School of Hygiene and Tropical Medicine）的统计学家梅杰·格林伍德（Major Greenwood）和 G. 乌德尼·尤尔（G. Udny Yule）在 1920 年《皇家统计学会杂志》（Journal of the Royal Statistical Society）上关于重复事故和多次疾病发作等多次发生事件的频率分布的论文中发展了这一主题。<sup>[11](https://link.springer.com/article/10.1186/s40488-014-0019-z)</sup><sup> • </sup><sup>[9](https://academic.oup.com/jrsssa/article/83/2/255/7014440)</sup><sup> • </sup><sup>[10](https://onlinelibrary.wiley.com/doi/full/10.1002/sim.6772)</sup> 假设个体事故经历服从泊松分布，且其率服从伽马分布，他们得到了均值为 μ、方差为 μ(1 + γ) 的负二项分布。<sup>[11](https://link.springer.com/article/10.1186/s40488-014-0019-z)</sup> 在 1972 年内尔德和韦德伯恩（Nelder and Wedderburn）的广义线性模型框架使泊松回归成为常规之后，负二项分布的回归形式作为泊松回归的过离散扩展进入主流实践。<sup>[13](https://journals.sagepub.com/doi/10.1177/0049124196024004001)</sup>

## 局限与替代方案

负二项分布只处理过离散：其方差总是大于均值，因此无法建模方差小于均值的欠离散计数，针对此类数据已提出伽马模型或康威–麦克斯韦–泊松（Conway–Maxwell–Poisson）模型。<sup>[22](https://digitalcommons.fiu.edu/nanna/record/10858/files/10858_llau_2015_impact_red_light_cameras.pdf?registerDownload=1&version=1&withMetadata=0&withWatermark=0)</sup><sup> • </sup><sup>[23](https://esajournals.onlinelibrary.wiley.com/doi/10.1890/13-1912.1)</sup> 康威–麦克斯韦–泊松分布在一个族内同时处理欠离散和过离散，并且在违反等离散的生态学数据比较中，按信息准则显著优于泊松分布。<sup>[23](https://esajournals.onlinelibrary.wiley.com/doi/10.1890/13-1912.1)</sup> 对于超出负二项分布所能刻画的极端过离散数据，泊松–特威迪（Poisson–Tweedie）模型提供更广泛的异质性范围。<sup>[5](https://www.mdpi.com/1424-2818/14/5/320)</sup>

## References

1. [The Negative Binomial Distribution, R stats manual](https://stat.ethz.ch/R-manual/R-devel/library/stats/help/dnbinom.html)
2. [Negative Binomial Distribution, SciPy v1.18.0 Manual](https://docs.scipy.org/doc/scipy/tutorial/stats/discrete_nbinom.html)
3. [NBPDF, DATAPLOT Reference Manual, NIST](https://www.itl.nist.gov/div898/software/dataplot/refman2/ch8/nbpdf.pdf)
4. [Lindén, A. and Mäntyniemi, S. (2011). Using the negative binomial distribution to model overdispersion in ecological count data. Ecology 92:1414–1421](https://esajournals.onlinelibrary.wiley.com/doi/10.1890/10-1831.1)
5. [An Overview of Modern Applications of Negative Binomial Modelling in Ecology and Biodiversity, Diversity 14(5):320 (2022)](https://www.mdpi.com/1424-2818/14/5/320)
6. [nbreg — Negative binomial regression, Stata manual](https://www.stata.com/manuals/rnbreg.pdf)
7. [The variance function in nbreg, Stata FAQ](https://www.stata.com/support/faqs/statistics/nbreg-variance-function/)
8. [DESeq2: Differential gene expression analysis based on the negative binomial distribution, Bioconductor](https://www.bioconductor.org/packages/release/bioc/html/DESeq2.html)
9. [Greenwood, M. and Yule, G.U. (1920). An inquiry into the nature of frequency distributions representative of multiple happenings. JRSS 83:255–279](https://academic.oup.com/jrsssa/article/83/2/255/7014440)
10. [Farewell, V. et al. (2016). Major Greenwood (1880–1949): a biographical and bibliographical study. Statistics in Medicine](https://onlinelibrary.wiley.com/doi/full/10.1002/sim.6772)
11. [On the distribution theory of over-dispersion, Journal of Statistical Distributions and Applications (2014)](https://link.springer.com/article/10.1186/s40488-014-0019-z)
12. [Sequence count data are poorly fit by the negative binomial distribution, PLOS One (2019)](https://doi.org/10.1371/journal.pone.0224909)
13. [Land, K.C., McCall, P.L., Nagin, D.S. (1996). A Comparison of Poisson, Negative Binomial, and Semiparametric Mixed Poisson Regression Models. Sociological Methods & Research 24(4)](https://journals.sagepub.com/doi/10.1177/0049124196024004001)
14. [Gamma-mixed Poisson models and the closed form of the negative binomial mass function, UVic thesis](https://dspace.library.uvic.ca/bitstreams/015b8ce4-bec3-4d6f-8f39-d6e4f856a274/download)
15. [La distribución binomial negativa frente a la de Poisson en el análisis de fenómenos recurrentes, Gaceta Sanitaria](https://www.sciencedirect.com/science/article/pii/S0213911101715993)
16. [Regression analyses of counts and rates: Poisson, overdispersed Poisson, and negative binomial models, PubMed](https://pubmed.ncbi.nlm.nih.gov/7501743/)
17. [statsmodels.genmod.families.varfuncs.NegativeBinomial, statsmodels 0.15.0 documentation](https://www.statsmodels.org/stable/generated/statsmodels.genmod.families.varfuncs.NegativeBinomial.html)
18. [Martin, T.G. et al. (2005). Zero tolerance ecology: improving ecological inference by modelling the source of zero observations. Ecology Letters 8:1235–1246](https://onlinelibrary.wiley.com/doi/10.1111/j.1461-0248.2005.00826.x)
19. [Dénes, F.V. et al. (2015). Estimating abundance of unmarked animal populations. Methods in Ecology and Evolution](https://besjournals.onlinelibrary.wiley.com/doi/10.1111/2041-210X.12333)
20. [Negative binomial additive model for RNA-Seq data analysis, PMC](https://pmc.ncbi.nlm.nih.gov/articles/PMC7195715/)
21. [Studies in the History of Statistics and Probability (Sheynin), on Montmort and the negative binomial](https://www.probabilityandfinance.com/sheynin/049_hist_stat.pdf)
22. [Impact of red light cameras (FIU dissertation context), on NB limitations for underdispersion](https://digitalcommons.fiu.edu/nanna/record/10858/files/10858_llau_2015_impact_red_light_cameras.pdf?registerDownload=1&version=1&withMetadata=0&withWatermark=0)
23. [Lynch, H.J. et al. (2014). Dealing with under- and over-dispersed count data in life history, spatial, and community ecology. Ecology](https://esajournals.onlinelibrary.wiley.com/doi/10.1890/13-1912.1)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 30, 2026; Oct 15, 2026 · Edited: Sep 30, 2026; 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/negative-binomial-distribution

English original: https://www.edgepedia.org/negative-binomial-distribution
