# 二项回归

二项回归是一种广义线性模型，用于结果为二元成功或失败、或在已知试验次数中成功计数的情形，它估计预测变量如何改变成功的概率。单个 0/1 响应被视为伯努利（Bernoulli）抽样，分组数据则视为二项计数 \( Y_i \sim B(n_i, \pi_i) \)；两种表述给出完全相同的似然，因而给出相同的估计与标准误。<sup>[1](https://grodri.github.io/glms/notes/c3s1)</sup> 连接函数把概率与线性预测子 \( x_i'\beta \) 联系起来；logit 是典范选择，probit、互补对数-对数、cauchit 与恒等连接也常用。<sup>[2](https://cran.r-project.org/web/packages/glmbayes/vignettes/Chapter-09.html)</sup> 有分组数据时应优先使用，因为较大的二项计数更接近正态分布，能支撑更有意义的残差诊断与大样本检验。<sup>[3](https://online.stat.psu.edu/stat504/Lesson06)</sup>

| 要点 | 细节 |
|---|---|
| 结果 | 0/1 数据用伯努利，分组计数用二项；似然、估计与标准误完全相同<sup>[1](https://grodri.github.io/glms/notes/c3s1)</sup> |
| 典范连接 | logit，\( \eta = \log(\mu/(1-\mu)) \)；也支持 probit、cloglog、cauchit 与恒等连接<sup>[2](https://cran.r-project.org/web/packages/glmbayes/vignettes/Chapter-09.html)</sup> |
| 拟合 | 通过费希尔（Fisher）得分法做极大似然，等价于迭代重加权最小二乘；\( \widehat{\mathrm{var}}(\hat{\beta}) = (X' \cdot W \cdot X)^{-1} \)<sup>[4](https://grodri.github.io/glms/notes/c3s2)</sup> |
| 拟合优度 | 分组数据下偏差除以其自由度应接近 1；对个体（未分组）数据，偏差不是有效的拟合检验<sup>[4](https://grodri.github.io/glms/notes/c3s2)</sup><sup> • </sup><sup>[5](https://bookdown.org/roback/bookdown-bysh/ch-logreg.html)</sup> |
| 过度离散 | 建模为 \( \mathrm{Var}(y_i) = \phi \cdot m_i \cdot \pi_i (1-\pi_i) \)，\( \phi > 1 \)，由偏差或皮尔逊（Pearson）残差估计<sup>[6](https://dnett.github.io/S510/27GLMbinomialAnnotated.PDF)</sup> |
| 分离 | 似然收敛，而至少有一个系数发散到 \( \pm\infty \)；弗思（Firth）惩罚似然给出有限估计<sup>[7](https://jingshuw.org/materials/stat347_2022/lecture6.pdf)</sup><sup> • </sup><sup>[8](https://doi.org/10.1002/sim.1047)</sup> |

## 工作原理

广义线性模型由 (g, V) 这一对指定：连接函数 g，满足 \( \eta_i = g(\mu_i) = x_i'\beta \)；方差函数 V，满足 \( \mathrm{Var}(Y_i \mid X_i) = \phi \cdot V(\mu_i) \)。对二元回归，logit、probit 与互补对数-对数连接都配 \( V(\mu) = \mu(1-\mu) \)，而 logit 是典范连接。<sup>[9](http://web.stanford.edu/class/stats305b/notes/GLM_I.html)</sup> 每个连接都是某个分布之累积分布函数的反函数：logit 对应标准逻辑斯谛分布，probit 对应标准正态分布，互补对数-对数对应耿贝尔（Gumbel）分布。<sup>[10](https://www.mdpi.com/2073-8994/12/2/221)</sup> cloglog 连接不对称，偏度为固定的负值，当事件概率在零附近迅速上升时，可作风险型（hazard）解释。<sup>[2](https://cran.r-project.org/web/packages/glmbayes/vignettes/Chapter-09.html)</sup>

在 logit 连接下，指数化的系数 \( \exp\{\beta_j\} \) 是优势比，表示在其他变量保持不变时，第 j 个预测子增加一个单位所乘上的成功优势倍数。在 logit 连接下，连续预测子对概率的边际效应为 \( d\pi_i/dx_{ij} = \beta_j \pi_i (1-\pi_i) \)，因此依赖于概率本身；换成其他连接则为 \( \beta_j (g^{-1})'(x_i'\beta) \)，而把系数取指数一般不再给出优势比。<sup>[1](https://grodri.github.io/glms/notes/c3s1)</sup> 用普通最小二乘估计的线性概率模型是另一种选择，但它效率低，因为其残差异方差、拟合概率无界，这正是 logit 与 probit 连接的动因。<sup>[11](https://ycroissant.github.io/micsr_book/chapters/binomial.html)</sup>

## 如何计算

对分组数据，二项对数似然为 \( \ell(\beta \mid y) = \sum [ y_i x_i'\beta - m_i \log(1 + \exp\{x_i'\beta\}) ] + \text{常数} \)，其中常数汇集二项系数，用费希尔得分法对 \( \beta \) 极大化。<sup>[6](https://dnett.github.io/S510/27GLMbinomialAnnotated.PDF)</sup> 对典范 logit 连接，费希尔得分法与牛顿-拉弗森法、迭代重加权最小二乘法三者一致：每轮迭代以权重 \( w_{ii} = \hat{\mu}_i(n_i - \hat{\mu}_i)/n_i \) 将工作因变量 \( z_i = \hat{\eta}_i + (y_i - \hat{\mu}_i)/(\hat{\mu}_i(n_i - \hat{\mu}_i)) \cdot n_i \) 对协变量回归，得到 \( \hat{\beta} = (X' \cdot W \cdot X)^{-1} X' \cdot W \cdot z \)。<sup>[4](https://grodri.github.io/glms/notes/c3s2)</sup>

偏差 \( D = 2\sum\{ y_i \log(y_i/\hat{\mu}_i) + (n_i - y_i)\log((n_i - y_i)/(n_i - \hat{\mu}_i)) \} \) 是相对于饱和模型的似然比统计量。对分组数据，它收敛到自由度为 \( n - p \) 的卡方分布，因此拟合良好的模型其残差偏差应大致等于残差自由度；对个体数据，它的分布不是卡方，不能用作拟合优度检验。<sup>[4](https://grodri.github.io/glms/notes/c3s2)</sup><sup> • </sup><sup>[5](https://bookdown.org/roback/bookdown-bysh/ch-logreg.html)</sup> 皮尔逊统计量比偏差更快收敛到 \( \chi^2 \)，所以在总观测数不大时表现更好；而当某些格子的期望计数不超过 5 时，偏差给出的 p 值更可靠。<sup>[7](https://jingshuw.org/materials/stat347_2022/lecture6.pdf)</sup> 粗略的过度离散筛查是把两种统计量之一除以其自由度，结果应接近 1。<sup>[12](https://support.sas.com/kb/22/630.html)</sup> 适用于稀疏数据的检验包括斯图克尔（Stukel）检验、奥修斯-罗耶克（Osius-Rojek）检验、奥姆（Orme）信息矩阵检验、科帕斯（Copas）未加权残差平方和检验与施皮格尔哈尔特（Spiegelhalter）检验。<sup>[12](https://support.sas.com/kb/22/630.html)</sup> 软件接受把分组结果写成成功与失败两列的矩阵，或写成比例加权重。<sup>[13](https://cran.r-project.org/web/packages/rstanarm/vignettes/binomial.html)</sup>

## 起源

约瑟夫·伯克森（Joseph Berkson）于 1944 年在《美国统计学会会刊》（Journal of the American Statistical Association）上把逻辑斯谛函数用于生物检定。<sup>[14](https://doi.org/10.1080/01621459.1944.10500699)</sup> probit 方法在 D. J. 芬尼（D. J. Finney）的专著《Probit 分析》（Probit Analysis）中得到系统整理，该书的记录于 1948 年见于《生物计量学》（Biometrika）。<sup>[15](https://doi.org/10.2307/2332364)</sup> J. A. 内尔德（J. A. Nelder）与 R. W. M. 韦德伯恩（R. W. M. Wedderburn）1972 年在《皇家统计学会会刊 A 辑》（Journal of the Royal Statistical Society Series A）的论文提出广义线性模型，把 probit 分析、列联表以及正态、泊松与伽马模型统一到一个用迭代加权最小二乘拟合的框架之下，他们称这一程序是芬尼 probit 分析极大似然法的推广。<sup>[16](https://doi.org/10.2307/2344614)</sup> 韦德伯恩 1974 年在《生物计量学》上关于拟似然函数的论文，把该框架推广到仅由均值与方差指定的模型。<sup>[17](https://doi.org/10.1093/biomet/61.3.439)</sup>

## 变体

标准软件中的二项分布族支持 logit（典范）、probit、cloglog、cauchit 与恒等连接；logit、probit 与 cloglog 在线性预测子上产生对数凹的对数似然，而 cauchit 与恒等连接一般不具备这一性质。<sup>[2](https://cran.r-project.org/web/packages/glmbayes/vignettes/Chapter-09.html)</sup> 为放宽标准连接固定的形状，人们构造了灵活连接：由指数化指数逻辑斯谛分布导出的广义 logit（glogit）连接，可容纳比标准逻辑斯谛更轻或更重尾的对称与非对称响应。<sup>[10](https://www.mdpi.com/2073-8994/12/2/221)</sup>

对过度离散的计数，beta-二项回归模型是标准的随机效应扩展，由威廉斯（Williams）提出。<sup>[18](https://doi.org/10.2307/2347977)</sup> beta-二项模型的“公共 beta”版本等价于固定效应负二项回归模型，在 logit、对数或恒等连接下，效应估计分别是对数优势比、对数相对风险或风险差。<sup>[19](https://journals.sagepub.com/doi/10.1177/2632084321996225)</sup> 由两个 beta-二项成分构成的有限混合，即灵活 beta-二项模型，可同时处理离群值、过多零值与潜在组，并用 Stan 中的哈密顿蒙特卡洛做贝叶斯推断。<sup>[20](https://onlinelibrary.wiley.com/doi/10.1002/sim.9005)</sup> FlexReg R 包为有界离散响应（包括边界值零/一）提供二项、beta-二项与灵活二项型回归的贝叶斯估计。<sup>[21](https://link.springer.com/article/10.1007/s00180-026-01720-y)</sup>

## 应用

生物检定是历史上的应用：伯克森 1944 年的论文把逻辑斯谛函数引入该领域<sup>[14](https://doi.org/10.1080/01621459.1944.10500699)</sup>，剂量-反应建模至今仍是标准做法，例如在肿瘤剂量-反应的例子中用饱和模型检验 logit 剂量项。<sup>[6](https://dnett.github.io/S510/27GLMbinomialAnnotated.PDF)</sup> beta-二项模型可作为二元结果荟萃分析的随机效应逻辑斯谛回归，并且无需连续性校正即可处理零事件研究。<sup>[19](https://journals.sagepub.com/doi/10.1177/2632084321996225)</sup> 带有离群值、过多零值或潜在组的过度离散计数数据，由灵活 beta-二项扩展处理。<sup>[20](https://onlinelibrary.wiley.com/doi/10.1002/sim.9005)</sup> 在暴露-反应分析中，逻辑斯谛回归与泊松回归一起用于二元事件结果。<sup>[22](https://pmc.ncbi.nlm.nih.gov/articles/PMC12706412/)</sup>

## 局限与替代方案

二项方差由均值决定，因此只要同一组内的试验不独立，它就偏小。若伯努利试验之间的两两相关系数为 \( \rho > 0 \)，组计数的方差被放大 \( 1 + (m-1)\rho \) 倍；试验概率的聚集导致 beta-二项分布，其方差为 \( m \cdot p (1-p)(1 + (m-1)\tau^2) \)。<sup>[23](https://www.stat.purdue.edu/~bacraig/notes526/topic7a.pdf)</sup> 皮尔逊统计量或偏差除以自由度后远大于 1，也可能反映离群值、连接函数选错、遗漏项或需要对预测子作变换。<sup>[24](http://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/statug_logistic_sect038.htm)</sup> 拟似然方法假定 \( \mathrm{Var}(y_i) = \phi \cdot m_i \cdot \pi_i(1-\pi_i) \)，其中 \( \phi > 1 \)，由偏差残差或皮尔逊残差估计为 \( \hat{\phi} = \sum d_i^2/(n-p) \) 或 \( \sum r_i^2/(n-p) \)。<sup>[6](https://dnett.github.io/S510/27GLMbinomialAnnotated.PDF)</sup> 缩放协方差矩阵不改变系数估计，只改变其标准误与显著性检验。<sup>[23](https://www.stat.purdue.edu/~bacraig/notes526/topic7a.pdf)</sup><sup> • </sup><sup>[24](http://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/statug_logistic_sect038.htm)</sup> 忽略过度离散会严重低估标准误，使推断产生误导。<sup>[20](https://onlinelibrary.wiley.com/doi/10.1002/sim.9005)</sup>

当似然收敛而至少有一个参数估计发散到 \( \pm\infty \) 时，就发生了分离；它主要影响那些含有若干不平衡、预测力很强的风险因子的样本量较小的情形<sup>[8](https://doi.org/10.1002/sim.1047)</sup>，在完全分离或准完全分离下，拟合概率趋近 0 或 1，极大似然估计不存在。<sup>[7](https://jingshuw.org/materials/stat347_2022/lecture6.pdf)</sup> 弗思的偏倚缩减程序用杰弗里斯（Jeffreys）不变先验对似然施加惩罚，在分离情形下给出有限估计，而轮廓惩罚似然置信区间往往优于沃尔德（Wald）区间<sup>[8](https://doi.org/10.1002/sim.1047)</sup><sup> • </sup><sup>[25](https://doi.org/10.1093/biomet/80.1.27)</sup>；该惩罚估计量在 brglm2 与 logistf 两个 R 包中实现。<sup>[26](https://doi.org/10.1093/biomet/asaa052)</sup> 弗思校正会把预测概率拉向 0.5，因为它惩罚截距，在稀有事件情形下使预测产生偏倚；FLIC 与 FLAC 两种修改使平均预测概率等于观测到的事件率。<sup>[27](https://pmc.ncbi.nlm.nih.gov/articles/PMC6926877/)</sup><sup> • </sup><sup>[28](https://doi.org/10.1002/sim.7273)</sup>

连接函数设定错误会造成明显的偏倚，并增大参数估计与预测概率的均方误差<sup>[10](https://www.mdpi.com/2073-8994/12/2/221)</sup>；拟合模型也可能因线性成分设定错误、协变量函数形式不对或遗漏协变量而失效。<sup>[29](https://ww2.amstat.org/meetings/proceedings/2019/data/assets/pdf/1199666.pdf)</sup> 与带稳健标准误的泊松回归（估计风险比的常用替代方案）相比，在事件率 4.9% 到 95.5% 范围内所做的模拟发现，两个模型在事件率低于 50% 时表现都不错，而在事件率较高时泊松回归的斜率估计偏差增大、相对标准误更高。<sup>[22](https://pmc.ncbi.nlm.nih.gov/articles/PMC12706412/)</sup> 一项预先注册的、基于模拟的 28 种变量选择与推断方法比较发现，在不存在分离时，采用 g 先验的贝叶斯模型平均总体表现最强；而在发生分离时，惩罚似然方法（尤其是 LASSO）给出最稳定的结果。<sup>[30](https://www.pnas.org/doi/abs/10.1073/pnas.2534552123)</sup> 已发表的比较尚未就二项回归与机器学习分类器、或与条件逻辑斯谛回归相比孰优孰劣得出结论。

## References

1. [Logit Models for Binary Data (§3.1), notes by German Rodriguez](https://grodri.github.io/glms/notes/c3s1)
2. [glmbayes vignette Chapter 09: Models for the Binomial family](https://cran.r-project.org/web/packages/glmbayes/vignettes/Chapter-09.html)
3. [STAT 504 Lesson 6: Binary Logistic Regression (Penn State)](https://online.stat.psu.edu/stat504/Lesson06)
4. [Logit Models for Binary Data (§3.2 Estimation and Hypothesis Testing)](https://grodri.github.io/glms/notes/c3s2)
5. [Chapter 6 Logistic Regression, Broadening Your Statistical Horizons (bookdown)](https://bookdown.org/roback/bookdown-bysh/ch-logreg.html)
6. [Statistics 510 lecture notes: A Generalized Linear Model for Binomial Response Data (Dan Nettleton, Iowa State University)](https://dnett.github.io/S510/27GLMbinomialAnnotated.PDF)
7. [STAT347: Generalized Linear Models Lecture 6 (University of Pennsylvania, 2022)](https://jingshuw.org/materials/stat347_2022/lecture6.pdf)
8. [Georg Heinze, Michael Schemper (2002). A solution to the problem of separation in logistic regression. Statistics in Medicine.](https://doi.org/10.1002/sim.1047)
9. [STATS 305B notes, Chapter 4: Generalized linear models (Stanford)](http://web.stanford.edu/class/stats305b/notes/GLM_I.html)
10. [Binomial Regression Models with a Flexible Generalized Logit Link Function (Symmetry, MDPI)](https://www.mdpi.com/2073-8994/12/2/221)
11. [Microeconometrics with R, Chapter 10: Binomial models](https://ycroissant.github.io/micsr_book/chapters/binomial.html)
12. [SAS Note 22630: Assessing fit and overdispersion in categorical generalized linear models](https://support.sas.com/kb/22/630.html)
13. [Estimating Generalized Linear Models for Binary and Binomial Data with rstanarm](https://cran.r-project.org/web/packages/rstanarm/vignettes/binomial.html)
14. [Joseph Berkson (1944). Application of the Logistic Function to Bio-Assay. Journal of the American Statistical Association.](https://doi.org/10.1080/01621459.1944.10500699)
15. [N. L. J. (1948). Review of Probit Analysis, by D. J. Finney (Cambridge University Press, 1947). Biometrika.](https://doi.org/10.2307/2332364)
16. [J. A. Nelder, R. W. M. Wedderburn (1972). Generalized Linear Models. Journal of the Royal Statistical Society Series A (General).](https://doi.org/10.2307/2344614)
17. [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)
18. [D. A. Williams (1982). Extra-Binomial Variation in Logistic Linear Models. Journal of the Royal Statistical Society Series C (Applied Statistics).](https://doi.org/10.2307/2347977)
19. [Beta-binomial models for meta-analysis with binary outcomes (Sage)](https://journals.sagepub.com/doi/10.1177/2632084321996225)
20. [A new regression model for overdispersed binomial data accounting for outliers and an excess of zeros (Statistics in Medicine)](https://onlinelibrary.wiley.com/doi/10.1002/sim.9005)
21. [FlexReg: an R package for fitting a general class of mixture regression models with bounded responses in a Bayesian framework (Computational Statistics)](https://link.springer.com/article/10.1007/s00180-026-01720-y)
22. [A Perspective on the Use of Poisson Versus Logistic Regression in Exposure–Response Analysis (PMC, 2025)](https://pmc.ncbi.nlm.nih.gov/articles/PMC12706412/)
23. [STAT 526 Topic 7a: Modeling a Binomial Response (Purdue University)](https://www.stat.purdue.edu/~bacraig/notes526/topic7a.pdf)
24. [SAS/STAT User's Guide: PROC LOGISTIC, Overdispersion](http://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/statug_logistic_sect038.htm)
25. [DAVID FIRTH (1993). Bias reduction of maximum likelihood estimates. Biometrika.](https://doi.org/10.1093/biomet/80.1.27)
26. [Ioannis Kosmidis, David Firth (2020). Jeffreys-prior penalty, finiteness and shrinkage in binomial-response generalized linear models. Biometrika.](https://doi.org/10.1093/biomet/asaa052)
27. [Bring More Data!, A Good Advice? Removing Separation in Logistic Regression by Increasing Sample Size (PMC, 2019)](https://pmc.ncbi.nlm.nih.gov/articles/PMC6926877/)
28. [Rainer Puhr and colleagues (2017). Firth's logistic regression with rare events: accurate effect estimates and predictions?. Statistics in Medicine.](https://doi.org/10.1002/sim.7273)
29. [An Overview of the Assessment of Logistic Regression Models (ASA 2019 Proceedings)](https://ww2.amstat.org/meetings/proceedings/2019/data/assets/pdf/1199666.pdf)
30. [Comparing variable selection and model averaging methods for logistic regression (PNAS)](https://www.pnas.org/doi/abs/10.1073/pnas.2534552123)

---
*Initially written Sep 29, 2026 · Reviewed: Sep 30, 2026 · Edited: Oct 15, 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/binomial-regression

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