# 广义估计方程

**广义估计方程**（Generalized estimating equations，GEE）是一种半参数统计方法，由梁庚义（Kung-Yee Liang）和 Scott L. Zeger 于 1986 年提出，用于对聚类数据或纵向数据拟合回归模型——在这类数据中，同一聚类内的观测彼此相关，但响应的完整多元分布并未被指定。GEE 通过仅对边际均值建模、并用一个“工作”相关矩阵来指定聚类内相关性，从而将广义线性模型推广到相关数据；即使该工作相关矩阵设定错误，它仍能给出相合的回归估计和有效的标准误。<sup>[1](https://doi.org/10.1002/%28SICI%291521-4036%28199806%2940%3A2%3C115%3A%3AAID-BIMJ115%3E3.0.CO%3B2-6)</sup><sup> • </sup><sup>[2](https://academic.oup.com/biomet/article-abstract/73/1/13/246001?login=false)</sup>

| 关键事实 | 详情 |
|---|---|
| 起源 | 由梁庚义和 Zeger（1986）以及 Zeger 和梁庚义（1986）提出；奠基性论文为《Longitudinal Data Analysis Using Generalized Linear Models》，*Biometrika* 73(1)，第 13–22 页<sup>[1](https://doi.org/10.1002/%28SICI%291521-4036%28199806%2940%3A2%3C115%3A%3AAID-BIMJ115%3E3.0.CO%3B2-6)</sup><sup> • </sup><sup>[3](https://cir.nii.ac.jp/crid/1360855568880222080)</sup> |
| 估计对象 | 协变量对响应均值的边际（总体平均）效应，与混合模型的主体特定（条件）效应形成对照<sup>[4](https://www2.stat.duke.edu/courses/Spring22/sta440.001/slides/lmm-2.html)</sup> |
| 分布要求 | 仅指定前两阶矩；不对响应作完整的分布假设<sup>[5](https://academic.oup.com/genetics/article/203/2/715/6066221)</sup> |
| 稳健性 | 只要边际均值模型正确，即使工作相关结构设定错误，系数估计和三明治标准误仍保持相合<sup>[6](https://www.casrai.org/guides/generalized-estimating-equations-gee)</sup> |
| 小样本弱点 | 聚类数很少时，三明治方差估计量向下偏倚，导致第一类错误率膨胀；一条常用经验法则将少于 30 个聚类视为小样本<sup>[7](https://pmc.ncbi.nlm.nih.gov/articles/PMC10482495/)</sup> |
| 模型选择 | 独立性模型下的拟似然准则（QIC）由 Pan 于 2001 年提出，将赤池信息准则改造用于 GEE<sup>[8](https://journals.sagepub.com/doi/10.1177/1536867X0700700205)</sup> |
| 软件 | SAS、Stata、SUDAAN 和 S-Plus 中均有实现（1999 年综述），R 中有 geepack，Python 中有 statsmodels<sup>[9](https://www.tandfonline.com/doi/abs/10.1080/00031305.1999.10474451)</sup><sup> • </sup><sup>[10](https://www.statsmodels.org/stable/gee.html)</sup> |

## 边际建模思想

GEE 所处理的问题，只要响应以聚类形式出现便会发生：同一病人的重复测量、同一口腔中的牙齿、同一学校中的学生。对于离散或非正态响应，一个聚类的整个响应向量可能不存在易于处理的联合分布，因此 GEE 转而仅通过广义线性模型指定每个响应的边际均值，用连接函数将均值与协变量联系起来，并把受试者各次观测之间的相关性当作数据中非研究重点的干扰特征来处理。<sup>[11](https://www.socr.umich.edu/people/dinov/2017/Spring/DSPA_HS650/notes/18_BigLongitudinalDataAnalysis.html)</sup>

估计方程是对普通广义线性模型的拟似然得分方程所作的推广。将第 \( i \) 个聚类的工作协方差写作

\[ V_i = \phi \, A_i^{1/2} R_i(\alpha) A_i^{1/2}, \]

其中 \( A_i \) 为对角矩阵，对角元为 \( \mathrm{var}(Y_{ij}) \)，\( R_i(\alpha) \) 是依赖于参数 \( \alpha \) 的工作相关矩阵，\( \phi \) 为离散（过度离散）参数，则估计量求解

\[ \sum_i D_i^{\top} V_i^{-1} (\mathbf{y}_i - \boldsymbol{\mu}_i) = 0, \]

其中 \( D_i = \partial \boldsymbol{\mu}_i / \partial \boldsymbol{\beta}^{\top} \)。<sup>[5](https://academic.oup.com/genetics/article/203/2/715/6066221)</sup> 这里仅指定分布的前两阶矩，这正是拟似然的思想；离散参数 \( \phi \) 容许过度离散，并由残差估计得到。<sup>[12](https://www2.stat.duke.edu/~fl35/teaching/610-23F/docs/slides/6-1-GEE.pdf)</sup>

## 工作相关结构

分析者根据关于观测如何相关的先验知识，从一组结构菜单中选取 \( R(\alpha) \)：<sup>[4](https://www2.stat.duke.edu/courses/Spring22/sta440.001/slides/lmm-2.html)</sup>

- **独立**：所有非对角相关均设为零。
- **可交换**：同一聚类内任意一对观测共享同一个公共相关。
- **自回归**：相关性随时间的间隔而衰减，相隔一个单位的观测相关为 \( \rho \)，相隔两个单位为 \( \rho^2 \)，依此类推。
- **托普利茨（带状）**：相关性依赖于滞后阶数，带外为零。
- **非结构化**：对每一对时间点分别估计一个相关。

工作相关的选择不影响回归估计的相合性；结构正确可提升效率，结构错误则除效率损失外代价甚微。<sup>[13](https://academic.oup.com/jrsssb/article/65/1/127/7110626)</sup> 梁庚义和 Zeger 的原始论文将独立、m-相依和可交换结构作为特例进行了讨论。<sup>[2](https://academic.oup.com/biomet/article-abstract/73/1/13/246001?login=false)</sup>

## 三明治方差及其局限

**稳健推断。** GEE 将其点估计与一个三明治（Huber–White）方差估计量配对使用，之所以得名，是因为一个近似相关矩阵被“夹”在两层矩阵代数的外层之间。即使工作相关模型偏离真实相关模型，该估计量对真实方差仍保持相合，这正是该方法的核心稳健性。<sup>[6](https://www.casrai.org/guides/generalized-estimating-equations-gee)</sup><sup> • </sup><sup>[14](https://journals.sagepub.com/doi/pdf/10.1177/1536867X20931001)</sup> 如果工作相关实际上正确，三明治就会退化为基于模型的方差，即通常的广义最小二乘结果。<sup>[15](https://bayeslearner.github.io/bayeslearner-scikit-refresh/chapters/14-mixed-effects-gee.html)</sup>

**小样本。** 当聚类数较少时，三明治估计量会低估真实方差，造成第一类错误率膨胀。一条常用经验法则将少于 30 个聚类的研究视为小样本；为维持 5% 第一类错误率所建议的最少聚类数，对混合模型约为 30–40 个，对 GEE 约为 40–50 个。<sup>[7](https://pmc.ncbi.nlm.nih.gov/articles/PMC10482495/)</sup><sup> • </sup><sup>[16](https://academic.oup.com/ije/article/47/1/321/4091562)</sup> 为此发展出了若干偏差校正的三明治估计量，包括 Kauermann 和 Carroll（2001）、Mancl 和 DeRouen（2001）、Fay 和 Graubard（2001）以及 Morel 等人（2003）提出的方法。<sup>[7](https://pmc.ncbi.nlm.nih.gov/articles/PMC10482495/)</sup> 在一项针对连续结局的整群随机试验模拟研究中，带小样本校正的 GEE 在大多数情形下即使只有六到八个聚类也能维持名义 5% 的第一类错误率，但校正会降低功效，某些情况下从名义 80% 降至仅 10%。<sup>[16](https://academic.oup.com/ije/article/47/1/321/4091562)</sup> 一项对已发表整群随机试验的调查显示，其中 65% 的研究因聚类数少且未作小样本校正，而易受第一类错误率膨胀之害。<sup>[16](https://academic.oup.com/ije/article/47/1/321/4091562)</sup>

## GEE 与混合模型的比较

GEE 与广义线性混合模型（GLMM）是处理相关非正态数据的两大标准方法族，它们估计的量不同。GEE 针对边际的、总体平均的效应；带随机效应的 GLMM 针对条件的、主体特定的效应。在恒等连接和正态线性模型下两者一致，但在 logit 等非线性连接下二者不同，有时差异相当大，因为在随机效应分布上取平均并不等于在平均随机效应处评估响应。<sup>[4](https://www2.stat.duke.edu/courses/Spring22/sta440.001/slides/lmm-2.html)</sup><sup> • </sup><sup>[17](https://sciminds.ucsd.edu/bossanova/maths/marginal-conditional/)</sup>

这一选择还有实际后果。GEE 避免了基于似然的计算，拟合更容易，但使某些推断程序复杂化；GLMM 基于似然，在一些临床试验建议中，对于随机缺失假设下的纵向二值数据，GLMM 比 GEE 更受青睐。<sup>[4](https://www2.stat.duke.edu/courses/Spring22/sta440.001/slides/lmm-2.html)</sup><sup> • </sup><sup>[18](https://www.sciencedirect.com/science/article/pii/S155171442200043X)</sup> 为将参数的边际解释与条件设定模型的统计性质结合起来，人们发展出了若干边际可解释的 GLMM 类。<sup>[19](https://arxiv.org/abs/1610.01526)</sup>

## 扩展

原始形式已沿若干方向得到扩展：<sup>[1](https://doi.org/10.1002/%28SICI%291521-4036%28199806%2940%3A2%3C115%3A%3AAID-BIMJ115%3E3.0.CO%3B2-6)</sup>

- **缺失数据。** 标准 GEE 在完全随机缺失下有效，而加权 GEE（WGEE）通过以观测概率的倒数对已观测响应加权，将有效性扩展到随机缺失数据；多重插补 GEE（MI-GEE）是一种相关的校正方法。<sup>[20](https://pmc.ncbi.nlm.nih.gov/articles/PMC3358416/)</sup><sup> • </sup><sup>[21](https://arxiv.org/abs/1506.04451)</sup>
- **信息性聚类大小。** 当聚类大小与结局相关时，例如牙齿数目影响某项牙病分析，标准 GEE 会对边际均值参数给出有偏估计，因为较大的聚类获得更大权重。聚类内重抽样和 Williamson 及其同事于 2003 年提出的聚类加权 GEE（CWGEE）可恢复无偏性；CWGEE 达到与聚类内重抽样相同的估计，同时避免了后者的蒙特卡洛计算。<sup>[22](https://pmc.ncbi.nlm.nih.gov/articles/PMC3137732/)</sup><sup> • </sup><sup>[23](https://pubmed.ncbi.nlm.nih.gov/20223781/)</sup>
- **模型选择与诊断。** Pan 的 QIC（2001）用独立性模型下的拟似然替代赤池信息准则中的似然，从而可以比较工作相关结构和均值模型。<sup>[8](https://journals.sagepub.com/doi/10.1177/1536867X0700700205)</sup>
- **高维与惩罚情形。** 惩罚 GEE 将该方法推广到高维纵向数据，并在估计和模型选择两方面都有相合性结果。<sup>[24](https://arxiv.org/abs/2501.00839)</sup>
- **二阶 GEE 与 QIF。** 二阶 GEE 将工作相关结构建模为协变量的函数，二次推断函数则提供了另一种估计框架。<sup>[25](https://pmc.ncbi.nlm.nih.gov/articles/PMC5463203/)</sup>

## 应用与软件

GEE 在临床试验和生物医学研究中被广泛用于纵向与聚类结局，并已扩展到包括政治学在内的领域，在那里被用于相关投票数据，采用独立、可交换和非结构化工作相关。<sup>[26](https://onlinelibrary.wiley.com/doi/abs/10.1155/2014/303728)</sup><sup> • </sup><sup>[27](https://websites.umich.edu/~franzese/Zorn.GEEforPolSci.AJPS2001.pdf)</sup> 1999 年 *The American Statistician* 上的一篇综述比较了 SAS、Stata、SUDAAN 和 S-Plus 中的 GEE 实现；当前的选项包括 R 中的 geepack 包，其 geeglm 函数接受标准相关结构并支持基于 QIC 的比较，以及 Python 中的 statsmodels，它提供 GEE、NominalGEE 和 OrdinalGEE 类，支持独立、可交换、自回归、平稳和非结构化相依结构。<sup>[9](https://www.tandfonline.com/doi/abs/10.1080/00031305.1999.10474451)</sup><sup> • </sup><sup>[10](https://www.statsmodels.org/stable/gee.html)</sup><sup> • </sup><sup>[28](https://packages.oit.ncsu.edu/cran/web/packages/geepack/geepack.pdf)</sup> 该领域的标准教材是 James W. Hardin 和 Joseph M. Hilbe 所著的 *Generalized Estimating Equations*，其第二版增加了惩罚 GEE、调查 GEE、拟最小二乘回归以及 QIC 扩展等内容。<sup>[29](https://www.routledge.com/Generalized-Estimating-Equations/Hardin-Hilbe/p/book/9780429111037)</sup>

## References

1. [A. Ziegler (1998). The Generalised Estimating Equations: An Annotated Bibliography. *Biometrical Journal* 40(2).](https://doi.org/10.1002/%28SICI%291521-4036%28199806%2940%3A2%3C115%3A%3AAID-BIMJ115%3E3.0.CO%3B2-6)
2. [K.-Y. Liang and S. L. Zeger (1986). Longitudinal Data Analysis Using Generalized Linear Models. *Biometrika* 73(1): 13–22.](https://academic.oup.com/biomet/article-abstract/73/1/13/246001?login=false)
3. [CiNii Research record for Liang & Zeger (1986), *Biometrika* 73(1), 13–22.](https://cir.nii.ac.jp/crid/1360855568880222080)
4. [Duke University STA 440 course notes: Linear Mixed Models (2), section on generalized estimating equations.](https://www2.stat.duke.edu/courses/Spring22/sta440.001/slides/lmm-2.html)
5. [Powerful and Adaptive Testing for Multi-trait and Multi-SNP Associations. *Genetics* 203(2).](https://academic.oup.com/genetics/article/203/2/715/6066221)
6. [Generalized Estimating Equations (GEE) Explained, CASRAI guide.](https://www.casrai.org/guides/generalized-estimating-equations-gee)
7. [Improving sandwich variance estimation for marginal Cox analysis of cluster randomized trials. PMC.](https://pmc.ncbi.nlm.nih.gov/articles/PMC10482495/)
8. [J. Cui (2007). QIC Program and Model Selection in GEE Analyses. *Stata Journal* 7(2).](https://journals.sagepub.com/doi/10.1177/1536867X0700700205)
9. [Review of Software to Fit Generalized Estimating Equation Regression Models. *The American Statistician* 53(2).](https://www.tandfonline.com/doi/abs/10.1080/00031305.1999.10474451)
10. [Generalized Estimating Equations, statsmodels 0.15.0 documentation.](https://www.statsmodels.org/stable/gee.html)
11. [Data Science and Predictive Analytics (UMich HS650), chapter on GLMM/GEE longitudinal data analysis.](https://www.socr.umich.edu/people/dinov/2017/Spring/DSPA_HS650/notes/18_BigLongitudinalDataAnalysis.html)
12. [Duke University STA 610 slides: Generalized Estimating Equations.](https://www2.stat.duke.edu/~fl35/teaching/610-23F/docs/slides/6-1-GEE.pdf)
13. [Building Adaptive Estimating Equations When Inverse of Covariance Estimation is Difficult. *JRSS-B* 65(1).](https://academic.oup.com/jrsssb/article/65/1/127/7110626)
14. [xtgeebcv: bias-corrected sandwich variance estimation for GEE analyses of cluster randomized trials. *Stata Journal*.](https://journals.sagepub.com/doi/pdf/10.1177/1536867X20931001)
15. [Advanced Methods in SciPy and Statsmodels, chapter 14: Mixed Effects, GEE, and Clustered Data.](https://bayeslearner.github.io/bayeslearner-scikit-refresh/chapters/14-mixed-effects-gee.html)
16. [Cluster randomized trials with a small number of clusters: which analyses should be used? *International Journal of Epidemiology* 47(1): 321.](https://academic.oup.com/ije/article/47/1/321/4091562)
17. [Marginal vs Conditional Effects, SciMinds Research Studio, UCSD Psychology.](https://sciminds.ucsd.edu/bossanova/maths/marginal-conditional/)
18. [Analyzing longitudinal binary data in clinical trials. *Contemporary Clinical Trials Communications*.](https://www.sciencedirect.com/science/article/pii/S155171442200043X)
19. [Marginally Interpretable Generalized Linear Mixed Models. arXiv:1610.01526.](https://arxiv.org/abs/1610.01526)
20. [Are we missing the importance of missing values in HIV prevention randomized clinical trials? PMC.](https://pmc.ncbi.nlm.nih.gov/articles/PMC3358416/)
21. [Doubly Robust-Based Generalized Estimating Equations for the Analysis of Longitudinal Ordinal Missing Data. arXiv:1506.04451.](https://arxiv.org/abs/1506.04451)
22. [Informative Cluster Sizes for Sub-Cluster Level Covariates and Weighted Generalized Estimating Equations. PMC.](https://pmc.ncbi.nlm.nih.gov/articles/PMC3137732/)
23. [Inference for marginal linear models for clustered longitudinal data with potentially informative cluster sizes. *Statistical Methods in Medical Research* 20(4): 347–367.](https://pubmed.ncbi.nlm.nih.gov/20223781/)
24. [Penalized weighted GEEs for high-dimensional longitudinal data with informative cluster size. arXiv:2501.00839.](https://arxiv.org/abs/2501.00839)
25. [Review of Recent Methodological Developments in Group-Randomized Trials: Part 2—Analysis. PMC.](https://pmc.ncbi.nlm.nih.gov/articles/PMC5463203/)
26. [M. Wang (2014). Generalized Estimating Equations in Longitudinal Data Analysis: A Review and Recent Developments. *Advances in Statistics*.](https://onlinelibrary.wiley.com/doi/abs/10.1155/2014/303728)
27. [C. J. W. Zorn (2001). Generalized Estimating Equation Models for Correlated Data: A Review with Applications. *American Journal of Political Science* 45(2): 470–490.](https://websites.umich.edu/~franzese/Zorn.GEEforPolSci.AJPS2001.pdf)
28. [Package 'geepack', CRAN documentation.](https://packages.oit.ncsu.edu/cran/web/packages/geepack/geepack.pdf)
29. [J. W. Hardin and J. M. Hilbe. Generalized Estimating Equations, Second Edition. Routledge.](https://www.routledge.com/Generalized-Estimating-Equations/Hardin-Hilbe/p/book/9780429111037)

---
*Initially written Oct 15, 2026*

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

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/generalized-estimating-equations

English original: https://www.edgepedia.org/generalized-estimating-equations
