Bayesian Wilcoxon Signed-Rank Test

Statistics
Introduced by
Benavoli, Corani, Mangili, and colleagues
Year
2014–2017
Type
Bayesian nonparametric paired test
Family
Classical statistics

What does it do?

The Bayesian Wilcoxon signed-rank test is a Bayesian nonparametric method for comparing two paired or related samples.

Instead of a single p-value, it reports posterior probabilities that one condition is worse than, practically equivalent to, or better than the other. It is intended for paired continuous or ordinal differences and does not require those differences to be normally distributed.

The intuition behind the method

The classical Wilcoxon signed-rank test answers a yes/no question with a p-value. The Bayesian version asks how probable each outcome is given the observed signed ranks: that condition A is better, that the two conditions are practically equivalent within a region of practical equivalence (ROPE), or that condition B is better. This three-part probability report lets researchers judge practical importance alongside the evidence for a difference. It avoids the binary accept/reject framing of null-hypothesis significance testing, although the probabilities depend on the prior and on the ROPE chosen, so both must be reported.

History

The Bayesian treatment of paired comparisons is associated with Benavoli, Corani, Mangili and colleagues. Their work, published in the mid-2010s, including the tutorial by Benavoli, Corani, Demsar and Zaffalon (2017), arose from a wider critique of p-value-based comparisons of classification algorithms, in which Bayesian analysis was proposed as an alternative.

When to use it

Use this test for paired or repeated-measures data when the normality assumption of a paired t-test is doubtful, or when the data are ordinal, and when you want posterior probabilities of 'worse', 'equivalent' and 'better' rather than a p-value. It is well suited to questions where establishing practical equivalence matters as much as detecting a difference. Do not use it for independent samples; the Bayesian Mann-Whitney U test is the related method for that design. Do not use it where a strict frequentist p-value is required, for example in pre-registered confirmatory testing that specifies a p-value procedure. Avoid it when the sample is so small that the prior largely determines the result, since the sensitivity analysis then carries most of the inference. Plot the paired differences before use. The signed-rank summary is easiest to interpret as a shift in location when the differences are roughly symmetric about a common centre, so strong asymmetry should be described when results are reported.

Limitations and considerations

  • The ROPE boundaries are chosen by the researcher, and the probability of equivalence can change substantially with that choice.
  • The prior concentration parameter needs justification; a near-ignorant choice may not be appropriate when the sample is small.
  • Its implementations are less common than those of the classical test, so analysis often requires specialist software or custom code.
  • Readers unfamiliar with Bayesian inference may misread a posterior probability as a p-value or as a guarantee about the true effect.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • It reports posterior probabilities for worse, practically equivalent and better, so the conclusion does not reduce to a reject/retain decision.
  • It works on signed ranks, so it does not require the paired differences to be normally distributed and can be applied to ordinal paired data where the direction of each difference is meaningful.
  • It makes the region of practical equivalence an explicit part of the analysis, so statistical and practical differences are assessed together.
  • Being Bayesian, the posterior can be updated as more paired observations become available.

Applications

  • Comparing two machine-learning algorithms on several benchmark datasets using their paired performance differences.
  • Paired before-and-after measurements in which the normality of the differences is doubtful.
  • Comparing two teaching or treatment conditions applied to the same participants on an ordinal scale.
  • Comparing two process variants measured on the same units, where the aim is to judge practical equivalence as well as difference.

How it works

How it works

1

The paired differences are computed, their absolute values are ranked from smallest to largest, and each rank takes the sign of its original difference. Tied absolute differences receive average ranks. Zero differences need an explicit convention, which should be stated when results are reported.

Formula
r_i = \text{sgn}(x_{1i}-x_{2i})\cdot\text{rank}(|x_{1i}-x_{2i}|)
2

The Bayesian model places a prior over the distribution that generates the paired differences. The prior concentration parameter alpha_0 controls how strongly prior assumptions weigh against the data. A small value expresses weak prior information, while an informative prior can be used when it is justified and documented.

Formula
\theta \sim \text{Dir}(\alpha_0,\ldots,\alpha_0)
3

Combining the prior with the observed signed ranks gives a posterior distribution that summarises uncertainty about the underlying distribution of the paired differences. The probabilities reported by the test are computed from this posterior.

Formula
p(\theta \mid r) \propto \prod_{k} \theta_k^{n_k + \alpha_0 - 1}
4

P(left), P(rope) and P(right) are the posterior probabilities that the underlying location of the paired differences lies below the lower bound of the region of practical equivalence (ROPE), inside it, or above its upper bound. The ROPE is an interval on the scale of the differences that the researcher sets in advance as practically negligible. The three probabilities sum to one.

Formula
P(\text{left}),\; P(\text{rope}),\; P(\text{right})
5

There is no mandatory decision threshold. Researchers inspect the three probabilities and state a conclusion when one of them is large enough by their own standard. The ROPE width and the prior concentration parameter should be varied in a sensitivity analysis, and the results of that analysis should be reported.

Common pitfalls

  • Setting the ROPE to zero width and then reading the result as if it were a classical test; the two frameworks answer different questions.
  • Reporting only the default prior and ROPE without a sensitivity analysis over both.
  • Applying the test to independent, unpaired samples, which violates the paired-difference design the signed ranks rely on.
  • Treating the posterior probability of one condition being better as equivalent to a frequentist p-value; the two have different interpretations.

Frequently asked questions

What is the ROPE and how do I set it?

The region of practical equivalence (ROPE) is a range of differences small enough that the two conditions can be treated as practically the same. Its boundaries are set by the researcher from domain knowledge, and they should be expressed on the scale on which the paired differences are measured. Because the result depends on this choice, it is good practice to report results for several ROPE widths.

How does this differ from the classical Wilcoxon signed-rank test?

The classical test gives a p-value for a null hypothesis of no difference, judged against a fixed significance threshold. The Bayesian version gives three posterior probabilities (worse, equivalent, better), can incorporate prior information, and so provides an explicit probability that the conditions are practically equivalent.

What prior should I use?

A weakly informative prior with a small concentration parameter is a common choice when there is little prior information. If earlier studies exist, an informative prior can be elicited and justified. In either case, report the prior used and run a sensitivity analysis.

Can I use it with ordinal data?

Yes, because the method works on ranks rather than raw values. It is appropriate for ordinal paired data provided that the direction of each paired difference is meaningful.

Is software available?

Software for Bayesian paired comparison is available, for example the Python baycomp library associated with Benavoli and colleagues. Confirm in its documentation that it provides the signed-rank procedure described on this page before relying on it.

Related methods

Sources

  1. Benavoli, A., Corani, G., & Mangili, F. (2014). Should we really use post-hoc tests based on mean-ranks? Journal of Machine Learning Research, 17(5), 1–10.

    Open publication reference
  2. Benavoli, A., Corani, G., Demsar, J., & Zaffalon, M. (2017). Time for a change: a tutorial for comparing multiple classifiers through Bayesian analysis. Journal of Machine Learning Research, 18(77), 1–36.

    Open publication reference