Generalized Linear Mixed Model

glmmrandom-effectsbayesianmcmcexponential-familylongitudinal-dataoverdispersionweighted-least-squaresmixed-effects

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 ii with observations yijy_{ij}, the conditional mean μij=E[yijγi]\mu_{ij} = E[y_{ij}|\gamma_i] satisfies g(μij)=xijβ+zijγig(\mu_{ij}) = x_{ij}'\beta + z_{ij}'\gamma_i, where g()g(\cdot) is a link function, β\beta are fixed effects common to all subjects, and γiN(0,Σ)\gamma_i \sim N(0,\Sigma) are subject-specific random deviations. The response yijγiy_{ij}|\gamma_i follows an exponential-family distribution with mean μij\mu_{ij}, accommodating binary, count, multinomial, and survival outcomes.

Key Ideas

How It Works

Iterative Weighted Least Squares (IWLS) Linearization (Gamerman 1997)

At iteration tt, linearize around current linear predictor η(t)=Xβ(t)+Zγ(t)\eta^{(t)} = X\beta^{(t)} + Z\gamma^{(t)}:

  1. Pseudo-response: y~ij=ηij(t)+(yijμij(t))g(μij(t))\tilde{y}_{ij} = \eta_{ij}^{(t)} + (y_{ij} - \mu_{ij}^{(t)}) g'(\mu_{ij}^{(t)})
  2. Weights: Wij1=b(θij(t))[g(μij(t))]2W_{ij}^{-1} = b''(\theta_{ij}^{(t)})\,[g'(\mu_{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)\beta \sim N(a, R), the working-model posterior (treating γ\gamma fixed) is:

m(t)=(R1+XWX)1(R1a+XWy~)m^{(t)} = (R^{-1} + X'WX)^{-1}(R^{-1}a + X'W\tilde{y}) C(t)=(R1+XWX)1C^{(t)} = (R^{-1} + X'WX)^{-1}

Draw candidate βN(m(t),C(t))\beta^* \sim 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βX\beta as an offset and apply the same linearization to obtain a subject-level working model. The prior γiN(0,Σ)\gamma_i \sim N(0,\Sigma) plays the role of a Gaussian "regression" prior in the working model.

Variance Components Σ

Given all γi\gamma_i, the full conditional for Σ\Sigma under conjugate Inverse-Wishart (IW) prior ΣIW(ν0,S0)\Sigma \sim \mathrm{IW}(\nu_0, S_0) is:

Σ{γi}IW ⁣(ν0+n, S0+i=1nγiγi)\Sigma|\{\gamma_i\} \sim IW\!\left(\nu_0 + n,\ S_0 + \sum_{i=1}^n \gamma_i\gamma_i'\right)

A direct Gibbs draw — no Metropolis-Hastings (MH) step needed.

Nested Random Effects

For two-level nesting (e.g., visit-level effects δijN(0,Σ2)\delta_{ij} \sim N(0,\Sigma_2) within subjects), add a third Metropolis block for δij\delta_{ij} and a second IW Gibbs block for Σ2\Sigma_2. Non-normal priors on δij\delta_{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\eta = X_R\beta_R + Z_R u_R + X_G\beta_G + Z_G u_G + Z_C u_C, 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 ukN(0,σ2)u_k \sim N(0, \sigma^2) are random effects with diagonal covariance — the smoothing parameter λ\lambda equals σ2\sigma^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 [vkvk,G,y][v_k|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\gamma_i = \beta_R + u_i^R to eliminate the βR\beta_RuRu_R posterior correlation that slows mixing. Variance component priors (Inverse-Gamma [IG], folded-Cauchy, Uniform) produce posteriors differing by 5%\le 5\% in this setting.

Quasilikelihood Approximation and the MQL/PQL Bias (Goldstein-Rasbash 1996)

The multilevel-modeling (IGLS/MLwiN) tradition estimates GLMMs by linearizing the link and iterating a generalized-least-squares fit of the resulting approximate Normal multilevel model (Goldstein 1986, 1991). How the random part is linearized defines two approximations: marginal quasi-likelihood (MQL) expands it about zero, while predictive/penalized quasi-likelihood (PQL) expands about the current estimated residuals u^j\hat u_j and retains second-order terms. Rodriguez-Goldman (1995) showed by simulation that first-order MQL is severely downward-biased — in both fixed effects and variance components — exactly when random-effect variances are large, clusters are small, and the response is binary. Goldstein-Rasbash (1996) show that moving to (second-order) PQL largely removes this bias while keeping the fast IGLS machinery. PQL is thus the frequentist-quasilikelihood counterpart of the Bayesian routes below; both are approximations, and the residual bias for very sparse binary data is what ultimately motivates adaptive quadrature, Laplace/INLA, and full MCMC.

Bayesian Inference via INLA (Fong-Rue-Wakefield 2010)

Pseudo-likelihood (the SAS/GLIMMIX lineage) (Wolfinger-O'Connell 1993)

The same linearize-and-iterate idea appears in the mixed-model-software tradition as pseudo-likelihood (PL). Expand the link about the current fit to form a modified dependent variable y=η^+(yμ^)g(μ^)y^*=\hat\eta+(y-\hat\mu)g'(\hat\mu), which (approximately) obeys a Gaussian linear mixed model; then alternate solving the mixed-model equations for the fixed and random effects with re-estimating the variance components by REML on the current pseudo-data, rebuilding yy^* each pass. Because the inner engine is a general LMM, arbitrary structured covariances go on both the random effects (G-side) and the correlated errors (R-side), an overdispersion parameter is optional, and both subject-specific and population-averaged effects are recovered. This is essentially PQL by another name (and the method behind SAS PROC GLIMMIX); it shares PQL's weakness — bias for sparse binary/clustered data, dramatized by the salamander-mating benchmark — which is what motivates the quadrature/Laplace/MCMC routes.

Because a GLMM is a latent Gaussian model (Gaussian random effects on the linear predictor, non-Gaussian likelihood), its posterior can be computed by integrated nested Laplace approximations (INLA) rather than MCMC. INLA deterministically approximates the marginal posteriors of the hyperparameters and of each latent-field component by nested Laplace approximations, returning accurate posteriors in seconds-to-minutes with no chains and no convergence diagnostics. Fong-Rue-Wakefield (2010) rework the full set of Breslow-Clayton (1993) penalized-quasi-likelihood examples in this framework and stress prior specification on interpretable scales: put the prior on a random effect's marginal standard deviation, or, for a penalized-spline term, choose the smoothing-variance prior to match a target implied degrees of freedom — the reflexive IG(ϵ,ϵ)\mathrm{IG}(\epsilon,\epsilon) prior on a variance is not non-informative and can distort the fit or even give an improper posterior. The one regime where these deterministic approximations (like PQL itself) are least reliable is clustered binary data, where each cluster carries little information and checking against MCMC is advisable.

Why It Matters

Open Questions

Related