Performing analysis of covariance with python/scipy/statsmodel

五迷三道 提交于 2019-12-01 06:15:11

问题


Could anyone please help in providing an example showing how ANCOVA (analysis of covariance) can be done in scipy/statsmodel, with python?

I am not sure if I am asking too much, but a quick search showed me this which is not informative enough for me.

Thanks!


回答1:


Statsmodels uses the linear model, OLS, to estimate ANOVA. So, having additional continuous regressors as in ANCOVA does not change the analysis.

Here are a few links to the relevant documentation

Anova helper functions and examples for ANCOVA interactions http://statsmodels.sourceforge.net/devel/examples/generated/example_interactions.html

using formulas to create the design matrix http://statsmodels.sourceforge.net/devel/example_formulas.html

the core OLS model http://statsmodels.sourceforge.net/devel/generated/statsmodels.regression.linear_model.OLS.html



来源:https://stackoverflow.com/questions/19486514/performing-analysis-of-covariance-with-python-scipy-statsmodel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!