Generalized Linear Mixed Effects Models

Generalized Linear Mixed Effects (GLIMMIX) models are generalized linear models with random effects in the linear predictors. statsmodels currently supports estimation of binomial and Poisson GLIMMIX models using two Bayesian methods: the Laplace approximation to the posterior, and a variational Bayes approximation to the posterior. Both methods provide point estimates (posterior means) and assessments of uncertainty (posterior standard deviation).

The current implementation only supports independent random effects.

Technical Documentation

Unlike statsmodels mixed linear models, the GLIMMIX implementation is not group-based. Groups are created by interacting all random effects with a categorical variable. Note that this creates large, sparse random effects design matrices exog_vc. Internally, exog_vc is converted to a scipy sparse matrix. When passing the arguments directly to the class initializer, a sparse matrix may be passed. When using formulas, a dense matrix is created then converted to sparse. For very large problems, it may not be feasible to use formulas due to the size of this dense intermediate matrix.


Blei, Kucukelbir, McAuliffe (2017). Variational Inference: A review for Statisticians

Module Reference

The model classes are:

BinomialBayesMixedGLM(endog, exog, exog_vc, ...)

Generalized Linear Mixed Model with Bayesian estimation

PoissonBayesMixedGLM(endog, exog, exog_vc, ident)

Generalized Linear Mixed Model with Bayesian estimation

The result class is:

BayesMixedGLMResults(model, params, cov_params)

Class to hold results from a Bayesian estimation of a Mixed GLM model.

Last update: Jun 14, 2024