Português

Wilcoxon signed-rank test

Ranks (nonparametric) · Two paired samples · reference distribution: W (normal for large n)

When to use it

Compare two paired measurements without assuming the differences are normal.

Null hypothesis

The distribution of the differences is symmetric around zero.

Assumptions

Test statistic

W = \sum_{d_i > 0} \operatorname{rank}(|d_i|)

Effect size

r, from the z of the normal approximation (n is the number of pairs).

r = \dfrac{|z|}{\sqrt{n}}

How to report it

V = 21, z = −2.21, p = .027, r = .57

In R and Python

R
wilcox.test(after, before, paired = TRUE)
Python
stats.wilcoxon(after, before)

In Python, stats is scipy.stats and np is numpy.

Variants and alternatives

Where it sits in the catalog

Ranks (nonparametric). Nonparametric tests assume no distribution for the data. They replace each value by its rank, its position in order (1st, 2nd, 3rd…), which protects them from extreme values and makes them fit ordinal data.

Two paired samples. Two measurements linked in pairs: the same individual before and after, or matched pairs, such as twins. The test uses the difference within each pair.

In the decision tree

  1. What do you want to do? Compare groups, or one group with a reference value
  2. What kind of response did you measure? Numeric: a measurement, such as weight, time or score
  3. How many groups or measurements? Two groups
  4. Are the groups made of different individuals or the same individuals? The same individuals, such as before and after (paired)
  5. Are the differences between pairs approximately normal? No, but they are symmetric

Open the decision tree