Tutorials › Generalized Linear Mixed Models (GLMM) › Choosing GLMM Or GEE For Study Designs

GLMM Versus GEE · Tutorial 146 of 698

Choosing GLMM Or GEE For Study Designs

Learn how the study’s sampling and assignment structure, together with the scientific question, guide a defensible choice between GLMM and GEE.

Intermediate 10 min read

What You'll Learn

  • Distinguish conditional GLMM effects from population-averaged GEE effects.
  • Identify the relevant independent sampling or randomization unit in common study designs.
  • Choose an approach for longitudinal cohorts, cluster-randomized trials, and multicenter studies.
  • Check the assumptions and limitations that matter for each choice.
  • Recognize why a large number of observations does not necessarily mean many independent clusters.

Start With the Design and the Scientific Question

Repeated measurements and clustered sampling create dependence: outcomes from the same participant, clinic, or hospital may be more alike than outcomes from different clusters. A generalized linear mixed model (GLMM) and generalized estimating equations (GEE) both accommodate this dependence, but they describe effects differently. The choice is not simply a matter of which method produces a smaller standard error. It should reflect what effect the study is meant to describe and how its observations were sampled or assigned.

A useful first step is to name the unit that carries the dependence and the unit that was sampled or randomized. These may differ. In a longitudinal cohort, participants are usually sampled and each participant contributes repeated observations. In a cluster-randomized trial, clinics or schools—not the individual patients within them—are assigned to treatment. In a multicenter study, hospitals may be a sample from a wider population of centers, or they may be the specific centers to which conclusions are intended to apply.

Definition: A GLMM specifies the outcome distribution and mean conditional on random effects. For observation \(i\) in cluster \(j\), a common form is \(g\{E(Y_{ij}\mid b_j)\}=X_{ij}\beta+Z_{ij}b_j\), where \(g\) is a link function and \(b_j\) represents cluster-specific random effects. GEE specifies a marginal mean \(g\{E(Y_{ij})\}=X_{ij}\beta\), together with a working correlation for observations within a cluster. The GLMM coefficients describe conditional effects; GEE coefficients describe effects on the specified population-averaged mean scale.

The distinction matters especially for nonlinear links such as the logit link. A GLMM coefficient for a binary outcome describes a contrast conditional on the random effects; a GEE coefficient describes a contrast in the marginal mean. These coefficients need not be equal, even when both models use the same covariates. Neither is automatically the right answer: the study question determines which interpretation is relevant.

Assumptions That Matter for the Choice

A GLMM requires a suitable conditional outcome model: the chosen distribution and link should describe outcomes given the random effects, and the random-effects distribution should be adequately specified for the intended analysis. A common specification assumes that random effects follow a normal distribution and are independent across clusters, and that observations are conditionally independent given those effects. Other conditional dependence structures are possible, but they must be specified. The model also needs a defensible assumption about how random effects relate to included covariates.

GEE requires a correctly specified marginal mean model and independent clusters. Within-cluster dependence is represented by a working correlation; the estimating procedure can use a sandwich variance estimate to support inference when that correlation is misspecified, provided the mean model is right and there are enough independent clusters for the approximation to work well. A robust variance estimate does not repair a misspecified mean model, and it cannot make a small number of clusters behave like a large one.

Both approaches rely on the observed data supporting the comparisons being made. For example, a cluster-level treatment cannot be separated from a covariate that is perfectly aligned with treatment without additional information or assumptions. Cluster size and cluster selection can also affect the population an analysis effectively represents. Those issues should be considered when stating the scientific target, not treated as automatic advantages of either method.

Justification: The different interpretations follow from conditioning. For a GLMM, the marginal mean is obtained by averaging the conditional mean over the random-effects distribution: \(E(Y_{ij}\mid X_{ij})=\int E(Y_{ij}\mid X_{ij},b_j)f(b_j)\,db_j\). With a nonlinear link, this average is generally not the conditional mean evaluated at the average random effect. Thus a conditional GLMM coefficient and a marginal GEE coefficient generally describe different contrasts.

Longitudinal Cohorts: Repeated Outcomes Within Participants

In a longitudinal cohort, participants are commonly the independent clusters and visits are repeated observations within each participant. If the scientific question concerns an average change or association across the cohort, GEE is a natural option because its mean model directly describes population-averaged outcomes. A GLMM is also reasonable when the question concerns effects conditional on participant-specific tendencies, or when representing that heterogeneity through random effects is important to the analysis.

