Content
Summary
Generalized linear mixed models (GLMMs) extend generalized linear models by incorporating both fixed effects, which are constant across groups, and random effects, which vary across groups to account for hierarchical data structures. This framework allows for flexible modeling of responses by combining linear and non-parametric components, such as spline basis functions, to capture complex relationships within grouped data.
Intuition
Think of a GLMM as a tool designed specifically for data that has a nested or hierarchical structure, such as medical studies where subjects are clustered by ethnicity or repeated measurements are taken on individuals. The 'mixed' nature of the model is key: it simultaneously estimates fixed effects, which represent general trends shared by all groups, and random effects, which capture the specific variations unique to each group. By allowing parameters to vary across groups while tying others across all groups, the model can handle individual-specific variations and general trends alike. This flexibility is enhanced by the use of basis functions, which can be linear or non-parametric (like splines), enabling the model to fit complex, non-linear relationships, such as how age affects spinal bone mineral density, while remaining robust against prior mis-specification.
Key equations
The expected response is a function of linear combinations of basis functions applied to item-level inputs and group-level inputs , with random effects and fixed effects .
Derivation
- Start with a Generalized Linear Model (GLM) framework which models the expected response based on inputs.
- Extend the GLM by introducing a hierarchical structure where data is grouped.
- Decompose the model parameters into fixed effects (, ) which are constant across all groups, and random effects (, ) which vary by group .
- Incorporate basis functions (phi_k) to map both item-level inputs (x_ij) and group-level inputs (x_j) to the linear predictor.
- Apply a link function g to the linear combination of these components to model the expected response E[y_ij|...].
- Allow for semi-parametric flexibility by using non-parametric components like spline basis functions within the phi_k terms to capture non-linear relationships.
Worked example
A researcher wants to analyze spinal bone mineral density across different ethnic groups, accounting for the non-linear effect of age and individual variation within groups.
- Identify the hierarchical structure: individuals are grouped by ethnicity.
- Select fixed effects () to capture the overall trend of age on density shared across all groups.
- Select random effects (beta_j) to allow the intercept or slope to vary randomly for each ethnic group.
- Use spline basis functions (phi_k) for the age variable to model the non-linear relationship between age and bone density.
- Fit the GLMM to obtain posterior predicted means and variances, visualizing the relationship between age, ethnicity, and density.
Answer The GLMM successfully decomposes the variation in bone mineral density into group-specific random effects and a flexible, non-linear fixed effect of age, providing a robust fit that accounts for both individual and group-level variations.
Common mistakes
- Confusing fixed effects with random effects: fixed effects are constant across groups, while random effects vary randomly across groups.
- Assuming GLMMs are only linear: GLMMs can be semi-parametric, incorporating non-linear components like spline basis functions.