How to check goodness of fit in python from Chisqu

2019-08-20 23:32发布

问题:

I want to understand how chisquare fnction works. I also read about chisquare test in which we have to check chisquare table to compare values of chi or p value with critical values. In the following code my chisquare value is 3.5. Does it correspond to right tail or left tail? Secondly p value is 0.62. I have read that 0.05 is standard for right tails on the chi square distribution curve. If p value is grater than 0.05 we accept our proposed hypothesi i.e., f_exp. But what about the following case how can I judge that whether should I accept f-exp or reject it?

`from scipy.stats import chisquare
a =chisquare([16, 18, 16, 14, 12, 12], f_exp=[16, 16, 16, 16, 16, 8])
print(a)
(3.5, 0.62338762774958223)`