Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Performing analysis of covariance with python/scipy/statsmodel

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!

like image 697
Yuxiang Wang Avatar asked Oct 21 '13 04:10

Yuxiang Wang


1 Answers

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

like image 51
Josef Avatar answered Sep 28 '22 09:09

Josef