# 负二项回归

负二项回归是一种用于计数结局的回归方法，适用于方差超过均值的情形，它用均值–方差关系取代泊松方差假设，允许方差随均值增长。当计数存在过度离散时，泊松最大似然会产生严重低估的标准误和严重膨胀的 t 统计量。<sup>[1](https://faculty.econ.ucdavis.edu/faculty/cameron/research/CTE01preprint.pdf)</sup> 在生物化学博士的论文发表计数上，普通泊松回归相对于负二项拟合大幅低估了标准误<sup>[2](https://grodri.github.io/glms/notes/overdispersion)</sup>；在一项调查实例中，负二项标准误几乎是泊松标准误的两倍，而泊松还额外标记出虚假的风险因素。<sup>[3](https://www.tqmp.org/RegularArticles/vol19-1/p001/p001.pdf)</sup> 泊松假设对 RNA-seq 计数也过于严格，它预测的变异小于实际观测，由此得到的检验无法控制 I 类错误。<sup>[4](https://doi.org/10.1186/gb-2010-11-10-r106)</sup> 被称为 NB2 的二次型是 R 的 MASS::glm.nb、Stata 的 nbreg 和 SAS 的 PROC GENMOD 的默认形式。<sup>[5](https://casrai.org/guides/negative-binomial-regression-overdispersion)</sup>

| 属性 | 详情 |
|---|---|
| NB2 方差函数 | \( \operatorname{Var}(Y) = \mu + \alpha \cdot \mu^{2} \)；\( \alpha = 0 \) 时退化为泊松<sup>[1](https://faculty.econ.ucdavis.edu/faculty/cameron/research/CTE01preprint.pdf)</sup> |
| 推导 | 泊松–伽马混合；只需混合变量的均值为 1、方差为 \( \alpha \)<sup>[6](https://doi.org/10.2307/3314912)</sup> |
| \( \alpha = 0 \) 的检验 | 似然比统计量参照 \( \chi^{2}_{0} \) 与 \( \chi^{2}_{1} \) 的 50:50 混合分布，即把通常的 p 值减半<sup>[5](https://casrai.org/guides/negative-binomial-regression-overdispersion)</sup> |
| 典型估计的 \( \alpha \) | 实践中约为 0.01 至 4<sup>[7](https://api.pageplace.de/preview/DT0400.9781139005968_A23865716/preview-9781139005968_A23865716.pdf)</sup> |
| 软件默认 | MASS::glm.nb 中的 NB2（形状参数 \( \theta = 1/\alpha \)）、Stata nbreg、SAS GENMOD<sup>[5](https://casrai.org/guides/negative-binomial-regression-overdispersion)</sup>,<sup>[7](https://api.pageplace.de/preview/DT0400.9781139005968_A23865716/preview-9781139005968_A23865716.pdf)</sup> |
| RNA-seq 用途 | edgeR 假设二次均值–方差关系；DESeq 通过局部回归将方差与均值联系起来<sup>[4](https://doi.org/10.1186/gb-2010-11-10-r106)</sup> |
| 样本量 | 最大似然离散度估计在 \( n \geq 100 \) 时准确，但在 \( n = 10 \) 时不可靠<sup>[8](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0000180)</sup> |

## 工作原理

模型从均值为 \( \mu(x) \) 的泊松回归出发，加入乘性的未观测异质性：一个均值为 1、方差为 \( \alpha \) 的正随机变量 \( \nu \) 乘以均值，因此 \( Y \mid \nu, x \sim \text{Poisson}(\nu \cdot \mu(x)) \)。对 \( \nu \) 积分得到边际均值 \( \mu(x) \) 和方差 \( \mu(x) + \alpha \cdot \mu(x)^{2} \)；当 \( \nu \) 服从伽马分布时，\( Y \) 的边际分布为负二项分布。<sup>[6](https://doi.org/10.2307/3314912)</sup> 矩结果并不需要伽马假设：只有混合变量的均值和方差进入其中。<sup>[6](https://doi.org/10.2307/3314912)</sup> 均值结构保持对数线性，\( \log(\mu) = X \cdot \beta \)，偏移量将预测计数转换为率。<sup>[5](https://casrai.org/guides/negative-binomial-regression-overdispersion)</sup>

离散参数 \( \alpha \) 影响标准误，而不影响系数的解释：系数取指数后为发病率比（IRR）。<sup>[5](https://casrai.org/guides/negative-binomial-regression-overdispersion)</sup> 该族通过方差函数推广：NB1 使用 \( \mu + \alpha \cdot \mu \)，NB2 使用 \( \mu + \alpha \cdot \mu^{2} \)，广义形式使用 \( \mu + \alpha \cdot \mu^{p} \) 并估计 \( p \)。<sup>[7](https://api.pageplace.de/preview/DT0400.9781139005968_A23865716/preview-9781139005968_A23865716.pdf)</sup> 在 Negbin2 形式中，均值为 \( \exp(x' \cdot \beta) \)，方差为 \( \exp(x' \cdot \beta) + (\exp(x' \cdot \beta))^{2} \)。<sup>[9](https://cameron.econ.ucdavis.edu/mmabook/transparencies/ct20_count.pdf)</sup>

## 操作方法

常见工作流程是先拟合泊松模型，用偏差离散统计量检查过度离散，若检测到过度离散则改用负二项。<sup>[10](https://stacks.cdc.gov/view/cdc/193760/cdc_193760_DS1.pdf)</sup> 正式检验包括 Cameron–Trivedi 过度离散检验（原假设：条件均值等于条件方差），以及针对过多零的 Vuong 检验，在 R 中分别通过 overdisp 包的 overdisp() 函数和 pscl 包的 vuong() 函数实现。<sup>[11](https://files.eric.ed.gov/fulltext/EJ1311122.pdf)</sup>

检验 \( \alpha = 0 \) 相对于泊松是一个边界问题，因为离散度不能为负：似然比统计量在零处有 0.5 的概率质量，在零以上服从 \( \chi^{2}_{1} \) 分布，因此 p 值减半。<sup>[5](https://casrai.org/guides/negative-binomial-regression-overdispersion)</sup>,<sup>[6](https://doi.org/10.2307/3314912)</sup> 除非样本量或均值非常大，渐近参考分布会大幅高估显著性。<sup>[6](https://doi.org/10.2307/3314912)</sup> \( \alpha \) 可通过最大似然或矩估计来估计<sup>[6](https://doi.org/10.2307/3314912)</sup>，后者由 Breslow 为对数线性超泊松模型开发。<sup>[12](https://doi.org/10.2307/2347661)</sup> 在 R 中，MASS::glm.nb 通过交替迭代两个步骤——给定 \( \theta \) 估计 \( \beta \)，再给定 \( \beta \) 估计 \( \theta \)——来估计形状参数 \( \theta \)<sup>[13](https://zeileis.r-universe.dev/countreg/doc/countreg.pdf)</sup>；R 中使用负二项族的 glm、Stata 的 glm 和 SAS GENMOD 基于 IRLS，通过外部最大似然机制估计 \( \alpha \) 并将其作为常数插入。<sup>[7](https://api.pageplace.de/preview/DT0400.9781139005968_A23865716/preview-9781139005968_A23865716.pdf)</sup>

## 起源

NB2 回归模型与 A. Colin Cameron 和 Pravin K. Trivedi 1986 年发表在《Journal of Applied Econometrics》上的计数数据计量经济模型论文相关，该文涵盖非负整数因变量的设定、估计和检验，并应用于看医生的次数。<sup>[14](https://doi.org/10.1002/jae.3950010104)</sup> Jerald F. Lawless 1987 年发表在《Canadian Journal of Statistics》上的论文系统研究了负二项和混合泊松回归，考察了所得推断的效率和稳健性<sup>[6](https://doi.org/10.2307/3314912)</sup>；Lawless 指出，该模型的最大似然在早期作者的工作中已隐含存在但未充分讨论，且应用先于这些论文。<sup>[6](https://doi.org/10.2307/3314912)</sup> 对数线性模型中离散度的矩估计由 N. E. Breslow 于 1984 年处理<sup>[12](https://doi.org/10.2307/2347661)</sup>，更早的混合泊松回归工作包括 John Hinde 1982 年对对数正态混合的处理，后者比负二项更难处理。<sup>[15](https://doi.org/10.1007/978-1-4612-5771-4_11)</sup> NB1 和 NB2 的名称来自 Cameron 和 Trivedi 1998 年的著作《Regression Analysis of Count Data》。<sup>[16](https://doi.org/10.1017/cbo9780511814365)</sup> 负二项分布本身远早于其回归用途；其作为泊松–伽马混合的推导是经典的。<sup>[7](https://api.pageplace.de/preview/DT0400.9781139005968_A23865716/preview-9781139005968_A23865716.pdf)</sup>

## 变体

NBP 参数化假设伽马方差为 \( \phi \mu^{\alpha} \)，给出 \( \operatorname{Var}(Y) = \mu + \phi \cdot \mu^{\alpha} \)，并包含 NB1（\( \alpha = 1 \)）和 NB2（\( \alpha = 2 \)）。<sup>[17](https://pmc.ncbi.nlm.nih.gov/articles/PMC4365073/)</sup> 在 RNA-seq 数据中，NBP 趋势模型未能完全捕捉离散趋势，这促使了 NBQ 二次趋势模型的提出，后者改善了拟合并避免了用户指定的调优参数。<sup>[17](https://pmc.ncbi.nlm.nih.gov/articles/PMC4365073/)</sup>

零膨胀模型将计数分布与零处的点质量结合<sup>[18](https://doi.org/10.2307/1269547)</sup>；障碍模型将左截断计数成分与零障碍成分结合。<sup>[19](https://doi.org/10.1016/0304-4076%2886%2990002-3)</sup> 它们对零值的假设不同：障碍模型将所有零视为来自二值结构过程，而零膨胀模型允许结构零和抽样零并存。<sup>[3](https://www.tqmp.org/RegularArticles/vol19-1/p001/p001.pdf)</sup> 对于多受试者单细胞数据，负二项混合模型如 NEBULA 将过度离散分解为受试者水平成分 \( \sigma^{2} \) 和细胞水平离散度 \( \phi \)，细胞水平方差为 \( \mu + \mu^{2}/\phi \)。<sup>[20](https://www.nature.com/articles/s42003-021-02146-6)</sup> 对于面板计数数据，存在固定效应和随机效应负二项模型，但固定效应推荐使用带稳健标准误的矩估计量。<sup>[9](https://cameron.econ.ucdavis.edu/mmabook/transparencies/ct20_count.pdf)</sup>

## 应用

在公共卫生监测和流行病学中，针对过度离散伤害监测数据的模拟工作建议在检测到过度离散时使用负二项模型<sup>[10](https://stacks.cdc.gov/view/cdc/193760/cdc_193760_DS1.pdf)</sup>，负二项回归也用于计量经济学。<sup>[14](https://doi.org/10.1002/jae.3950010104)</sup> 在基因组学中，它是 RNA-seq 差异表达的基础：edgeR 假设均值与方差通过二次均值–方差关系相联系，整个实验共享一个比例常数；而 DESeq 的基本思想源自 edgeR，但改为估计依赖于均值的离散度局部回归。<sup>[4](https://doi.org/10.1186/gb-2010-11-10-r106)</sup> 在单细胞 RNA-seq 中，sctransform 使用正则化负二项回归对数据进行归一化。<sup>[21](https://doi.org/10.1186/s13059-019-1874-1)</sup>

## 局限与替代方法

修正过度离散并不能修正偏倚。在一项伤害监测数据的模拟中，NB2 无法消除遗漏混杂因素或错误偏移量带来的偏倚：在错误偏移量下，估计的教学医院系数为 0.60，而真值为 0.06，率比为 1.8 对真值 1.06，尽管偏差离散度从泊松下的 5.71 降至 NB2 下的 1.09；NB2 在那里的优势是标准误大幅增大。<sup>[10](https://stacks.cdc.gov/view/cdc/193760/cdc_193760_DS1.pdf)</sup> 协变量中的测量误差通常使最大似然过度离散估计向上偏倚。<sup>[22](https://ideas.repec.org/a/cuf/journl/y2001v2i1p101-122.html)</sup> 仅过多零就可导致过度离散：一个含 90.25% 零的变量违反了泊松等离散假设。<sup>[3](https://www.tqmp.org/RegularArticles/vol19-1/p001/p001.pdf)</sup> 离散度估计需要足够样本：对于 \( k \leq 1 \) 的数据，\( n = 100 \) 或更多可给出准确且精确的估计，\( n = 30 \) 显示很小的中位偏倚但抽样分布右偏，\( n = 10 \) 不可靠，尤其是均值至多为 1 时。<sup>[8](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0000180)</sup> NB 模型也比等效泊松模型需要更多观测才能可靠收敛，尤其是在有多个预测变量或稀疏计数时。<sup>[5](https://casrai.org/guides/negative-binomial-regression-overdispersion)</sup>

最接近的替代方法准泊松的方差与均值呈线性关系，而负二项的方差为二次关系，这改变了迭代加权最小二乘的权重，可能显著改变估计，如一个港海豹丰度示例所示<sup>[23](https://utstat.utoronto.ca/reid/sta2201s/QUASI-POISSON.pdf)</sup>；准泊松模型仅由其前两阶矩刻画<sup>[24](https://doi.org/10.1093/biomet/61.3.439)</sup>，因此无法进行 AIC 和似然比比较。泊松最大似然只要均值被正确设定就仍然一致，而 NB2 在实践中相对于带稳健标准误的泊松几乎没有效率增益。<sup>[9](https://cameron.econ.ucdavis.edu/mmabook/transparencies/ct20_count.pdf)</sup> 零膨胀 NB 不一定优于普通 NB：即使数据从零膨胀分布模拟，NB 模型对边际处理效应的相对偏倚和均方误差也相似或更小。<sup>[25](https://trialsjournal.biomedcentral.com/articles/10.1186/s13063-023-07648-8)</sup> 2024 年的一项模拟发现泊松–Tweedie 模型的均方误差小于负二项，尤其是在更离散的情形中<sup>[26](https://revistas.unal.edu.co/index.php/estad/article/view/101952)</sup>，抽样实验也未发现对负二项估计量的明确偏好，除非研究者对过度离散的精确形式有信心。<sup>[27](https://onlinelibrary.wiley.com/doi/full/10.1111/obes.12074)</sup> 由于未检测到的零膨胀可能被误认为普通过度离散，建议分析者先拟合负二项模型并评估拟合，再转向零膨胀或障碍模型。<sup>[3](https://www.tqmp.org/RegularArticles/vol19-1/p001/p001.pdf)</sup>,<sup>[11](https://files.eric.ed.gov/fulltext/EJ1311122.pdf)</sup>

## References

1. [Essentials of Count Data Regression (Cameron & Trivedi preprint)](https://faculty.econ.ucdavis.edu/faculty/cameron/research/CTE01preprint.pdf)
2. [Models for Count Data with Overdispersion (German Rodriguez GLM notes)](https://grodri.github.io/glms/notes/overdispersion)
3. [Regression models for count data with excess zeros: A comparison using survey data (The Quantitative Methods for Psychology)](https://www.tqmp.org/RegularArticles/vol19-1/p001/p001.pdf)
4. [Simon Anders, Wolfgang Huber (2010). Differential expression analysis for sequence count data. Genome biology.](https://doi.org/10.1186/gb-2010-11-10-r106)
5. [Negative Binomial Regression: The Overdispersion Fix, NB1 vs. NB2, and a Worked Model Comparison](https://casrai.org/guides/negative-binomial-regression-overdispersion)
6. [Jerald F. Lawless (1987). Negative binomial and mixed Poisson regression. Canadian Journal of Statistics.](https://doi.org/10.2307/3314912)
7. [Negative Binomial Regression, 2nd edition (Hilbe), preview chapter](https://api.pageplace.de/preview/DT0400.9781139005968_A23865716/preview-9781139005968_A23865716.pdf)
8. [Maximum Likelihood Estimation of the Negative Binomial Dispersion Parameter for Highly Overdispersed Data, with Applications to Infectious Diseases](https://journals.plos.org/plosone/article?id=10.1371%2Fjournal.pone.0000180)
9. [20. Count Data (Cameron & Trivedi, Microeconometrics lecture slides)](https://cameron.econ.ucdavis.edu/mmabook/transparencies/ct20_count.pdf)
10. [Regression models for public health surveillance data: a simulation study](https://stacks.cdc.gov/view/cdc/193760/cdc_193760_DS1.pdf)
11. [Count Data Regression Analysis: Concepts, Overdispersion Detection, Zero-inflation Identification, and Applications with R](https://files.eric.ed.gov/fulltext/EJ1311122.pdf)
12. [N. E. Breslow (1984). Extra-Poisson Variation in Log-Linear Models. Journal of the Royal Statistical Society Series C (Applied Statistics).](https://doi.org/10.2307/2347661)
13. [Regression Models for Count Data in R (countreg vignette)](https://zeileis.r-universe.dev/countreg/doc/countreg.pdf)
14. [A. Colin Cameron, Pravin K. Trivedi (1986). Econometric models based on count data. Comparisons and applications of some estimators and tests. Journal of Applied Econometrics.](https://doi.org/10.1002/jae.3950010104)
15. [John Hinde (1982). Compound Poisson Regression Models. Lecture notes in statistics.](https://doi.org/10.1007/978-1-4612-5771-4_11)
16. [A. Colin Cameron, Pravin K. Trivedi (1998). Regression Analysis of Count Data. Cambridge University Press eBooks.](https://doi.org/10.1017/cbo9780511814365)
17. [Goodness-of-Fit Tests and Model Diagnostics for Negative Binomial Regression of RNA Sequencing Data (Di et al., PLOS One)](https://pmc.ncbi.nlm.nih.gov/articles/PMC4365073/)
18. [Diane Lambert (1992). Zero-Inflated Poisson Regression, with an Application to Defects in Manufacturing. Technometrics.](https://doi.org/10.2307/1269547)
19. [Specification and testing of some modified count data models (Journal of Econometrics, 1986)](https://doi.org/10.1016/0304-4076%2886%2990002-3)
20. [NEBULA is a fast negative binomial mixed model for differential or co-expression analysis of large-scale multi-subject single-cell data (Communications Biology)](https://www.nature.com/articles/s42003-021-02146-6)
21. [Christoph Hafemeister, Rahul Satija (2019). Normalization and variance stabilization of single-cell RNA-seq data using regularized negative binomial regression. Genome biology.](https://doi.org/10.1186/s13059-019-1874-1)
22. [Simulation-Based Estimation of the Structural Errors-in-Variables Negative Binomial Regression Model with an Application (Guo & Li, 2001)](https://ideas.repec.org/a/cuf/journl/y2001v2i1p101-122.html)
23. [Quasi-Poisson vs. Negative Binomial Regression: How Should We Model Overdispersed Count Data? (Ver Hoef & Boveng, Ecology)](https://utstat.utoronto.ca/reid/sta2201s/QUASI-POISSON.pdf)
24. [R. W. M. WEDDERBURN (1974). Quasi-likelihood functions, generalized linear models, and the Gauss, Newton method. Biometrika.](https://doi.org/10.1093/biomet/61.3.439)
25. [Evaluation of negative binomial and zero-inflated negative binomial models for the analysis of zero-inflated count data (Trials)](https://trialsjournal.biomedcentral.com/articles/10.1186/s13063-023-07648-8)
26. [Poisson-Tweedie Models for Count Data with Excessive Zeros. Comparison with the Negative Binomial Model (Revista Colombiana de Estadística, 2024)](https://revistas.unal.edu.co/index.php/estad/article/view/101952)
27. [The Relative Performance of Poisson and Negative Binomial Regression Estimators (Oxford Bulletin of Economics and Statistics)](https://onlinelibrary.wiley.com/doi/full/10.1111/obes.12074)

---
*Initially written Sep 29, 2026 · Reviewed: Sep 30, 2026 · Edited: Sep 30, 2026 · Last review: Sep 30, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 统计学与概率论 › Statistical inference, estimation, sampling, and testing › Regression analysis

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/negative-binomial-regression

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