I normally use lme4 package in R to run mixed effects regression models. What are some recommended packages in Python to do this?
There are several Python packages that can run mixed effects models.
-
The statsmodels package has a linear mixed effects module. However, the implementation is not as fast or as fully featured as lme4.
-
The Bayesian Model-Building Interface (BAMBI) package was developed by Jake Westfall and Tal Yarkoni and provides a high-level bayesian model building interface to pymc3. The syntax is designed to be similar to running models in lme4.
-
Pymer4 was developed by Eshin Jolly and provides a python wrapper to lme4 in R. It is designed to provide the same functionality and interface used in lme4 in R, but using pandas dataframes.
A comparison between a few of these (and some other) implementations: https://github.com/junpenglao/GLMM-in-Python/blob/master/GLMM_in_python.ipynb