Skip to content

wilcoxonSignedRankTest(differences, options?): WilcoxonSignedRankTestResult

Defined in: packages/hypothesis-test/src/wilcoxon-signed-rank-test.ts:73

Wilcoxon signed-rank test of whether the distribution of differences is symmetric about zero, matching scipy.stats.wilcoxon with zero_method='wilcox'. For paired samples pass first[i] - second[i]; for one sample pass value - median. greater tests that differences tend to be positive. Zero differences are dropped, and tied absolute values take average ranks.

The exact null distribution is built in O(n³) time for n nonzero differences, up to 500. With zeros or ties the exact p-value rounds the statistic conservatively, as SciPy does. The normal approximation applies the tie correction.

When every difference is zero nothing is ranked. SciPy returns NaN there; this function throws.

ArrayLike<number>

WilcoxonSignedRankTestOptions

WilcoxonSignedRankTestResult

With EMPTY_SAMPLE, NON_FINITE_SAMPLE, INVALID_OPTION (also for an exact method above 500 nonzero differences), or ZERO_VARIANCE when every difference is zero.