The decision should not be made from the word “longitudinal” alone. A GEE analysis must still use a plausible mean model, and its working correlation should be chosen with the observed visit structure in mind. A GLMM must use a defensible random-effects structure and distribution. In either case, the analysis should identify the participant as the unit linking repeated observations, rather than treating every visit as independent.

Worked Example: Repeated Symptoms in a Hypothetical Cohort

Suppose a hypothetical cohort follows 120 participants annually for four visits, with complete binary symptom status recorded at every visit. The dataset therefore has \(120\times4=480\) observations, but only 120 independent participant clusters. At baseline, 36 participants report symptoms; at the final visit, 24 do.

The observed proportions are \(36/120=0.300\) at baseline and \(24/120=0.200\) at the final visit, a descriptive difference of \(0.200-0.300=-0.100\), or 10 percentage points lower at the final visit. These two proportions alone are not a fitted longitudinal model and do not account for covariates or the intermediate visits.

If the goal is to describe an average population-level association between visit and symptom status, a marginal logistic GEE is a reasonable candidate. As a deliberately simplified endpoint calculation, the log-odds difference is \(\log(0.200/0.800)-\log(0.300/0.700)=-1.3863-(-0.8473)=-0.5390\) over three years. Dividing by three gives \(-0.1797\) per year, corresponding to an odds ratio of \(\exp(-0.1797)=0.8356\) per year under a constant linear change in log odds. This calculation summarizes only the endpoints; a GEE fitted to all four visits would use the repeated records and a chosen mean model.

A GLMM could instead be considered if the study asks about the visit association conditional on participant-specific random effects. The choice cannot be settled by the raw proportions: it depends on whether the desired description is population-averaged or conditional, and on whether the corresponding model assumptions are credible.

Cluster-Randomized Trials: Assignment at the Cluster Level

In a cluster-randomized trial, treatment assignment is shared by everyone in a randomized clinic, school, or other group. Consequently, the number of randomized clusters is central to inference. Counting patients as though each were independently assigned exaggerates the information available for comparing arms. GEE is often appealing when the target is an average treatment contrast in the trial population, while a GLMM can describe treatment effects conditional on cluster random effects. The treatment assignment unit and the effect interpretation should both be made explicit.

Worked Example: A Hypothetical Clinic-Randomized Trial

Suppose 24 hypothetical clinics are randomized equally, 12 to each arm, and each enrolls 20 patients. There are \(24\times20=480\) patients, but treatment was randomized to 24 clinics. Assume, for illustration, an intracluster correlation of \(\rho=0.05\) and equal cluster size \(m=20\).

For equal cluster sizes, the usual design-effect approximation is \(1+(m-1)\rho=1+19(0.05)=1.95\). Thus \(480/1.95=246.2\) is a rough independent-observation equivalent for variance planning under this simple approximation. It is not a claim that the trial has 246 independently randomized units: there are still 24 randomized clinics.

Suppose the hypothetical endpoint is observed in 42 of 240 patients in the intervention arm and 54 of 240 in the control arm. The observed proportions are \(42/240=0.175\) and \(54/240=0.225\); their crude difference is \(0.175-0.225=-0.050\), or 5 percentage points lower in the intervention arm. Treating the 480 patient records as independent would ignore the assignment structure and understate uncertainty.

If the scientific target is an average arm contrast, GEE can express that marginal mean comparison, but 24 clusters warrant caution with large-sample sandwich inference and consideration of appropriate small-sample procedures. A GLMM is an alternative if a conditional cluster-specific effect is suitable and its random-effects assumptions are plausible. Neither method removes the limitation created by having only 24 randomized units.

The design-effect calculation has a simple justification. If each cluster has \(m\) observations with common variance \(\sigma^2\), and any two observations in a cluster have correlation \(\rho\), the variance of a cluster total is \(m\sigma^2+m(m-1)\rho\sigma^2\). Relative to \(m\) independent observations, this is multiplied by \(1+(m-1)\rho\). The approximation illustrates why adding patients within existing clusters can provide less additional information than adding independent clusters.

Multicenter Studies: Are Centers Sampled or Fixed?

A multicenter study needs a clear account of how centers enter the scientific target. If centers are viewed as sampled from a broader population of hospitals and center-to-center variability is scientifically relevant, a GLMM with center-level random effects may represent that structure. If conclusions are intended only for the particular centers in the study, center fixed effects may be more directly aligned with that scope. GEE can be useful for a population-averaged association across centers when the marginal mean is the target and the number of independent centers supports the variance method.

