Skip to content

Cramér von Mises test

Maurice HT Ling edited this page Aug 13, 2021 · 1 revision

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.cramervonmises_2samp(observed, expected)
>>> print("statistic = %.2f" % result.statistic)
statistic = 0.16
>>> print("p-value = %.2f" % result.pvalue)
p-value = 0.41

Reference:

  1. Cramér H. 1928. On the Composition of Elementary Errors. Scandinavian Actuarial Journal 1928(1), 13–74.
  2. Anderson TW. 1962. On the distribution of the two-sample Cramer-von-Mises criterion. The Annals of Mathematical Statistics 33(3): 1148–1159.
Clone this wiki locally