Skip to content

Instantly share code, notes, and snippets.

@smazzanti
Last active December 18, 2020 19:47
Show Gist options
  • Save smazzanti/cba733b0fa9631c3f79e1aa28a20bb22 to your computer and use it in GitHub Desktop.
Save smazzanti/cba733b0fa9631c3f79e1aa28a20bb22 to your computer and use it in GitHub Desktop.
model = smf.mixedlm(formula = 'y ~ 1', data = y.to_frame(), groups = x).fit()
intercept = model.params['Intercept']
random_effect = x.replace({k: float(v) for k, v in model.random_effects.items()})
glmm_encoding = intercept + random_effect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment