简体   繁体   中英

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.

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? 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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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