- Introduced by
- van Doorn, Ly, Marsman, Wagenmakers (building on Mann & Whitney 1947)
- Year
- 2020 (Bayesian formulation); 1947 (classical test)
- Type
- Bayesian nonparametric two-sample test
- Family
- Classical statistics
What does it do?
The Bayesian Mann-Whitney U test is a Bayesian procedure for comparing two independent groups when the data are ordinal or non-normal continuous.
It keeps the rank-based logic of the classical Mann-Whitney U test but, instead of a binary reject or fail-to-reject decision, reports a Bayes factor that expresses the relative evidence for the alternative and the null hypothesis. This allows a researcher to conclude in favour of either hypothesis, or to report that the data are not diagnostic.
The intuition behind the method
The classical Mann-Whitney U test pools the observations, replaces them with ranks, and asks whether one group's ranks tend to be higher than the other's. The Bayesian version keeps this rank-based comparison but places a Cauchy prior on a standardised location-shift parameter, delta, so that a no-shift (null) model and a shift (alternative) model can be compared directly. The result is a Bayes factor, a single number stating how much more or less likely the observed data are under the alternative than under the null. Because the null is a model in its own right, the Bayes factor can also favour the null, which a p-value cannot express. Its value depends on the prior scale, so it should be read together with a sensitivity check.
History
Mann and Whitney introduced the U test in 1947 as a test of whether one of two random variables is stochastically larger than the other; their abstract notes that Wilcoxon had proposed an equivalent test in 1945. Van Doorn, Ly, Marsman, and Wagenmakers published a Bayesian rank-based formulation of the rank sum test in 2020, obtaining Bayes factors through latent normal data augmentation. Software implementations should be checked against their current documentation.
When to use it
Choose this test when you have two independent groups and the outcome is ordinal, or continuous but clearly non-normal or too sparse to check normality, and you want to quantify evidence rather than only reach a binary decision. It is particularly suited to situations where support for the null hypothesis is a research aim, where data are analysed as they accumulate, or where a prior view of the plausible effect size can be encoded in the prior scale. Do not use it for paired observations, where the Bayesian Wilcoxon signed-rank test is the matching choice, or for more than two groups, where a Bayesian Kruskal-Wallis analysis is needed. It is also not the right choice if the requirement is a conventional p-value.
Limitations and considerations
- The Bayes factor depends on the prior: the Cauchy scale r sets how large a shift the alternative expects, and conclusions can change across reasonable values of r.
- Interpreting Bayes factors requires familiarity with Bayesian model comparison, which many readers find less intuitive than a p-value.
- The rank-based likelihood rests on the assumption of a latent normal representation underlying the ordinal data. This is a modelling choice that the data cannot fully confirm.
- The test does not directly test equality of medians unless additional distributional assumptions are made.
- Computation is more demanding than for the classical test, particularly for large samples.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Expresses evidence for both the alternative and the null hypothesis through the Bayes factor, rather than only a rejection decision.
- Keeps the rank-based logic of the classical Mann-Whitney test, so the raw values do not need to be normally distributed.
- Evidence can be recalculated as data accumulate. The Bayes factor is a measure of evidence rather than a calibrated error rate, so it should not be read as controlling false positives.
- Implementations that provide a posterior for the effect size delta let the analyst report the magnitude of the shift, not only the strength of evidence for it.
- Prior knowledge about the plausible shift can be encoded through the Cauchy scale parameter, and the sensitivity of the conclusion to that choice can be checked.
Applications
- Comparing patient-reported pain scores between a treatment and control group when normality cannot be assumed.
- Evaluating whether two teaching methods produce different learning outcomes measured on an ordinal scale.
- Analysing clinical or psychological experiments where sample sizes are small and distributional assumptions are uncertain.
- Sequential monitoring of A/B test results on ordinal or skewed continuous metrics.
- Replication studies seeking to quantify evidence for the null hypothesis of no group difference.
- Pre-registered studies specifying a Bayesian nonparametric analysis plan before data collection.
How it works
How it works
A Cauchy prior is placed on the standardised location-shift parameter delta, with scale r = 1/sqrt(2) in the default specification. Delta is a shift expressed in standard-deviation units on the latent continuous scale that underlies the ranks. The Cauchy distribution is centred on zero shift and has heavy tails, so large shifts remain possible under the alternative. The scale controls how large a shift the alternative model expects, so the choice of r should be reported and justified in terms of the effect sizes plausible in the field. For the sensitivity check, a sensible recommendation is to repeat the analysis with a few values of r on either side of the default, for example from about half to about twice the default scale.
Formula
\delta \sim \text{Cauchy}(0, r),\ r = 1/\sqrt{2}Observations from both groups are pooled and replaced by their ranks, and the rank-sum W for group 1 is computed. W carries the same rank information as the classical U statistic: U = W - n1(n1+1)/2, so the two differ only by a known constant. W summarises how the values of the two groups are ordered relative to each other. The Bayes factor of van Doorn et al. (2020) is not computed directly from W alone but from the latent-normal representation of the ranked data described in the next step.
Formula
W = \sum_{i=1}^{n_1} R_i,\ R_i = \text{rank of } x_i \text{ in pooled sample}Ranks do not define an explicit likelihood for the raw data, so the cited formulation (van Doorn et al., 2020) assumes a latent normal representation that is consistent with the ordinal information in the data. The observed ranks are treated as an impoverished reflection of an underlying continuous scale, and inference concerns the parameters that govern this latent representation, including the location-shift parameter delta. Latent scores are augmented so that their ordering matches the observed ranks. The resulting likelihood therefore rests on the assumption of a latent normal representation, which the data cannot fully confirm. The source should be consulted for the derivation and the sampling scheme.
BF10 is the ratio of the marginal likelihood of the data under the alternative (delta given the Cauchy prior) to that under the null (delta = 0). In the formulation of van Doorn et al. (2020), these marginal likelihoods refer to the latent-normal representation of the ranked data, obtained through data augmentation. Values well above 1 favour the alternative, values well below 1 favour the null, and values near 1 indicate that the data are not diagnostic.
Formula
BF_{10} = \frac{p(\text{ranks} \mid H_1)}{p(\text{ranks} \mid H_0)} = \frac{\int p(\text{ranks} \mid \delta)\, p(\delta)\, d\delta}{p(\text{ranks} \mid \delta = 0)}Report BF10 together with the prior scale used, and check how the conclusion changes across a range of plausible prior scales. The Bayes factor is a ratio of evidence rather than a test against a fixed significance threshold, so it can express support for the null when BF10 is small. The cut-offs separating support for H0, support for H1, and data that are not diagnostic are a matter of convention chosen by the analyst, and they should be stated in advance. Where the implementation provides it, a posterior estimate of delta gives the magnitude of the shift and its uncertainty, which the Bayes factor alone does not convey.
Common pitfalls
- Treating BF10 = 1 as evidence for the null. It means the data are uninformative, not that the null is true.
- Ignoring the sensitivity of results to the prior scale without running a robustness check across plausible r values.
- Confusing the Bayesian rank-sum Bayes factor with a Bayesian t-test. The two use different likelihoods and are appropriate for different data types.
- Reporting only the Bayes factor without the posterior distribution or effect size estimate.
Frequently asked questions
When should I choose this over the classical Mann-Whitney U test?
Choose the Bayesian version when you want to quantify relative evidence rather than a binary p-value decision, when support for the null hypothesis is a research aim, or when the data are analysed sequentially. If you need only a conventional p-value for a single comparison, the classical test is sufficient.
Does this test still avoid the normality assumption?
It does not require the raw data to be normally distributed, because it works on ranks. It does assume independent samples, at least ordinal data, and a latent normal representation of the ranks (van Doorn et al., 2020), which the data cannot fully confirm.
How do I choose the prior scale r?
The default is r = 1/sqrt(2). Choose r according to the range of effect sizes that are plausible in your field, and report the value used. Then rerun the analysis with several values of r, for example from about half to about twice the default, to check whether the conclusion depends on the choice.
Where is this test available in software?
Check the current documentation of the software you plan to use, because implementations and their options vary. The formulation the method follows is given in van Doorn et al. (2020).
Is a Bayes factor of 3 strong evidence?
By commonly used Jeffreys-type labels, a Bayes factor of about 3 to 10 is described as moderate (or substantial) evidence, so 3 is at the weak end of that category and is not strong evidence. These labels are conventions, not decision thresholds. Interpret the Bayes factor relative to the research question, the prior, and the size of the effect.
Related methods
Sources
van Doorn, J., Ly, A., Marsman, M., & Wagenmakers, E.-J. (2020). Bayesian rank-based hypothesis testing for the rank sum test, the signed rank test, and Spearman's rho. Journal of Applied Statistics, 47(16), 2984–3006.
Open DOI referenceMann, H. B., & Whitney, D. R. (1947). On a test of whether one of two random variables is stochastically larger than the other. The Annals of Mathematical Statistics, 18(1), 50–60.
Open DOI reference