The Wilcoxon signed-rank test is a non-parametric test used to compare the distribution median with a given value *m*. This criterion could be used as an alternative for one-sample Student t-test. Unlike the t-test, Wilcoxon signed-rank test can work with non-normal distributions.

This test has the following requirements:

- the scale of measurement
^{[1]}should be ordinal, interval or ratio (i.e. test could not be applied to nominal variables) - the distribution should be continuous and symmetric relative to its median
- number of distinct values in the X array should be greater than 4

**Note #1**

The distribution symmetry requirement is critical. If the distribution is non-symmetric, the test could not be used. In that case we can use less powerful (but more general) sign test.

Subroutine **WilcoxonSignedRankTest** returns three p-values:

- p-value for two-tailed test (null hypothesis - the median is equal to the given value)
- p-value for left-tailed test (null hypothesis - the median is greater than or equal to the given value)
- p-value for right-tailed test (null hypothesis - the median is less than or equal to the given value)

The test algorithm is simple. All elements which are equal to *m* are thrown out. After that we have elements of two types only: elements which are greater than *m* and which are less than *m*. Elements are sorted by their absolute value. After that *W ^{ +}* (sum of positive elements ranks) is calculated. If this hypothesis is true (the median equals

**Note #2**

Some sources recommend to use normal distribution with *μ = 0.25·N·(N+1)* and *σ ^{ 2} = N·(N+1)·(2N+1)/24* when estimating the significance level. In fact, as

- 'Level of measurement', Wikipedia
- 'Wilcoxon signed-rank test', Wikipedia
- 'Hypothesis testing', Wikipedia
- 'P-value', Wikipedia

*This article is intended for personal use only.*

ALGLIB Project offers you two editions of ALGLIB:

delivered for free

offers full set of numerical functionality

single-threaded, no low-level optimizations

non-commercial license (GPL or Personal/Academic)

flexible pricing

offers full set of numerical functionality

high performance (multithreading, SIMD, Intel MKL)

commercial license with support plan

Links to download sections for Free and Commercial editions can be found below:

ALGLIB for C++

C++ library.Delivered with sources.

Monolithic design.

Extreme portability.

ALGLIB for Delphi

Delphi wrapper around generic C core.Delivered as precompiled binary.

Compatible with FreePascal.

ALGLIB for C#

Generic C# library.Delivered with sources.

VB.NET and IronPython wrappers.

Extreme portability.

ALGLIB® - numerical analysis library, 1999-2017.

ALGLIB is a registered trademark of the ALGLIB Project.

Policies for this site: privacy policy, trademark policy.

ALGLIB is a registered trademark of the ALGLIB Project.

Policies for this site: privacy policy, trademark policy.