Choosing mixed effects or GEE
A mixed-effects model gives the effect within a typical cluster, and GEE gives the average effect across a population; for a yes-or-no outcome the two odds ratios generally differ.
Fit
When it matters, and when it does not
It matters when
- You want the effect for a typical patient or clinic, holding that cluster's own level fixed. Choose a mixed-effects model.
- You want to know how much clinics or patients differ, or to predict for a particular one.
- Dropout may depend on earlier recorded values. A mixed model uses every recorded visit, and is valid when data are missing at random.
It matters less when
- You want the average effect across the whole population, such as the change in the overall vaccination rate. GEE estimates that directly. Read: Generalized estimating equations
- You would rather not assume how cluster levels are spread. GEE needs only a model for the average and a working correlation, given enough clusters. Read: Generalized estimating equations
Before you start
What to check in your study
- Whether you want a within-cluster or a population-average effectDecide from the clinical question. For a yes-or-no outcome, the population-average odds ratio is usually closer to 1.
- The type of outcome and its linkoutcomeTypesummaryMeasureWith a continuous outcome and an identity link, the two can coincide, as can rate ratios from a log link with only a random intercept. With a logistic link they generally differ.
- How many independent clusters there areclusteredrepeatedMeasuressamplingStructurePrecision depends on clusters, not patients or visits. Under about 30, either model needs a small-sample method.
- Why visits or outcomes are missingPlain GEE needs dropout explained by the model's factors. A mixed model allows it to depend on earlier recorded values.
- The clusters in the model match how the data were collected.How to check: Sketch the levels first. A level left out, such as clinic, makes intervals too narrow in either model.
- There are enough independent clusters for the intervals.How to check: Under about 30, name a small-sample method: Kenward-Roger for a mixed model, or Mancl-DeRouen for GEE.
- The model for the average outcome is right in both.How to check: Robust errors protect GEE against a wrong working correlation, not a wrong model for the average.
- For a mixed model, cluster levels vary roughly like a bell curve.How to check: Plot the estimated cluster levels. A strong skew or one far-off cluster deserves a closer look.
Plain language
How it works
Repeated visits by one patient, or patients in one clinic, tend to resemble each other. Both models allow for that. A mixed-effects model gives each cluster its own level and estimates the effect within a typical cluster. GEE models the average across everyone and uses robust standard errors. Agree which effect the question needs, then choose the model.
With a logistic link, averaging the steep curves of separate clusters gives a flatter population curve, so GEE's odds ratio sits closer to 1. With a continuous outcome and an identity link, the two effects can coincide. A large patient count does not add independent clusters: with few clusters, either model needs a small-sample method.
Worked example
A worked example
- Setting
- 40 clinics each randomize 15 adults with asthma to a new inhaler and 15 to usual care. Half the clinics serve patients with milder asthma.
- Question
- Does the new inhaler improve asthma control at 3 months?
- Approach
- In each milder clinic, 12 of 15 reach good control with the inhaler and 10 of 15 without. In each other clinic, 5 of 15 and 3 of 15. So the odds ratio is 2 in every clinic.
- Result
- Across all clinics, 340 of 600 inhaler patients reached good control, against 260 of 600 on usual care. That is 13 more in every 100, a risk ratio of 1.31.
- What it means
- A mixed-effects model targets the odds ratio of 2 within a clinic. GEE targets the odds ratio across all patients, about 1.7. Treatment was balanced in every clinic, so the gap is not confounding.
In practice
Recent studies PubMed search · not vetted
Watch out
Common mistakes
The one to remember
For a binary outcome, a cluster-conditional odds ratio from a mixed model and a population-average odds ratio from GEE are different estimands. One is not a drop-in replacement for the other.
- Choosing between them by which gives the smaller P value or the larger effect.Instead: Choose from the question, before seeing results, and report the one you chose.
- Counting patients or visits, not clusters, when judging precision.Instead: Precision depends on the number of independent clusters. Under about 30, plan a small-sample method for either model.
- Assuming GEE handles missing visits as well as a mixed model does.Instead: Plain GEE needs dropout explained by the model's factors. If it depends on earlier results, use weighted GEE, imputation or a mixed model.
Inside Mallard
How Mallard uses this
For a clustered yes-or-no outcome with an odds ratio, Mallard's method list may include both a mixed-effects model and GEE, noting that GEE needs at least 30 independent clusters. Plans do not link to it yet.
concept.choosing_mixed_gee, the id a plan cue records.Related Learn pages
Related designs and methods
Evidence
Sources & further reading
- Models for longitudinal data: a generalized estimating equation approach (opens in a new tab) · Biometrics
- Real longitudinal data analysis for real people: building a good enough mixed model (opens in a new tab) · Stat Med · doi 10.1002/sim.3775
- Repeated Measures Designs and Analysis of Longitudinal Data: If at First You Do Not Succeed-Try, Try Again. (opens in a new tab) · Anesth Analg · doi 10.1213/ANE.0000000000003511