# wilcoxonSignedRankTest

> **wilcoxonSignedRankTest**(`differences`, `options?`): [`WilcoxonSignedRankTestResult`](/reference/knotkit/hypothesis-test/interfaces/wilcoxonsignedranktestresult/)

Defined in: [packages/hypothesis-test/src/wilcoxon-signed-rank-test.ts:73](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/hypothesis-test/src/wilcoxon-signed-rank-test.ts#L73)

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.

## Parameters

### differences

`ArrayLike`<`number`>

### options?

[`WilcoxonSignedRankTestOptions`](/reference/knotkit/hypothesis-test/interfaces/wilcoxonsignedranktestoptions/)

## Returns

[`WilcoxonSignedRankTestResult`](/reference/knotkit/hypothesis-test/interfaces/wilcoxonsignedranktestresult/)

## Throws

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.
