# When to use generalized estimating equations vs. mixed effects models?

I have been quite happily using mixed effects models for a while now with longitudinal data. I wish I could fit AR relationships in lmer (I think I'm right that I can't do this?) but I don't think it's desperately important so I don't worry too much.

I've just come across generalized estimating equations (GEE), and they seem to offer a lot more flexibility than ME models.

At the risk of asking an over-general question, is there any advice as to which is better for different tasks? I've seen some papers comparing them, and they tend to be of the form:

"In this highly specialised area, don't use GEEs for X, don't use ME models for Y".

I haven't found any more general advice. Can anyone enlighten me?

Thank you!

-
"they seem to offer a lot more flexibility"... Well, they also differ in their approach since GEEs are used to fit a marginal distribution, contrary to the conditional approach often of interest when using GLMM. –  chl Oct 3 '11 at 10:13
Note that glmmPQL can also fit AR correlation structures –  Tom Wenseleers Nov 25 at 20:38

Use GEE when you're interested in uncovering the population average effect of a covariate vs. the individual specific effect. These two things are only equivalent in linear models, but not in non-linear (e.g. logistic). To see this, take, for example the random effects logistic model of the $j$'th observation of the $i$'th subject, $Y_{ij}$;

$$\log \left( \frac{p_{ij}}{1-p_{ij}} \right) = \mu + \eta_{i}$$

where $\eta_{i} \sim N(0,\sigma^{2})$ is a random effect for subject $i$ and $p_{ij} = P(Y_{ij} = 1|\eta_{i})$.

If you used a random effects model on these data, then you would get an estimate of $\mu$ that accounts for the fact that a mean zero normally distributed perturbation was applied to each individual, making it individual specific.

If you used GEE on these data, you would estimate the population average log odds. In this case that would be

$$\nu = \log \left( \frac{ E_{\eta} \left( \frac{1}{1 + e^{-\mu-\eta_{i}}} \right)}{ 1-E_{\eta} \left( \frac{1}{1 + e^{-\mu-\eta_{i}}} \right)} \right)$$

$\nu \neq \mu$, in general. For example, if $\mu = 1$ and $\sigma^{2} = 1$, then $\nu \approx .83$. Although the random effects have mean zero on the transformed (or linked) scale, their effect is not mean zero on the original scale of the data. Try simulating some data from a mixed effects logistic regression model and comparing the population level average with the inverse-logit of the intercept and you will see that they are not equal, as in this example. This difference in the interpretation of the coefficients is the fundamental difference between GEE and random effects models.

Edit: In general, a mixed effects model with no predictors can be written as

$$\psi \big( E(Y_{ij}|\eta_{i}) \big) = \mu + \eta_{i}$$

where $\psi$ is a link function. Whenever

$$\psi \Big( E_{\eta} \Big( \psi^{-1} \big( E(Y_{ij}|\eta_{i}) \big) \Big) \Big) \neq E_{\eta} \big( E(Y_{ij}|\eta_{i}) \big)$$

there will be a difference between the population average coefficients (GEE) and the individual specific coefficients (random effects models). That is, the averages change by transforming the data, integrating out the random effects on the transformed scale, and then transformating back. Note that in the linear model, (that is, $\psi(x) = x$), the equality does hold, so they are equivalent.

Edit 2: It is also worth noting that the "robust" sandwich-type standard errors produced by a GEE model provide valid asymptotic confidence intervals (e.g. they actually cover 95% of the time) even if the correlation structure specified in the model is not correct.

Edit 3: If your interest is in understanding the association structure in the data, the GEE estimates of associations are notoriously inefficient (and sometimes inconsistent). I've seen a reference for this but can't place it right now.

-
(+1) About your 2nd edit, I would add that model-based variance estimators will work better with a small number of clusters (or we can use a Jacknife estimator). As for a reference, I always point to gbi.agrsci.dk/statistics/courses/phd07/material/Day10, which contains very nice lectures notes (stat. background, including a comparison of GEE vs. GLMM approaches + illustrations in R). –  chl Oct 3 '11 at 18:42
Wow, what a great answer. Thanks very much. That is totally what I was looking for. And thanks to chl too for the link. +10 internets to you both. –  Chris Beeley Oct 4 '11 at 7:47
Don't GEE's also assume the higher level effects are nuisance parameters? It seems to me that is another important distinction - if one is interested in those effects, then GEE wouldn't give it to you. Alternatively, if you aren't comfortable making those distributional assumptions, then maybe GEE would be preferable. –  robin.datadrivers Dec 5 at 4:37

GEE in my mind is most useful when we are not using Bayesian modeling and when a full likelihood solution is not available. Also, GEE may require larger sample sizes in order to be sufficiently accurate, and it is very non-robust to non-randomly missing longitudinal data. GEE assumes missing completely at random whereas likelihood methods (mixed effect models or generalized least squares, for example) assume only missing at random.

-

You can find a thorough discussion and concrete examples in Fitzmaurice, Laird and Ware, Applied Longitudinal Analysis, John Wiley & Sons, 2011, 2nd edition, Chapters 11-16.

As to the examples, you can find datasets and SAS/Stata/R programs in the companion website.

-
Could you summarize the main points of this book? –  chl May 9 at 13:58
I'd say that Macro has already done it ;-) In the book you can find longer and more detailed discussion, some analytical, numerical and graphical examples, and some further points, among them what Frank Harrell has added. You could also look at Gelman's blog. –  Sergio May 9 at 18:21