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.

Why It Matters

Open Questions

Related