Ask Mallard
Core concept

Choosing mixed effects or GEE

4 min read

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

Before you start

What to check in your study

Decide these first
  1. 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.
  2. 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.
  3. How many independent clusters there areclusteredrepeatedMeasuressamplingStructurePrecision depends on clusters, not patients or visits. Under about 30, either model needs a small-sample method.
  4. 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.
It rests on these
  1. 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.
  2. 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.
  3. 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.
  4. 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.

Cluster curves and the population curve
Several steep S-shaped curves, one per cluster, and a thicker population-average curve that is flatter, because averaging steep logistic curves spreads them out. This holds for a logistic link; with an identity link the two can coincide.Subject-specific curves and the population-average curveExposureProbability of the outcomePopulation average: flatterEach cluster: steepWith a logistic link, averaging steep cluster-specific curves gives a flatter population curve, so a mixedmodel's odds ratio and a GEE odds ratio answer different questions. With an identity link the two cancoincide.
Conceptual diagram. It shows the structure of the idea, not data from any study.
Interpretation before software

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

Invented for illustration
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

Searching PubMed…

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.

No Mallard code example points to this page.
Atlas node concept.choosing_mixed_gee, the id a plan cue records.

Related Learn pages

Related designs and methods

Evidence

Sources & further reading

  1. Models for longitudinal data: a generalized estimating equation approach (opens in a new tab) · Biometrics
  2. 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
  3. 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
Prepared with AI assistance. Methodological and source checks are documented in this release; this is educational material, not independent professional approval. Reporting guidance supports transparent reporting and does not establish validity. Retained PubMed records were rechecked by PMID and title on 2026-11-06: record verified, confirm it supports this use.
Last source review: 2026-11-06
AI-generated educational content
Mallard uses reputable methodological and reporting sources, but this material may contain errors or omit important context. Verify important methodological decisions with the cited sources and, when appropriate, a qualified research methodologist or statistician.