2

I'm trying to compare two models using R's nlme package

import rpy2.robjects.robject as r

>> politeness = pd.read_csv('http://www.bodowinter.com/tutorial/politeness_data.csv')
>> mdl1=nlme.gls(Formula('frequency ~ 1'), data=politeness, method="ML", na_action="na.omit")
>> mdl2=nlme.lme(Formula('frequency ~ 1'), data=politeness, method="ML", random=Formula("~1|subject"), na_action="na.omit")
>> print(r.anova(mdl1,mdl2))

This prints lots of output but not the one I'm really interested in. In R I simply get:

  Model df      AIC      BIC    logLik   Test  L.Ratio p-value
mdl1     1  2 932.8611 937.6988 -464.4306                        
mdl2     2  3 833.2497 840.5063 -413.6249 1 vs 2 101.6114  <.0001

Is there a way to get something similar in python (statsmodels?)?

HappyPy
  • 9,839
  • 13
  • 46
  • 68

0 Answers0