# 广义估计方程

广义估计方程（generalized estimating equation, GEE）是一种统计方法，用于在观测值相关的情形下——例如对同一受试者进行重复测量或存在聚类数据——估计广义线性模型的参数，且不要求完全正确地指定相关结构。普通GLM拟合假定观测值相互独立，因而忽略了聚类内相关；GEE扩展了GLM框架，在保持回归焦点的同时直接处理这一问题。<sup>[1](https://doi.org/10.1093/biomet/73.1.13)</sup> GEE是一种总体水平（边际）方法：它估计总体平均效应，并将聚类内协方差视为干扰参数，这与个体水平的混合效应模型形成对比。<sup>[2](https://onlinelibrary.wiley.com/doi/10.1155/2014/303728)</sup> 分析者获得回归系数、带有关联参数的工作相关矩阵，以及来自稳健三明治估计量的标准误——即使工作相关被错误指定，该估计量仍保持相合性。<sup>[3](https://faculty.washington.edu/heagerty/Courses/b571/homework/geepack-paper.pdf)</sup>

| 关键事实 | 详情 |
|---|---|
| 估计对象 | 相关或重复结局的GLM的总体平均（边际）回归系数<sup>[2](https://onlinelibrary.wiley.com/doi/10.1155/2014/303728)</sup> |
| 相合性要求 | 仅需边际均值模型正确；工作相关可以错误<sup>[3](https://faculty.washington.edu/heagerty/Courses/b571/homework/geepack-paper.pdf)</sup> |
| 标准误 | 稳健三明治估计量，在相关错误指定下相合<sup>[4](https://www.sfu.ca/sasdoc/sashtml/stat/chap29/sect38.htm)</sup> |
| 缺失数据 | 标准GEE要求完全随机缺失（MCAR）；加权GEE将有效性扩展至MAR<sup>[5](https://casrai.org/guides/generalized-estimating-equations-gee)</sup> |
| 小样本警示 | 聚类数少时三明治标准误向下偏倚；名义0.05水平下4个聚类的I类错误率达0.43–0.47<sup>[6](https://sage.cnpereading.com/doi/10.1177/1740774516643498)</sup> |
| 软件 | R中的geepack、gee和geeM；SAS中的PROC GENMOD；Stata中的xtgee<sup>[5](https://casrai.org/guides/generalized-estimating-equations-gee)</sup> |
| 起源 | 由梁庚义（Kung-Yee Liang）和斯科特·L·泽格（Scott L. Zeger）于1986年在《生物计量学》上报告<sup>[1](https://doi.org/10.1093/biomet/73.1.13)</sup> |

## 工作原理

GEE求解一个将GLM的拟似然估计方程推广至聚类数据的得分方程。对于均值模型为\( \mu_i \)的聚类\( i = 1, \dots, n \)，参数通过求解以下方程估计<sup>[7](https://statistics4ecologists-v2a.netlify.app/gee)</sup>

\[ \sum_{i=1}^{n} \frac{\partial \mu_i}{\partial \beta} V_i^{-1} (Y_i - \mu_i) = 0, \]

其中\( V_i = \phi A_i^{1/2} R_i(\alpha) A_i^{1/2} \)是工作协方差矩阵，尺度参数\( \phi \)在二项和泊松模型中通常固定为1。这里\( A_i \)是对角矩阵，其元素为方差函数所隐含的边际方差（二值数据为\( \mu(1-\mu) \)，计数数据为\( \mu \)），因此\( A_i^{1/2} \)包含边际标准差，而\( R_i(\alpha) \)是带有联系参数\( \alpha \)的工作相关矩阵。<sup>[7](https://statistics4ecologists-v2a.netlify.app/gee)</sup> 条件方差被指定为\( \mathrm{Var}(Y_{ij} \mid X_{ij}) = \nu(\mu_{ij}) \phi \)，其中\( \nu \)是已知方差函数，\( \phi \)是尺度参数；\( R_i(\alpha) \)由皮尔逊残差迭代估计。<sup>[2](https://onlinelibrary.wiley.com/doi/10.1155/2014/303728)</sup> \( \hat{\beta} \)的协方差由三明治估计量估计，即使工作相关矩阵被错误指定它也是相合的，而基于模型的估计量要求均值模型和工作相关都正确。<sup>[4](https://www.sfu.ca/sasdoc/sashtml/stat/chap29/sect38.htm)</sup> GEE可视为M估计、拟似然和一般估计函数理论的特例。<sup>[8](https://research-management.mq.edu.au/ws/portalfiles/portal/340880271/Scandinavian_J_Statistics_2024_Muller_The_effect_of_the_working_correlation_on_fitting_models_to_longitudinal_data.pdf)</sup>

常见的工作结构有独立、可交换（复合对称）、AR(1)、m-依赖和非结构化。<sup>[5](https://casrai.org/guides/generalized-estimating-equations-gee)</sup><sup> • </sup><sup>[4](https://www.sfu.ca/sasdoc/sashtml/stat/chap29/sect38.htm)</sup> 错误指定真实相关通常不影响\( \hat{\beta} \)的相合性，但会损失效率，损失幅度因问题而异。<sup>[9](https://www.stat.ubc.ca/~john/papers/ShultsSIM2009.pdf)</sup> 2024年的一项分析发现，当真实结构为独立或工作结构正确时，GEE和二次推断函数（QIF）估计量在工作可交换或AR(1)相关下渐近等价；但当工作可交换结构面对真实AR(1)相关（或反之）时则不等价；哪个估计量更有效取决于具体问题。<sup>[8](https://research-management.mq.edu.au/ws/portalfiles/portal/340880271/Scandinavian_J_Statistics_2024_Muller_The_effect_of_the_working_correlation_on_fitting_models_to_longitudinal_data.pdf)</sup>

## 操作步骤

软件实现迭代算法：（1）从假定独立的普通GLM获得\( \beta \)的初始估计；（2）由标准化残差、当前\( \hat{\beta} \)和假定结构计算工作相关；（3）计算协方差估计；（4）更新\( \beta \)；（5）迭代步骤2至4直至收敛。<sup>[4](https://www.sfu.ca/sasdoc/sashtml/stat/chap29/sect38.htm)</sup> 分析者选择分布族和联系函数（高斯、二项和泊松均受支持）以及工作相关结构。<sup>[10](https://cran.r-project.org/web/packages/HSAUR2/vignettes/Ch_analysing_longitudinal_dataII.pdf)</sup> 在R中，geepack包提供独立、可交换、ar1和非结构化结构以及固定和用户自定义矩阵，其geeglm函数提供三明治和刀切方差；gee和geeM包也可拟合GEE模型。<sup>[3](https://faculty.washington.edu/heagerty/Courses/b571/homework/geepack-paper.pdf)</sup><sup> • </sup><sup>[11](https://arxiv.org/pdf/1709.01413)</sup> SAS通过PROC GENMOD配合REPEATED语句拟合GEE，Stata通过xtgee。<sup>[5](https://casrai.org/guides/generalized-estimating-equations-gee)</sup> 由于GEE不是基于似然的，模型选择使用专门准则：Pan的独立模型下拟似然准则（QIC）将赤池准则适配于GEE，<sup>[12](https://doi.org/10.1111/j.0006-341x.2001.00120.x)</sup> Rotnitzky-Jewell准则比较候选相关结构。排除性检查包括\( R(\hat{\alpha}) \)非正定、不收敛以及违反\( \alpha \)的Prentice约束；PROC GENMOD和xtgee等主要软件包不会对Prentice约束违反发出警告。<sup>[9](https://www.stat.ubc.ca/~john/papers/ShultsSIM2009.pdf)</sup>

## 起源

GEE由梁庚义和斯科特·L·泽格在1986年《生物计量学》论文中报告，<sup>[1](https://doi.org/10.1093/biomet/73.1.13)</sup> 同年泽格和梁在《生物统计学》上发表配套论文，提出了离散和连续结局的方程及相合方差估计。<sup>[13](https://europepmc.org/article/MED/3719049)</sup> 该方法源于公共卫生同事对更好分析二值及其他离散结局纵向数据方法的需求。<sup>[14](https://2015.isiproceedings.org/Files/IPS131-P1-A.pdf)</sup> 它建立在两条更早的脉络之上：J. A. 内尔德（J. A. Nelder）和R. W. M. 韦德伯恩（R. W. M. Wedderburn）于1972年提出的广义线性模型，<sup>[15](https://doi.org/10.2307/2344614)</sup> 以及韦德伯恩1974年的拟似然——GEE是其多元推广。<sup>[16](https://doi.org/10.1093/biomet/61.3.439)</sup> 1988年，泽格、梁和保罗·S·阿尔伯特（Paul S. Albert）扩展了该方法以同时拟合个体特异和总体平均模型，并在个体特异效应为高斯时给出了两组参数之间的简单关系。<sup>[17](https://doi.org/10.2307/2531734)</sup>

## 变体

GEE1是标准形式，通过\( R(\alpha) \)将聚类内相关视为干扰参数。GEE2则用基于前两阶经验矩的二阶估计方程扩展GEE1，同时估计均值参数和关联参数。<sup>[18](https://link.springer.com/article/10.1186/s12874-023-02107-z)</sup> QIF用基矩阵的线性组合替代工作相关的逆；一项评估将其描述为比GEE1对错误指定更稳健，在工作结构正确时效率相当，<sup>[18](https://link.springer.com/article/10.1186/s12874-023-02107-z)</sup> 但2024年的重新评估发现QIF估计量并不总是存在且影响函数无界，因此GEE和QIF在有界影响意义上都不稳健。<sup>[8](https://research-management.mq.edu.au/ws/portalfiles/portal/340880271/Scandinavian_J_Statistics_2024_Muller_The_effect_of_the_working_correlation_on_fitting_models_to_longitudinal_data.pdf)</sup> 对于信息性聚类大小，聚类加权GEE被推荐优于标准GEE——后者在一项牙周病研究中给出了偏倚估计。<sup>[2](https://onlinelibrary.wiley.com/doi/10.1155/2014/303728)</sup> 惩罚GEE在估计方程中加入Firth型惩罚（由戴维·弗思（David Firth）于1993年为减少最大似然估计的偏倚而引入）<sup>[19](https://doi.org/10.1093/biomet/80.1.27)</sup>，用于小样本或稀疏纵向二值数据；这种减少偏倚、防止分离的GEE由莫梅努尔·哈克·蒙多尔（Momenul Haque Mondol）和M. 沙菲库尔·拉赫曼（M. Shafiqur Rahman）于2019年报告。<sup>[20](https://doi.org/10.1002/sim.8126)</sup>

## 应用

GEE广泛用于生物医学和公共卫生研究中的重复测量和聚类结局，这些研究中二值疾病指示等结局随时间或在聚类内被观测。<sup>[1](https://doi.org/10.1093/biomet/73.1.13)</sup> 在geepack的呼吸系统示例中，GEE拟合的四种非独立工作结构下的标准误几乎相同，且比假定独立观测的普通GLM拟合所得的标准误大约高30%。<sup>[3](https://faculty.washington.edu/heagerty/Courses/b571/homework/geepack-paper.pdf)</sup> 相比之下，在一项文拉法辛研究中，正确选择的AR(1)模型下所有系数的标准误都更小，显示出对选择的敏感性。<sup>[9](https://www.stat.ubc.ca/~john/papers/ShultsSIM2009.pdf)</sup> 在阶梯楔形模拟中，可交换结构的GEE在所有情景下经验方差都小于独立结构的GEE，即使存在随机治疗效应也是如此。<sup>[21](https://pmc.ncbi.nlm.nih.gov/articles/PMC7971509/)</sup>

## 局限与替代方法

标准GEE要求数据完全随机缺失，才能使估计量及其方差估计相合；<sup>[22](https://plaza.umin.ac.jp/~ehara/GEE_TEXT2.pdf)</sup> 加权GEE利用缺失机制的逆概率权重将有效性扩展至随机缺失，而混合模型无需加权即可处理MAR。<sup>[5](https://casrai.org/guides/generalized-estimating-equations-gee)</sup> 与广义线性混合模型相比，GEE更易拟合，因为不需要对随机效应分布积分，但它只允许单一聚类变量且缺乏基于似然的模型选择。GEE系数是总体平均的，而GLMM系数是个体特异的，GEE估计更接近0。<sup>[7](https://statistics4ecologists-v2a.netlify.app/gee)</sup> 二者是不同的参数，而非矛盾的结果：在一个呼吸系统疾病示例中，GEE可交换治疗效应在对数优势尺度上为1.299，而随机效应模型为2.166。<sup>[10](https://cran.r-project.org/web/packages/HSAUR2/vignettes/Ch_analysing_longitudinal_dataII.pdf)</sup> 实际失败模式包括不收敛——在使用可交换工作相关且聚类大小变化时很常见（平均聚类大小为10时平均20%的拟合失败，聚类大小为50时34%失败）<sup>[23](https://link.springer.com/article/10.1186/s12874-022-01699-2)</sup>——以及对\( \alpha \)的Prentice约束的静默违反，主要软件包不进行检查。<sup>[9](https://www.stat.ubc.ca/~john/papers/ShultsSIM2009.pdf)</sup> 由于GEE一般不是基于似然的，因此无法进行基于似然的推断。<sup>[4](https://www.sfu.ca/sasdoc/sashtml/stat/chap29/sect38.htm)</sup>

三明治估计量的有效性在聚类数上是大样本性质的，聚类数少时它会低估真实方差，产生过小的标准误和膨胀的I类错误率。<sup>[5](https://casrai.org/guides/generalized-estimating-equations-gee)</sup> 在4个聚类时，模拟I类错误率在名义0.05水平下介于0.43和0.47之间，40个聚类时仍介于0.06和0.07之间。<sup>[6](https://sage.cnpereading.com/doi/10.1177/1740774516643498)</sup> 另一项模拟发现4个聚类时I类错误率超过40%，40个聚类时仍为7%，甚至70个聚类时也有膨胀；多数文献建议GEE至少需要40至50个聚类。<sup>[24](https://trialsjournal.biomedcentral.com/counter/pdf/10.1186/s13063-016-1571-2.pdf)</sup> geepack文档建议在30个或更少聚类时使用刀切方差，此时三明治估计量表现出偏倚。<sup>[3](https://faculty.washington.edu/heagerty/Courses/b571/homework/geepack-paper.pdf)</sup> 存在许多偏倚校正三明治估计量，包括劳埃德·A·曼克尔（Lloyd A. Mancl）和蒂莫西·A·德鲁恩（Timothy A. DeRouen）于2001年报告的具有改进小样本性质的协方差估计量，<sup>[25](https://doi.org/10.1111/j.0006-341x.2001.00126.x)</sup> 迈克尔·P·费伊（Michael P. Fay）和巴里·I·格劳巴德（Barry I. Graubard）于2001年的小样本Wald检验调整，<sup>[26](https://doi.org/10.1111/j.0006-341x.2001.01198.x)</sup> 以及约兰·考尔曼（Göran Kauermann）和雷蒙德·J·卡罗尔（Raymond J. Carroll）于2001年的相关效率注记；<sup>[27](https://doi.org/10.1198/016214501753382309)</sup> R包geesmv收集了许多这些修正估计量。<sup>[28](https://pmc.ncbi.nlm.nih.gov/articles/PMC4826860/)</sup> 在整群随机试验情景中，Kauermann-Carroll和Fay-Graubard校正表现特别好，所有方法都需要以聚类数减去聚类水平参数个数为自由度的t分布。<sup>[23](https://link.springer.com/article/10.1186/s12874-022-01699-2)</sup>

## References

1. [KUNG-YEE LIANG, SCOTT L. ZEGER (1986). Longitudinal data analysis using generalized linear models. Biometrika.](https://doi.org/10.1093/biomet/73.1.13)
2. [Generalized Estimating Equations in Longitudinal Data Analysis: A Review and Recent Developments](https://onlinelibrary.wiley.com/doi/10.1155/2014/303728)
3. [The R Package geepack for Generalized Estimating Equations (Halekoh, Højsgaard, Yan, Journal of Statistical Software, 2006)](https://faculty.washington.edu/heagerty/Courses/b571/homework/geepack-paper.pdf)
4. [SAS/STAT PROC GENMOD documentation: Generalized Estimating Equations](https://www.sfu.ca/sasdoc/sashtml/stat/chap29/sect38.htm)
5. [Generalized Estimating Equations (GEE): Working Correlation and When to Use Them Instead of a Mixed Model](https://casrai.org/guides/generalized-estimating-equations-gee)
6. [Generalized estimating equations in cluster randomized trials with a small number of clusters: Review of practice and simulation study (Huang, Fiero, Bell, Clinical Trials, 2016)](https://sage.cnpereading.com/doi/10.1177/1740774516643498)
7. [Chapter 20: Generalized Estimating Equations (Statistics for Ecologists, Fieberg et al.)](https://statistics4ecologists-v2a.netlify.app/gee)
8. [The effect of the working correlation on fitting models to longitudinal data (Müller et al., Scandinavian Journal of Statistics, 2024)](https://research-management.mq.edu.au/ws/portalfiles/portal/340880271/Scandinavian_J_Statistics_2024_Muller_The_effect_of_the_working_correlation_on_fitting_models_to_longitudinal_data.pdf)
9. [A comparison of several approaches for choosing between working correlation structures in GEE analysis of longitudinal binary data (Shults et al., Statistics in Medicine 2009)](https://www.stat.ubc.ca/~john/papers/ShultsSIM2009.pdf)
10. [A Handbook of Statistical Analyses Using R, Analysing Longitudinal Data II (GEE vignette)](https://cran.r-project.org/web/packages/HSAUR2/vignettes/Ch_analysing_longitudinal_dataII.pdf)
11. [geex: an R package for M-estimation (Saul & Hudgens, arXiv)](https://arxiv.org/pdf/1709.01413)
12. [Wei Pan (2001). Akaike's Information Criterion in Generalized Estimating Equations. Biometrics.](https://doi.org/10.1111/j.0006-341x.2001.00120.x)
13. [Longitudinal data analysis for discrete and continuous outcomes (Zeger & Liang, Biometrics 1986)](https://europepmc.org/article/MED/3719049)
14. [Statistical Estimating Functions and Their Biomedical Applications; The Story of Generalized Estimating Equations (Liang & Zeger, ISI 2015)](https://2015.isiproceedings.org/Files/IPS131-P1-A.pdf)
15. [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)
16. [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)
17. [Scott L. Zeger, Kung-Yee Liang, Paul S. Albert (1988). Models for Longitudinal Data: A Generalized Estimating Equation Approach. Biometrics.](https://doi.org/10.2307/2531734)
18. [Analysing cluster randomised controlled trials using GLMM, GEE1, GEE2, and QIF: results from four case studies (BMC Medical Research Methodology, 2023)](https://link.springer.com/article/10.1186/s12874-023-02107-z)
19. [DAVID FIRTH (1993). Bias reduction of maximum likelihood estimates. Biometrika.](https://doi.org/10.1093/biomet/80.1.27)
20. [Momenul Haque Mondol, M. Shafiqur Rahman (2019). Bias‐reduced and separation‐proof GEE with small or sparse longitudinal binary data. Statistics in Medicine.](https://doi.org/10.1002/sim.8126)
21. [A simulation study of statistical approaches to data analysis in the stepped wedge design (PMC)](https://pmc.ncbi.nlm.nih.gov/articles/PMC7971509/)
22. [Liang & Zeger (1986) Biometrika 73(1):13-22, full text copy](https://plaza.umin.ac.jp/~ehara/GEE_TEXT2.pdf)
23. [Cluster randomised trials with a binary outcome and a small number of clusters: comparison of individual and cluster level analysis methods (BMC Medical Research Methodology, 2022)](https://link.springer.com/article/10.1186/s12874-022-01699-2)
24. [Increased risk of type I errors in cluster randomised trials with small or medium numbers of clusters: a review, reanalysis, and simulation study (Trials, 2016)](https://trialsjournal.biomedcentral.com/counter/pdf/10.1186/s13063-016-1571-2.pdf)
25. [Lloyd A. Mancl, Timothy A. DeRouen (2001). A Covariance Estimator for GEE with Improved Small‐Sample Properties. Biometrics.](https://doi.org/10.1111/j.0006-341x.2001.00126.x)
26. [Michael P. Fay, Barry I. Graubard (2001). Small-Sample Adjustments for Wald-Type Tests Using Sandwich Estimators. Biometrics.](https://doi.org/10.1111/j.0006-341x.2001.01198.x)
27. [Göran Kauermann, Raymond J Carroll (2001). A Note on the Efficiency of Sandwich Covariance Matrix Estimation. Journal of the American Statistical Association.](https://doi.org/10.1198/016214501753382309)
28. [Covariance estimators for generalized estimating equations (GEE) in longitudinal analysis with small samples (Wang, Kong, Li, Zhang, Statistics in Medicine, 2015)](https://pmc.ncbi.nlm.nih.gov/articles/PMC4826860/)

---
*Initially written Sep 29, 2026 · Edited: Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 统计学与概率论 › Statistical inference, estimation, sampling, and testing › Estimation theory and estimator families

Copyright 2026 Edgepedia

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

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

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