statsmodel_training.py 418 B

1234567891011121314151617181920
  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Tue Apr 9 11:11:14 2024
  4. @author: arefks
  5. """
  6. import numpy as np
  7. import pandas as pd
  8. import statsmodels.api as sm
  9. import statsmodels.formula.api as smf
  10. # grab the data/load data
  11. data = sm.datasets.get_rdataset("dietox", "geepack").data
  12. data.head()
  13. model = smf.mixedlm("Weight ~ Time",data,groups=data["Pig"])
  14. res = model.fit(method=["lbfgs"])
  15. res.summary()