Relative Content

Tag Archive for pythonscipy

why results from stats.chisquare and stats.chi2_contingency are different even with the same data

I have an array named ‘data_count’, storing the counts of 9 digital groups. I used a Benford’s Law to generate a expected count array called ‘expected_counts’. I want to test whether two arrays have the same distribution. I have used the stats.chisquare and stats.chi2_contingency functions, but the results turned out quite different. The [scipy guide] (https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.chi2_contingency.html) says they should have the same results. Why it didn’t work on my case? Please help me, thanks a million.