Cressie Read power divergence test - mauriceling/mauriceling.github.io GitHub Wiki

Purpose: To test whether 2 distributions are equal.

Null hypothesis: Observed distribution = Expected distribution

Alternate hypothesis: Observed distribution ≠ Expected distribution

Code:

>>> from scipy import stats
>>> observed = [16, 18, 16, 14, 12, 12]
>>> expected = [16, 16, 16, 16, 16, 8]
>>> result = stats.power_divergence(observed, expected, lambda_="cressie-read")
>>> print("statistic = %.2f" % result.statistic)
statistic = 3.43
>>> print("p-value = %.2f" % result.pvalue)
p-value = 0.63

Reference:

  1. Cressie N, Read TRC. 1984. Multinomial Goodness-of-Fit Tests. Journal of the Royal Statistical Society Series B 46(3), 440-464.