scipy.stats: ムード検定 mood
2 つのデータが同じ分布で,尺度パラメータが等しいかどうかの検定である(ノンパラメトリック検定)。
mood(x, y, axis=0, alternative='two-sided')
戻り値は,検定統計量と $p$ 値である。
from scipy.stats import mood
import numpy as np
ramsay = np.array([111, 107, 100, 99, 102, 106, 109, 108, 104, 99,
101, 96, 97, 102, 107, 113, 116, 113, 110, 98])
jung_parekh = np.array([107, 108, 106, 98, 105, 103, 110, 105, 104,
100, 96, 108, 103, 104, 114, 114, 113, 108, 106, 99])
mood(ramsay, jung_parekh)
(0.9919203990624894, 0.32123635731324385)
R の mood.test
と結果が異なる。理由は,わからない。
> example(mood.test)
md.tst> ## Same data as for the Ansari-Bradley test:
md.tst> ## Serum iron determination using Hyland control sera
md.tst> ramsay <- c(111, 107, 100, 99, 102, 106, 109, 108, 104, 99,
md.tst+ 101, 96, 97, 102, 107, 113, 116, 113, 110, 98)
md.tst> jung.parekh <- c(107, 108, 106, 98, 105, 103, 110, 105, 104,
md.tst+ 100, 96, 108, 103, 104, 114, 114, 113, 108, 106, 99)
md.tst> mood.test(ramsay, jung.parekh)
Mood two-sample test of scale
data: ramsay and jung.parekh
Z = 1.0371, p-value = 0.2997
alternative hypothesis: two.sided