user2848498
user2848498

Reputation: 57

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?

Upvotes: 0

Views: 9624

Answers (1)

Josef
Josef

Reputation: 22897

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

Upvotes: 1

Related Questions