scipy.stats: クラスカル・ウォリス検定 kruskal
独立標本の代表値の差の検定を行うノンパラメトリック検定である。
kruskal(*args, nan_policy='propagate', axis=0)
from scipy.stats import kruskal
import numpy as np
x = np.array([2.9, 3.0, 2.5, 2.6, 3.2])
y = np.array([3.8, 2.7, 4.0, 2.4])
z = np.array([2.8, 3.4, 3.7, 2.2, 2.0])
kruskal(x, y, z)
KruskalResult(statistic=0.7714285714285722, pvalue=0.6799647735788936)
a = np.array([41, 36, 12, 18, 28, 23, 19, 8, 7, 16, 11, 14, 18,
14, 34, 6, 30, 11, 1, 11, 4, 32, 23, 45, 115, 37])
b = np.array([29, 71, 39, 23, 21, 37, 20, 12, 13])
c = np.array([135, 49, 32, 64, 40, 77, 97, 97, 85, 10, 27, 7, 48,
35, 61, 79, 63, 16, 80, 108, 20, 52, 82, 50, 64, 59])
d = np.array([39, 9, 16, 78, 35, 66, 122, 89, 110, 44, 28, 65,
22, 59, 23, 31, 44, 21, 9, 45, 168, 73, 76, 118, 84, 85])
e = np.array([96, 78, 73, 91, 47, 32, 20, 23, 21, 24, 44, 21, 28,
9, 13, 46, 18, 13, 24, 16, 13, 23, 36, 7, 14, 30, 14, 18, 20])
kruskal(a, b, c, d, e)
KruskalResult(statistic=29.26657630611694, pvalue=6.900714118546782e-06)