7.3. Generalized Estimating Equations¶
Generalized Estimating Equations estimate generalized linear models for panel, cluster or repeated measures data when the observations are possibly correlated withing a cluster but uncorrelated across clusters. It supports estimation of the same one-parameter exponential families as Generalized Linear models (GLM).
See Module Reference for commands and arguments.
7.3.1. Examples¶
The following illustrates a Poisson regression with exchangeable correlation within clusters using data on epilepsy seizures.
import statsmodels.api as sm
import statsmodels.formula.api as smf
data = sm.datasets.get_rdataset('epil', package='MASS').data
fam = sm.families.Poisson()
ind = sm.cov_struct.Exchangeable()
mod = smf.gee("y ~ age + trt + base", "subject", data,
cov_struct=ind, family=fam)
res = mod.fit()
print(res.summary())
Several notebook examples of the use of GEE can be found on the Wiki: Wiki notebooks for GEE
7.3.1.1. References¶
- KY Liang and S Zeger. “Longitudinal data analysis using generalized linear models”. Biometrika (1986) 73 (1): 13-22.
- S Zeger and KY Liang. “Longitudinal Data Analysis for Discrete and Continuous Outcomes”. Biometrics Vol. 42, No. 1 (Mar., 1986), pp. 121-130
- A Rotnitzky and NP Jewell (1990). “Hypothesis testing of regression parameters in semiparametric generalized linear models for cluster correlated data”, Biometrika, 77, 485-497.
- Xu Guo and Wei Pan (2002). “Small sample performance of the score test in GEE”. http://www.sph.umn.edu/faculty1/wp-content/uploads/2012/11/rr2002-013.pdf
- LA Mancl LA, TA DeRouen (2001). A covariance estimator for GEE with improved small-sample properties. Biometrics. 2001 Mar;57(1):126-34.
7.3.2. Module Reference¶
7.3.2.1. Model Class¶
GEE (endog, exog, groups[, time, family, ...]) |
Estimation of marginal regression models using Generalized Estimating Equations (GEE). |
7.3.2.2. Results Classes¶
GEEResults (model, params, cov_params, scale) |
This class summarizes the fit of a marginal regression model using GEE. |
GEEMargins (results, args[, kwargs]) |
Estimate the marginal effects of a model fit using generalized estimating equations. |
7.3.2.3. Dependence Structures¶
The dependence structures currently implemented are
CovStruct ([cov_nearest_method]) |
A base class for correlation and covariance structures of grouped data. |
Autoregressive ([dist_func]) |
An autoregressive working dependence structure. |
Exchangeable () |
An exchangeable working dependence structure. |
GlobalOddsRatio (endog_type) |
Estimate the global odds ratio for a GEE with ordinal or nominal data. |
Independence ([cov_nearest_method]) |
An independence working dependence structure. |
Nested ([cov_nearest_method]) |
A nested working dependence structure. |
7.3.2.4. Families¶
The distribution families are the same as for GLM, currently implemented are
Family (link, variance) |
The parent class for one-parameter exponential families. |
Binomial ([link]) |
Binomial exponential family distribution. |
Gamma ([link]) |
Gamma exponential family distribution. |
Gaussian ([link]) |
Gaussian exponential family distribution. |
InverseGaussian ([link]) |
InverseGaussian exponential family. |
NegativeBinomial ([link, alpha]) |
Negative Binomial exponential family. |
Poisson ([link]) |
Poisson exponential family. |
7.3.2.5. Link Functions¶
The link functions are the same as for GLM, currently implemented are the following. Not all link functions are available for each distribution family. The list of available link functions can be obtained by
>>> sm.families.family.<familyname>.links
Link |
A generic link function for one-parameter exponential family. |
CDFLink ([dbn]) |
The use the CDF of a scipy.stats distribution |
CLogLog |
The complementary log-log transform |
Log |
The log transform |
Logit |
The logit transform |
NegativeBinomial ([alpha]) |
The negative binomial link function |
Power ([power]) |
The power transform |
cauchy () |
The Cauchy (standard Cauchy CDF) transform |
cloglog |
The CLogLog transform link function. |
identity () |
The identity transform |
inverse_power () |
The inverse transform |
inverse_squared () |
The inverse squared transform |
log |
The log transform |
logit |
|
nbinom ([alpha]) |
The negative binomial link function. |
probit ([dbn]) |
The probit (standard normal CDF) transform |