These are not interchangeable labels for the same analysis. A random-effects model makes distributional assumptions about variation across centers; fixed center effects describe the included centers without treating them as a random sample from a center population. GEE specifies a marginal mean and uses clusters to account for dependence. The number of centers, how they were selected, and the intended scope of inference all matter.

Worked Example: A Hypothetical Multicenter Treatment Study

Suppose a hypothetical study enrolls 720 patients from 18 hospitals, with 40 patients per hospital. Twelve hospitals are community hospitals and six are referral hospitals. Assume patients receive treatment individually within hospitals, so treatment is not assigned at the hospital level.

If the investigators want a treatment association averaged over the patients and hospital mix represented in the study, GEE with hospital as the clustering unit is a candidate, provided the marginal mean model is appropriate and 18 independent clusters are adequate for the planned inference. If the aim is instead to describe treatment differences conditional on hospital-specific propensity, a GLMM with hospital random effects may be considered, subject to the conditional model and random-effects assumptions.

If the target is explicitly the 18 participating hospitals, including hospital as a fixed effect is another possibility. The 720 patient records do not turn the study into 720 independent hospital environments: there are 18 hospitals. Moreover, conclusions about all hospitals require a justification for generalizing beyond those included. The design and target, rather than the number of patient rows alone, determine which analysis is defensible.

A Practical Comparison and Common Pitfalls

Study featureGEE is often considered whenGLMM is often considered when
Longitudinal cohortThe main description is a population-averaged association across participants.Effects conditional on participant-specific random effects are of interest.
Cluster-randomized trialThe target is a marginal arm contrast and there are enough clusters for reliable inference.A conditional cluster-specific contrast and a defensible random-effects model are suitable.
Multicenter studyA marginal mean across the represented centers is the target and cluster-based inference is supported.Center heterogeneity is modeled through random effects, often when centers represent a broader population.

These are starting points, not automatic rules. For either method, inspect whether the mean structure is plausible and whether the independent-cluster count supports the intended inference. For a GLMM, also examine whether the assumed random-effects structure is scientifically defensible. For GEE, a working correlation is a modeling choice for within-cluster dependence, not a substitute for a correct marginal mean.

  • Mistake: “There are hundreds of patients, so GEE has a large sample.” The relevant large-sample support for cluster-robust inference comes chiefly from the number of independent clusters, not the number of rows. Report and assess the cluster count.
  • Mistake: “A GLMM and GEE estimate the same effect, so choose the more convenient one.” Their coefficients can have conditional and marginal interpretations, respectively. State which interpretation answers the scientific question before comparing estimates.
  • Mistake: “Random effects automatically make the analysis representative of all centers.” Generalization depends on how centers were sampled and on the random-effects assumptions. A random effect alone does not justify extrapolation.
  • Mistake: “A robust GEE variance fixes any modeling problem.” The sandwich variance addresses certain correlation misspecifications; it does not correct a wrong mean model or an inadequate number of independent clusters.

The practical limitation is that neither framework can rescue a design with too few independent units for its intended inference, or a model whose mean structure does not represent the question. The strongest analysis states the outcome, the clustering or randomization unit, the target population, and the interpretation of the effect alongside the chosen method. When reasonable choices remain, sensitivity analyses using alternatives can show whether the substantive conclusion depends on those choices.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions.

  1. A cohort contains 90 participants measured at five visits. How many observations and how many participant clusters are there, assuming complete data?
  2. A trial randomizes 16 schools, eight per arm, and enrolls 30 pupils per school. Which unit is randomized, and why is the pupil count not the independent randomized sample size?
  3. For a binary outcome, why might a GLMM treatment coefficient differ from a GEE treatment coefficient?
  4. A multicenter analysis includes 10 hospitals and aims to generalize to a broad population of hospitals. Name one relevant GLMM approach and one limitation to assess.

Solutions: (1) There are \(90\times5=450\) observations and 90 participant clusters. (2) Schools are randomized, so there are 16 randomized units; pupils within a school share the school’s assignment and may have correlated outcomes. (3) The GLMM coefficient is conditional on random effects, while GEE describes a marginal mean; averaging over random effects with a nonlinear link generally does not preserve the same coefficient. (4) A GLMM with hospital random effects is one candidate if hospitals plausibly represent a broader population; with only 10 independent hospitals, estimation and inference for between-hospital variation may be weak and require careful assessment.

Clinical Biostats