-3

I am using the scipy.stats.chisquare function, as explained on https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.chisquare.html

I understand that, in general, the p-value demonstrates how well the data supports the null hypothesis. A high p-value, usually greater than 0.05, suggests that the null hypothesis is true, and vice versa.

However, the p-value of the scipy.stats chisquare function gives me high p-values when my data is similar to the expected values, and low p-values when my data is different from the expected values.

I am expecting the p-value to be small when my data closely resembles the expected values as this would indicate that the null hypothesis is false. The null hypothesis being that my data does not resemble the expected values.

What does the p-value represent in this function?

PiccolMan
  • 4,854
  • 12
  • 35
  • 53
  • A high p-value does not suggest that the null hypothesis is true. Rather, a high p-value means that our evidence is not inconsistent with the null hypothesis being true. – Duncan MacIntyre Jul 08 '21 at 04:20

1 Answers1

3

The answer is right in the documentation you linked to:

The chi square test tests the null hypothesis that the categorical data has the given frequencies.

In other words, the null hypothesis is the opposite of what you thought.

BrenBarn
  • 242,874
  • 37
  • 412
  • 384