Skip to content

mannWhitneyUTest(first, second, options?): MannWhitneyUTestResult

Defined in: packages/hypothesis-test/src/mann-whitney-u-test.ts:100

Mann-Whitney U rank test of whether two independent samples come from the same distribution, matching scipy.stats.mannwhitneyu. greater tests that values of first tend to exceed values of second. The statistic is the U of first.

auto uses the exact null distribution when there are no tied values and the smaller sample has at most 8 values, which is SciPy’s rule, provided the distribution costs at most 2e7 steps to build; otherwise it uses the normal approximation with tie correction. exact with tied values truncates the statistic as SciPy does. Building the exact distribution takes O(m² n) time and O(m n) space for sizes m <= n.

When every value is equal the variance is zero. SciPy returns NaN there; this function throws.

ArrayLike<number>

ArrayLike<number>

MannWhitneyUTestOptions

MannWhitneyUTestResult

With EMPTY_SAMPLE, NON_FINITE_SAMPLE, INVALID_OPTION (also for an exact method beyond the work limit), or ZERO_VARIANCE.