Definition
A generalized linear mixed model (GLMM) extends the generalized linear model (GLM) to clustered or longitudinal data by incorporating subject-specific random effects. For subject i with observations yij, the conditional mean μij=E[yij∣γi] satisfies g(μij)=xij′β+zij′γi, where g(⋅) is a link function, β are fixed effects common to all subjects, and γi∼N(0,Σ) are subject-specific random deviations. The response yij∣γi follows an exponential-family distribution with mean μij, accommodating binary, count, multinomial, and survival outcomes.
Key Ideas
- Link function and exponential family: The mean-linear predictor relationship is mediated by g(μij); common choices are logit (binary), log (Poisson/count), and probit (binary). The variance function b′′(θij) determines how spread scales with the mean.
- Marginal intractability: Unlike the normal Mixed Regression Model (MRM), integrating out γi does not yield a closed form for the marginal likelihood p(yi∣β,Σ) — this forces numerical or sampling-based estimation.
- Conditional independence: Given γi, all observations within subject i are independent; the correlation structure arises entirely through the shared random effect.
- Overdispersion: Random effects absorb extra-binomial or extra-Poisson variation not explained by covariates; without them, standard GLMs underestimate standard errors for clustered data.
- Nested random effects: Multiple levels of grouping (subjects within clusters, visits within subjects) add independent random effect terms at each level, each with its own variance component.
How It Works
Iterative Weighted Least Squares (IWLS) Linearization (Gamerman 1997)
At iteration t, linearize around current linear predictor η(t)=Xβ(t)+Zγ(t):
- Pseudo-response: y~ij=ηij(t)+(yij−μij(t))g′(μij(t))
- Weights: Wij−1=b′′(θij(t))[g′(μij(t))]2
This converts the non-Gaussian likelihood into a locally equivalent weighted Normal model.
Weighted Least Squares (WLS) Proposal for β
With prior β∼N(a,R), the working-model posterior (treating γ fixed) is:
m(t)=(R−1+X′WX)−1(R−1a+X′Wy~)
C(t)=(R−1+X′WX)−1
Draw candidate β∗∼N(m(t),C(t)) and accept via the Metropolis ratio. The acceptance rate exceeds 95% in well-specified models because the proposal closely tracks the true posterior.
WLS Proposal for γᵢ
Treat Xβ as an offset and apply the same linearization to obtain a subject-level working model. The prior γi∼N(0,Σ) plays the role of a Gaussian "regression" prior in the working model.
Variance Components Σ
Given all γi, the full conditional for Σ under conjugate Inverse-Wishart (IW) prior Σ∼IW(ν0,S0) is:
Σ∣{γi}∼IW(ν0+n, S0+i=1∑nγiγi′)
A direct Gibbs draw — no Metropolis-Hastings (MH) step needed.
Nested Random Effects
For two-level nesting (e.g., visit-level effects δij∼N(0,Σ2) within subjects), add a third Metropolis block for δij and a second IW Gibbs block for Σ2. Non-normal priors on δij (e.g., Student-t via scale mixture) add one scalar auxiliary variable block.
General Design: Splines, Kriging, and GAMs (Zhao-Staudenmayer-Coull-Wand 2006)
Decompose the linear predictor as η=XRβR+ZRuR+XGβG+ZGuG+ZCuC, separating (R) grouped/longitudinal, (G) general-design (splines, Generalized Additive Models (GAMs)), and (C) spatial (conditional autoregressive, CAR) components. The key unification: penalized spline coefficients uk∼N(0,σ2) are random effects with diagonal covariance — the smoothing parameter λ equals σ2 and is estimated from the data like any variance component. This brings GAMs, generalized additive mixed models, varying-coefficient models, and low-rank kriging all inside the GLMM framework. Full conditionals [vk∣v−k,G,y] are log-concave for canonical exponential families → adaptive rejection sampling (Gilks-Wild 1992) or slice sampling handles the non-conjugate blocks. WinBUGS implements this without user-written MCMC code. Hierarchical centering for grouped random effects: reparameterise γi=βR+uiR to eliminate the βR–uR posterior correlation that slows mixing. Variance component priors (Inverse-Gamma [IG], folded-Cauchy, Uniform) produce posteriors differing by ≤5% in this setting.
Why It Matters
- Clustered non-Gaussian data: Binary outcomes from repeated measurements (clinical trials, surveys) and longitudinal count data (epilepsy seizures, health-service utilization) violate the normality assumption of the MRM but are naturally handled by GLMMs.
- Correct inference for clustered designs: Ignoring within-subject correlation in a GLM deflates standard errors; the GLMM restores proper uncertainty quantification.
- Subject-specific vs. population-average interpretation: GLMM coefficients describe changes for a specific individual (conditional on γi), which differs from the marginal (population-average) interpretation of Generalized Estimating Equations (GEE) when g is nonlinear.
- Full Bayesian uncertainty: The Gamerman (1997) MCMC approach provides full posteriors over β, Σ, and all γi, including uncertainty about variance components that frequentist Restricted Maximum Likelihood (REML) treats as fixed once estimated.
Open Questions
- Proposal quality at extreme responses: When binary observations are very sparse (near 0 or 1), the IWLS linearization poorly approximates the likelihood and acceptance rates can drop sharply.
- High-dimensional random effects: For large n (many subjects), storing and updating {γi} individually may be slow; blocked updates or auxiliary-variable augmentation (Albert-Chib 1993b style) can accelerate sampling.
- Marginal vs. conditional interpretation: Applied researchers must choose between GLMM (conditional) and GEE (marginal) based on the scientific question; the two are not interchangeable when g is nonlinear (logit, log).
- MCMC vs. INLA vs. HMC: Gamerman's MCMC approach has been largely superseded in practice by R-INLA (Integrated Nested Laplace Approximation (INLA), very fast) and Stan (Hamiltonian Monte Carlo (HMC)/No-U-Turn Sampler (NUTS)); the WLS-proposal idea remains instructive for hand-crafted samplers.
- CAR spatial random effects: When the random effect covariance is specified via a conditional autoregressive (CAR) prior (see Conditional Autoregressive Model), the GLMM posterior may be improper; Sun-Tsutakawa-Speckman (1999) give necessary and sufficient rank conditions for propriety even when the CAR precision matrix is singular.
Related