我尝试使用R
' s nlme
包来比较两个模型
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))
这打印了很多输出但不是我真正感兴趣的输出。在R
我只是得到:
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
有没有办法在python(statsmodels
?)中获得类似内容?