使用 python/scipy/statsmodel 进行协方差分析 [英] Performing analysis of covariance with python/scipy/statsmodel
问题描述
谁能帮忙提供一个示例,说明如何使用 python 在 scipy/statsmodel 中完成 ANCOVA(协方差分析)?
Could anyone please help in providing an example showing how ANCOVA (analysis of covariance) can be done in scipy/statsmodel, with python?
我不确定我是否要求太多,但快速搜索显示我this 对我来说信息量不够.
I am not sure if I am asking too much, but a quick search showed me this which is not informative enough for me.
谢谢!
推荐答案
Statsmodels 使用线性模型 OLS 来估计方差分析.因此,在 ANCOVA 中使用额外的连续回归变量不会改变分析.
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
用于 ANCOVA 交互的 Anova 辅助函数和示例http://statsmodels.sourceforge.net/devel/examples/generated/example_interactions.html
Anova helper functions and examples for ANCOVA interactions http://statsmodels.sourceforge.net/devel/examples/generated/example_interactions.html
使用公式创建设计矩阵http://statsmodels.sourceforge.net/devel/example_formulas.html
核心OLS模型http://statsmodels.sourceforge.net/devel/generated/statsmodels.regression.linear_model.OLS.html
这篇关于使用 python/scipy/statsmodel 进行协方差分析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!