I am trying to follow the example detailed here: Mixed effects logistic regression, but I get a "PackageNotInstalledError: The R package "lme4" is not installed" at the line
results = model.fit()
The dataset can be downloaded here: https://web.stanford.edu/class/archive/cs/cs109/cs109.1166/stuff/titanic.csv
My code is:
import os
import pandas as pd
import statsmodels.genmod.bayes_mixed_glm as smgb
from pymer4.models import Lmer
titanic = pd.read_csv(os.path.join(os.getcwd(), 'titanic.csv'))
model = Lmer("Survived ~ Age + (1|Pclass)",
data=titanic, family = 'binomial')
results = model.fit())
print (results)
The Lmer function works, it's just when I try to fit the model that I get the error. I had assumed the required packages would have been included within pymer4. Any ideas about how to install this package would be much appreciated.