# 广义线性模型

广义线性模型（generalized linear model，GLM）是一种回归分析框架，其中响应变量服从指数族分布（一类具有共同数学形式的概率分布），如正态分布、二项分布、泊松分布、伽马分布或逆高斯分布，通过连接函数与解释变量的线性组合相关联。该框架由约翰·A·内尔德（John A. Nelder）和罗伯特·W·M·韦德伯恩（Robert W. M. Wedderburn）在1972年发表于《皇家统计学会杂志A辑》的论文中提出，将普通线性回归、逻辑回归、概率单位分析、列联表的对数线性模型以及伽马方差分量模型统一为同一拟合过程的特例。<sup>[1](https://academic.oup.com/jrsssa/article/135/3/370/7110572)</sup>

| 关键事实 | 详情 |
|---|---|
| 起源 | 内尔德与韦德伯恩，“广义线性模型”，《皇家统计学会杂志A辑》135(3)，第370–384页，1972年5月；两位作者均任职于罗瑟姆斯特德实验站<sup>[1](https://academic.oup.com/jrsssa/article/135/3/370/7110572)</sup> |
| 三个组成部分 | 来自指数族的响应分布、将均值\( \mu \)与线性预测子\( \mathbf{X}\beta \)通过\( g(\mu) = \mathbf{X}\beta \)相关联的连接函数\( g \)，以及方差函数<sup>[2](https://online.stat.psu.edu/stat462/node/211/)</sup> |
| 拟合算法 | 迭代重加权最小二乘法（iteratively reweighted least squares，IWLS），亦称迭代加权线性回归，可得到最大似然估计<sup>[1](https://academic.oup.com/jrsssa/article/135/3/370/7110572)</sup><sup> • </sup><sup>[3](https://stat.ethz.ch/R-manual/R-devel/library/stats/help/glm.html)</sup> |
| R中的标准分布族 | binomial（logit）、gaussian（identity）、Gamma（inverse）、inverse.gaussian（1/mu^2）、poisson（log），以及准变体<sup>[4](https://stat.ethz.ch/R-manual/R-devel/library/stats/html/family.html)</sup> |
| 经典参考书 | P. 麦卡拉（P. McCullagh）与J. A. 内尔德，《广义线性模型》，查普曼与霍尔出版社，1983年；第二版1989年<sup>[5](https://books.google.com/books?id=OUitAQAACAAJ)</sup> |
| 关键统计量 | 偏差：在相差一个常数的意义下，等于负二倍最大化对数似然，其常数选取使饱和模型的偏差为零<sup>[3](https://stat.ethz.ch/R-manual/R-devel/library/stats/help/glm.html)</sup> |
| 扩展 | 广义可加模型（1990年）、广义估计方程（1986年），以及用于相关数据的广义线性混合模型<sup>[6](https://www.researchgate.net/publication/324760213_A_History_of_the_GLIM_Statistical_Package)</sup><sup> • </sup><sup>[7](https://plaza.umin.ac.jp/~ehara/GEE_TEXT2.pdf)</sup> |

## 模型的结构

一个GLM包含三个组成部分。随机成分设定每个观测\( Y_i \)服从指数族中的某个分布，其均值为\( \mu_i \)。系统成分是线性预测子\( \eta_i = \mathbf{X}_i\beta \)，即协变量与系数的线性组合。连接函数\( g \)将二者联系起来：\( g(\mu_i) = \eta_i \)，因此均值为\( \mathrm{E}(Y) = \mu = g^{-1}(\mathbf{X}\beta) \)。<sup>[2](https://online.stat.psu.edu/stat462/node/211/)</sup>

连接函数之所以存在，是因为未经变换的线性预测子可能产生不可能的均值。泊松均值必须严格为正，伯努利均值即概率必须落在\( (0,1) \)内；而线性预测子\( \beta_0 + \beta_1 x_1 + \cdots + \beta_p x_p \)的取值范围为全体实数，因此无法保证在任一尺度上产生合理的期望结果。对计数数据应用对数连接、对二值数据应用logit连接，可将无限制的线性预测子映射到均值的有效范围上。<sup>[8](https://stats.oarc.ucla.edu/wp-content/uploads/2025/03/Generalized_Linear_Model_2025.html)</sup>

常见的连接函数包括恒等连接\( g(\mu) = \mu \)（用于传统线性回归）和logit连接\( g(\mu) = \log(\mu/(1-\mu)) \)，后者给出\( \mu = e^{\mathbf{X}\beta}/(1+e^{\mathbf{X}\beta}) \)。<sup>[2](https://online.stat.psu.edu/stat462/node/211/)</sup>在R的分布族对象中，默认设置为：gaussian族使用恒等连接，binomial族使用logit，poisson族使用对数，Gamma族使用倒数；binomial族还接受probit、cauchit、log、identity和互补对数-对数连接，poisson族接受恒等连接和平方根连接。<sup>[4](https://stat.ethz.ch/R-manual/R-devel/library/stats/html/family.html)</sup>

## 起源与1972年论文

内尔德与韦德伯恩的论文表明，只要观测服从某个指数族分布，且系统效应可通过适当的变换化为线性，迭代加权线性回归技术就能获得参数的最大似然估计。该文还利用对数似然将方差分析推广到这些模型，并以四种分布为例说明了该框架：正态分布、二项分布（含概率单位分析）、泊松分布（列联表）和伽马分布（方差分量）。<sup>[1](https://academic.oup.com/jrsssa/article/135/3/370/7110572)</sup>

这篇论文的影响超越了理论，延伸到了计算领域。内尔德作为皇家统计学会统计计算工作小组的主席，在批处理仍为主流的时代，为GLIM软件包（Generalized Linear Interactive Modeling，广义线性交互建模）选择了交互式设计。GLIM被归为皇家统计学会的财产，其销售收入对该学会的财务贡献颇大。<sup>[9](https://academic.oup.com/jrsssa/article/174/2/499/7077714)</sup>后来一部统计计算史将这篇1972年的论文描述为“震动了”理论统计学和应用统计学的事件，并追溯了从GLM经广义可加模型（哈斯蒂（Hastie）和蒂布希拉尼（Tibshirani），1990年）和离散度建模到GAMLSS（里格比（Rigby）和斯塔西诺普洛斯（Stasinopoulos），2005年）的谱系。<sup>[6](https://www.researchgate.net/publication/324760213_A_History_of_the_GLIM_Statistical_Package)</sup>

该领域的标准专著——芝加哥大学的彼得·麦卡拉与约翰·A·内尔德合著的《广义线性模型》——于1983年问世（261页），1989年更新再版，扩充了对数线性模型、多项响应模型、准似然函数和模型检验等内容。<sup>[5](https://books.google.com/books?id=OUitAQAACAAJ)</sup><sup> • </sup><sup>[10](https://search.worldcat.org/title/12453095)</sup>

## 拟合

GLM通过迭代重加权最小二乘法进行最大似然拟合。每次迭代在连接尺度上求解一个加权最小二乘问题，工作权重和工作残差根据当前拟合值更新，算法迭代至收敛。R的`glm()`函数默认通过其核心例程`glm.fit`使用此方法，并报告所用的IWLS迭代次数。<sup>[3](https://stat.ethz.ch/R-manual/R-devel/library/stats/help/glm.html)</sup>

拟合对象携带GLM推断所特有的量。偏差在相差一个常数的意义下等于负二倍最大化对数似然，该常数的选取使饱和模型的偏差为零；仅含截距的模型的零偏差会一并报告以供比较。残差可以按多种类型提取，包括偏差残差（默认）、皮尔逊残差、工作残差、响应残差和偏残差。<sup>[3](https://stat.ethz.ch/R-manual/R-devel/library/stats/help/glm.html)</sup><sup> • </sup><sup>[11](https://search.r-project.org/R/refmans/stats/html/glm.summaries.html)</sup>对于二项GLM，拟合概率在数值上等于0或1预示着分离问题，这是一个已知的困难，此时最大似然估计可能不存在。<sup>[3](https://stat.ethz.ch/R-manual/R-devel/library/stats/help/glm.html)</sup>

## 分布族与典型应用

指数族的框架使一个拟合引擎能够服务于多种数据类型：<sup>[1](https://academic.oup.com/jrsssa/article/135/3/370/7110572)</sup>

- **二值与二项数据。** 逻辑回归对0/1结果或比例建模；概率单位分析即使用probit连接的二项分布族。<sup>[1](https://academic.oup.com/jrsssa/article/135/3/370/7110572)</sup><sup> • </sup><sup>[4](https://stat.ethz.ch/R-manual/R-devel/library/stats/html/family.html)</sup>
- **计数数据。** 泊松回归是计数数据的标准模型，计数为以零为界的整数，通常右偏；对数连接给出\( \ln(\mu) = \beta_0 + \beta x \)。<sup>[12](https://cscu.cornell.edu/workshop/introduction-to-modeling-count-data/)</sup><sup> • </sup><sup>[13](https://stats.oarc.ucla.edu/wp-content/uploads/2022/03/generalized_linear_new.html)</sup>
- **连续正值数据。** 使用倒数连接的伽马分布族适用于变异系数恒定的数据，如原论文中的方差分量示例。<sup>[1](https://academic.oup.com/jrsssa/article/135/3/370/7110572)</sup><sup> • </sup><sup>[5](https://books.google.com/books?id=OUitAQAACAAJ)</sup>
- **正态数据。** 使用恒等连接时，GLM退化为普通线性回归。<sup>[2](https://online.stat.psu.edu/stat462/node/211/)</sup>

计数应用常常需要替代普通泊松模型的方法。真实计数数据相对于泊松分布往往过度离散或离散不足，因此使用准泊松和负二项回归来缓解过度离散，而零膨胀模型和跨栏模型则处理零值频繁出现的数据。<sup>[12](https://cscu.cornell.edu/workshop/introduction-to-modeling-count-data/)</sup>在2023年一项将四种计数GLM应用于马来西亚新山地区上呼吸道感染病例与空气污染及气候因素关系的比较研究中，负二项模型表现最佳；可吸入颗粒物（PM10）、二氧化硫和地面臭氧是显著预测因子，而气候因素则不显著。<sup>[14](https://www.pertanika.upm.edu.my/pjst/browse/regular-issue?article=JST-3690-2022)</sup>

## 过度离散与准似然

对于二项分布族和泊松分布族，离散参数固定为一。R的quasibinomial和quasipoisson族与标准对应族的唯一区别在于离散度不固定，因此可以对过度离散建模；quasi族更一般地接受指定为“constant”、“mu(1-mu)”、“mu”、“mu^2”或“mu^3”的方差函数，并可选择连接函数。<sup>[4](https://stat.ethz.ch/R-manual/R-devel/library/stats/html/family.html)</sup>准似然拟合由韦德伯恩于1974年提出，仅指定前两阶矩而非完整分布。<sup>[15](https://ecommons.cornell.edu/bitstreams/0f4e2f75-2c1a-46b8-90ff-89e6dfa2228c/download)</sup>

## 扩展

若干后来的框架在保留GLM结构的同时放宽了其假设：

- **广义可加模型**将严格线性的预测子替换为协变量的光滑函数，与均值的线性预测子相加。<sup>[6](https://www.researchgate.net/publication/324760213_A_History_of_the_GLIM_Statistical_Package)</sup>
- **广义估计方程**（梁（Liang）和泽格（Zeger），1986年）将GLM扩展到纵向和重复测量数据，在不指定受试者观测联合分布的情况下推导估计方程；当每个受试者只有一个观测时，退化为普通GLM。<sup>[7](https://plaza.umin.ac.jp/~ehara/GEE_TEXT2.pdf)</sup>
- **广义线性混合模型**在线性预测子中加入随机效应，以处理聚类或相关数据。<sup>[16](https://stats.oarc.ucla.edu/other/mult-pkg/introduction-to-generalized-linear-mixed-models/)</sup>

## 诊断

GLM的拟合优度通常用残差偏差和皮尔逊统计量来评估；一篇比较性综述发现，对于GLM，残差偏差是比皮尔逊统计量更好的拟合优度度量。<sup>[17](https://cardinalscholar.bsu.edu/bitstreams/bb9d6e32-b5d0-47ca-88f6-fa94fa098d2b/download)</sup>然而对于离散结果，经典的皮尔逊残差和偏差残差分析的效用有限，近期研究提出函数型残差，将其对协变量或对其零分布作Fn-Fn图，以揭示遗漏高阶项、交互作用、离散参数或零膨胀成分等设定错误。<sup>[18](https://arxiv.org/abs/2207.04299)</sup>

## 软件

GLM在各大统计环境中均有实现。R的`glm()`接受公式、指定误差分布和连接的分布族对象，以及用于先验权重、偏移量和起始值的可选参数；SAS提供GLIMMIX过程用于广义线性混合模型，LOGISTIC和CATMOD过程则拟合独立性情形下的GLM。<sup>[3](https://stat.ethz.ch/R-manual/R-devel/library/stats/help/glm.html)</sup><sup> • </sup><sup>[19](https://stats.oarc.ucla.edu/stat/sas/glimmix.pdf)</sup>历史上的GLIM软件包——其名称呼应了模型的缩写——是最初的实现，为线性模型拟合的精度树立了早期标杆。<sup>[9](https://academic.oup.com/jrsssa/article/174/2/499/7077714)</sup>

## References

1. [J. A. Nelder and R. W. M. Wedderburn (1972). Generalized Linear Models. Journal of the Royal Statistical Society, Series A, 135(3), 370–384.](https://academic.oup.com/jrsssa/article/135/3/370/7110572)
2. [Generalized Linear Models, STAT 462, Penn State Eberly College of Science](https://online.stat.psu.edu/stat462/node/211/)
3. [glm {stats}, R Documentation](https://stat.ethz.ch/R-manual/R-devel/library/stats/help/glm.html)
4. [family {stats}, R Documentation](https://stat.ethz.ch/R-manual/R-devel/library/stats/html/family.html)
5. [P. McCullagh and John A. Nelder. Generalized Linear Models. Springer US, 1983.](https://books.google.com/books?id=OUitAQAACAAJ)
6. [Murray Aitkin (2018). A History of the GLIM Statistical Package. International Statistical Review 86(2), 275–299.](https://www.researchgate.net/publication/324760213_A_History_of_the_GLIM_Statistical_Package)
7. [Kung-Yee Liang and Scott L. Zeger (1986). Longitudinal data analysis using generalized linear models. Biometrika 73(1), 13–22.](https://plaza.umin.ac.jp/~ehara/GEE_TEXT2.pdf)
8. [Generalized Linear Regression Models, UCLA Office of Advanced Research Computing](https://stats.oarc.ucla.edu/wp-content/uploads/2025/03/Generalized_Linear_Model_2025.html)
9. [John Ashworth Nelder; Julian Besag, JRSS Series A 174(2), 499 (obituary and appreciation)](https://academic.oup.com/jrsssa/article/174/2/499/7077714)
10. [Generalized linear models, WorldCat record](https://search.worldcat.org/title/12453095)
11. [glm.summaries {stats}, R Documentation](https://search.r-project.org/R/refmans/stats/html/glm.summaries.html)
12. [Introduction to Modeling Count Data, Cornell Statistical Consulting Unit](https://cscu.cornell.edu/workshop/introduction-to-modeling-count-data/)
13. [Generalized linear Regression Models, UCLA (2022 workshop notes)](https://stats.oarc.ucla.edu/wp-content/uploads/2022/03/generalized_linear_new.html)
14. [Zetty Izzati Zulki Alwani et al. (2023). Comparison of Count Data Generalised Linear Models: Application to Air-Pollution Related Disease in Johor Bahru, Malaysia. Pertanika Journal of Science & Technology 31(4).](https://www.pertanika.upm.edu.my/pjst/browse/regular-issue?article=JST-3690-2022)
15. [Generalized Linear Models, Cornell eCommons course notes](https://ecommons.cornell.edu/bitstreams/0f4e2f75-2c1a-46b8-90ff-89e6dfa2228c/download)
16. [Introduction to Generalized Linear Mixed Models, UCLA](https://stats.oarc.ucla.edu/other/mult-pkg/introduction-to-generalized-linear-mixed-models/)
17. [A Survey on Generalized Linear Models (GLMs), Ball State University](https://cardinalscholar.bsu.edu/bitstreams/bb9d6e32-b5d0-47ca-88f6-fa94fa098d2b/download)
18. [Model diagnostics of discrete data regression: a unifying framework using functional residuals, arXiv:2207.04299](https://arxiv.org/abs/2207.04299)
19. [The GLIMMIX Procedure, SAS documentation](https://stats.oarc.ucla.edu/stat/sas/glimmix.pdf)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 30, 2026; Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 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/generalized-linear-model

English original: https://www.edgepedia.org/generalized-linear-model
