Skip to content

Instantly share code, notes, and snippets.

@jcheong0428
Last active March 20, 2021 05:23
Show Gist options
  • Select an option

  • Save jcheong0428/a1149d323c94141d5fb4699ccd30a8fc to your computer and use it in GitHub Desktop.

Select an option

Save jcheong0428/a1149d323c94141d5fb4699ccd30a8fc to your computer and use it in GitHub Desktop.
lmer1
!pip install -q statsmodels
import numpy as np
import pandas as pd
import statsmodels.api as sm
import statsmodels.formula.api as smf
data = sm.datasets.get_rdataset('dietox', 'geepack').data
md = smf.mixedlm("Weight ~ Time", data, groups=data["Pig"], re_formula="~Time")
mdf = md.fit(method=["lbfgs"])
print(mdf.summary())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment