Skip to main content
v2026.11,858 entries · CC-BY 4.0
LAC HealthMedical & Research SuppliesReagents, PPE & instruments — chain-of-custody documented.Fast, traceable sourcing built for regulated research environments, from bench consumables to instrumentation.Shop lac.us CodeCASRAIlac.us

GLMM: Generalized Linear Mixed Models Explained

What a GLMM (generalized linear mixed model) is, how to read its conditional estimates with worked numbers, and how to fit and report one.

Written and maintained by CASRAI Editorial Board

Last updated

GLMM in research stands for generalized linear mixed model, a regression model for non-normal outcomes (binary, count, proportion) whose data are grouped or repeated, such as patients within doctors or repeated measures on the same subject. This page covers the statistical term only; searches for “glmm” in games, anime or social media slang are a different subject. After reading you should be able to decide whether a GLMM fits your data, interpret its coefficients correctly, and report it.

What does GLMM mean? Definition in one paragraph

A generalized linear mixed model combines two ideas. From a generalized linear model it takes a link function and a non-normal outcome distribution (for example logit with a binomial outcome, or log with a Poisson count). From a mixed-effects model it takes random effects that capture variation between groups (clusters). Given the random effects, the outcome follows an exponential-family distribution, and the random effects themselves are assumed to be normally distributed (Wikipedia, “Generalized linear mixed model”, read 2026-11-07).

Formula with every symbol explained

The standard form is g(E[y | u]) = Xβ + Zu.

  • y: the outcome vector (for example remission yes/no, tumour count).
  • u: the random effects (for example one random intercept per doctor), assumed normal with mean 0 and an estimated variance.
  • g: the link function: logit for binary outcomes, log for counts, identity for normally distributed continuous outcomes (UCLA OARC, read 2026-11-07).
  • X, β: the design matrix and coefficients of the fixed effects (the predictors whose effects you want to estimate).
  • Z: the design matrix for the random effects.

Because the likelihood requires integrating over the random effects, p(y) = ∫ p(y | u) p(u) du, it has no general closed form. Software therefore approximates it: quasi-likelihood (fast but biased and not preferred for final inference), Gauss-Hermite quadrature (a single quadrature point equals the Laplace approximation; accuracy rises with more points but cost grows quickly with the number of random effects), or MCMC. No approximation performs well for every model and dataset, and ungrouped binary data are particularly difficult (Wikipedia; UCLA OARC).

Worked example with real numbers: from log-odds to subject-specific probabilities

UCLA OARC’s introduction uses a simulated dataset of 8,525 patients treated by 407 doctors and fits a mixed logistic model for cancer remission with a random intercept for doctor. The reported estimates are below; every conversion in the last two columns is computed here from those estimates.

Term Estimate (log-odds) SE Odds ratio = exp(estimate)
Intercept 1.467 0.274 exp(1.467) = 4.34
Age (per year) -0.056 0.005 exp(-0.056) = 0.946
Married (vs not) 0.26 0.064 exp(0.26) = 1.297
IL-6 (per unit) -0.053 0.011 exp(-0.053) = 0.948

Step 1, odds ratios: each extra year of age multiplies the odds of remission by 0.946, about a 5.4% reduction, holding doctor and the other predictors fixed. Ten extra years multiply the odds by exp(-0.56) = 0.571.

Step 2, the random-intercept variance is 3.979, so the standard deviation of doctor effects is √3.979 = 1.995 log-odds. For a reference patient (all other predictors at the values that give the intercept), the probability of remission is p = 1 / (1 + exp(-η)):

Doctor η = 1.467 + u Probability of remission
One SD below average (u = -1.995) -0.528 0.371
Average doctor (u = 0) 1.467 0.813
One SD above average (u = +1.995) 3.462 0.970

The same fixed effects therefore imply remission probabilities from 0.37 to 0.97 depending on the doctor, which is the between-cluster heterogeneity a plain logistic regression would ignore. The same source’s Poisson model for tumour counts (random-intercept variance 0.169) uses a log link, so its coefficients are read as rate ratios: for example, a coefficient of 0.026 for age gives exp(0.026) = 1.026, a 2.6% higher expected count per year.

Interpretation: conditional versus marginal, and what the numbers mean

GLMM coefficients and odds ratios are conditional: they compare two subjects who share the same random effect (the same doctor, the same participant). They are not population-averaged effects. Marginal effects require averaging over the random-effects distribution, and most software does not report them by default (UCLA OARC). If you want population-averaged effects, generalized estimating equations target them directly.

Quantity How to read it
Fixed-effect estimate (logit link) Change in log-odds per unit, within the same cluster; exponentiate for an odds ratio.
Fixed-effect estimate (log link) Change in log expected count per unit; exponentiate for a rate ratio.
Random-intercept variance Spread of cluster-specific baselines on the link scale; its square root is the SD shown in the worked example.
Intercept Log-odds (or log-rate) for a reference subject in an average cluster (u = 0).

GLMM compared with related models

Model Outcome Clustered data? Effects are
Linear mixed model Continuous, normal errors Yes (random effects) Conditional
Generalized linear model Binary, count, other exponential-family No Single-level
GLMM Binary, count, other exponential-family Yes (random effects) Conditional
GEE Binary, count, other Yes (working correlation) Marginal

To compare nested GLMMs (for example with and without a random slope), see likelihood ratio tests for nested models, and for random slope structure see random intercepts versus random slopes.

Assumptions and common mistakes

  • Too few random-effect levels. Guidance quoted in Ben Bolker’s GLMM FAQ (read 2026-11-07): more than 1,000 levels give accurate variance estimates, more than 100 are reasonable, 10 to 20 need careful validation, and fewer than 10 are safer treated as a fixed effect. See also Oberpriller, Leite and Pichler (2021).
  • Ignoring overdispersion. For count and binomial data, compare the sum of squared Pearson residuals with the residual degrees of freedom (an approximate check). It does not apply to models that estimate a scale parameter and cannot be estimated for Bernoulli data. Remedies include an observation-level random effect, a negative binomial or beta-binomial family, or a quasi adjustment (Bolker FAQ).
  • Relying on quasi-likelihood. Penalized quasi-likelihood is fast but biased, and the Bolker FAQ notes it is deemed unreliable in lme4 and no longer available there.
  • Reading conditional estimates as population averages (see the interpretation section).
  • Normal random effects are an assumption, not a result; inspect simulated-residual diagnostics, for example with the DHARMa R package.

How to report a GLMM (APA-style example)

Report the family and link, the random-effects structure, the estimation method and software, the number of groups, fixed effects with uncertainty, and the variance components. An illustrative template (numbers from the worked example above):

We fitted a generalized linear mixed model with a binomial family and logit link, with a random intercept for doctor (407 doctors, 8,525 patients), estimated by maximum likelihood with adaptive quadrature. Each additional year of age was associated with lower odds of remission (OR = 0.946, b = -0.056, SE = 0.005). The random-intercept variance was 3.979 (SD = 1.995). Overdispersion was checked and [result].

Checklist: family; link; random-effects terms; estimation method (Laplace, quadrature points, quasi-likelihood); package and version; number of levels per random factor; fixed effects with SE or confidence intervals; variance components; overdispersion check; statement that estimates are conditional.

How to fit a GLMM in R or Python

Statistical packages that fit GLMMs include R (lme4, glmmTMB, glmm, MASS::glmmPQL, and the Bayesian MCMCglmm and brms), SAS, SPSS, MATLAB (fitglme), Julia (MixedModels.jl) and Python statsmodels for binomial and Poisson outcomes (Wikipedia; Bolker FAQ). Microsoft Excel is not among the packages these sources list.

R, binomial outcome with a random intercept per doctor (lme4):

library(lme4)
m <- glmer(remission ~ Age + Married + IL6 + (1 | DID),
           data = hdp, family = binomial)
summary(m)
exp(fixef(m))   # odds ratios (conditional)

R, count outcome with a log link:

m2 <- glmer(tumorsize_count ~ Age + Married + IL6 + (1 | DID),
            data = hdp, family = poisson)

Python (statsmodels, variational Bayes fit, binomial):

from statsmodels.genmod.bayes_mixed_glm import BinomialBayesMixedGLM
vc = {"doctor": "0 + C(DID)"}
m = BinomialBayesMixedGLM.from_formula("remission ~ Age + Married + IL6", vc, df)
res = m.fit_vb()
print(res.summary())

The variable names (remission, DID, hdp, df) are placeholders for your own data.

FAQ

What does GLMM stand for?

In statistics and research methods, GLMM stands for generalized linear mixed model. Other meanings of “glmm” in gaming or slang contexts are unrelated to this page.

What is a GLMM used for?

It models non-normal outcomes such as binary events and counts when observations are clustered or repeated, for example patients within doctors, students within schools, or repeated measurements on one participant. The random effects absorb between-cluster variation so standard errors are not too small.

What is the difference between a GLMM and a linear mixed model?

A linear mixed model assumes a continuous outcome with normal errors. A GLMM adds a link function and a non-normal family, which is why its likelihood needs approximation (quadrature, Laplace, quasi-likelihood or MCMC).

What are GLMM random effects?

Random effects are cluster-specific deviations (intercepts, optionally slopes) assumed to come from a normal distribution with mean zero; the model estimates their variance. See mixed-effects models for the fixed versus random distinction.

Are GLMM odds ratios population averages?

No. They are conditional on the random effect. Population-averaged odds ratios need marginalisation or a GEE model.

Is logistic regression a GLMM?

Ordinary logistic regression is a generalized linear model with no random effects. A mixed logistic model with a random intercept is a GLMM.

Sources

  • Wikipedia, “Generalized linear mixed model”, en.wikipedia.org/wiki/Generalized_linear_mixed_model (read 2026-11-07).
  • UCLA OARC Statistical Consulting, “Introduction to Generalized Linear Mixed Models”, stats.oarc.ucla.edu (read 2026-11-07).
  • Bolker, B. et al., “GLMM FAQ”, bbolker.github.io/mixedmodels-misc/glmmFAQ.html (read 2026-11-07).
  • Breslow, N. E., & Clayton, D. G. (1993). Approximate inference in generalized linear mixed models. Journal of the American Statistical Association, 88(421), 9-25.
  • Stroup, W. W. (2012). Generalized Linear Mixed Models. CRC Press.
  • Oberpriller, J., Leite, M. de, & Pichler, M. (2021), on random-effect levels, as cited in the Bolker GLMM FAQ.

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about GLMM: Generalized Linear Mixed Models Explained

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →