Skip to content

kruskalWallisTest(groups): KruskalWallisTestResult

Defined in: packages/hypothesis-test/src/kruskal-wallis-test.ts:27

Kruskal-Wallis H-test of whether k >= 2 independent groups come from the same distribution, matching scipy.stats.kruskal. The p-value is the upper tail of the chi-squared distribution with k - 1 degrees of freedom, so there is no alternative, and it is an approximation that is unreliable for groups of fewer than about five values. Uses O(N log N) time and O(N) space for N observations.

When every observation is equal the tie correction is zero. SciPy returns NaN there; this function throws.

ArrayLike<ArrayLike<number>>

KruskalWallisTestResult

With TOO_FEW_GROUPS below two groups, EMPTY_SAMPLE, NON_FINITE_SAMPLE, or ZERO_VARIANCE.

With INVALID_PARAMETER above the supported number of groups.