简体   繁体   English

如何从statsmodels python中的results.f_test中提取F统计量和P值

[英]How to extract the F statistic and the P value from results.f_test in statsmodels python

I run the OLS.fit() and use the fitted model to get the f value for a particular category like in ANCOVA. 我运行OLS.fit()并使用拟合的模型来获取特定类别的f值,例如在ANCOVA中。

res = OLS.fit()
R = [[0,1,0], [0,0,1]]
res.f_test(R)

The result is in the form of 结果的形式为

<F test: F=array([[ 2.21065884]]), p=[[ 0.10971892]], df_denom=5918, df_num=2>

How would I be able to get the F array and the p value from this format? 如何从这种格式中获取F数组和p值? or Is it even possible? 甚至有可能吗?

Assign the results to store it and then check the attributes. 分配结果以存储它,然后检查属性。

fres = res.f_test(R)
dir(fres)
fres.fvalue
fres.pvalue

or similar, since I am working with statsmodels master 或类似,因为我正在使用statsmodels master

http://statsmodels.sourceforge.net/devel/generated/statsmodels.regression.linear_model.RegressionResults.f_test.html http://statsmodels.sourceforge.net/devel/generation/statsmodels.regression.linear_model.RegressionResults.f_test.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM