How this calculation works
Keep observations from each population in a separate list. The groups may have different sample sizes, spreads and distribution shapes.
p̂=P̂(X<Y)+½P̂(X=Y); T=(p̂−½)/√(sX²/nX+sY²/nY).A worked example
Published example gives W=3.1374674823 and p=0.005786208666. Reversing groups negates W and complements relative effect. Identical arrays give effect0.5,W0,p1.
Good to know
10–300 observations per sample, independent groups, finite values and ties supported; t approximation with Welch-style degrees of freedom; reject zero placement variance, no automatic median interpretation or exact claim.
Reference: SciPy brunnermunzel official documentation (opens in a new tab) ↗
Enter two independent samples
Keep observations from each population in a separate list. The groups may have different sample sizes, spreads and distribution shapes.
Matched measurements belong to a paired method. Repeated measurements from one subject do not become independent when placed in separate lists.
Compare this with the Mann–Whitney U test calculator with ties. Estimate P(X<Y)+half P(X=Y) and studentize its placement variances separately in the two groups. This tests relative effect one half under unequal distribution shapes rather than the exchangeable distributional null of existing exact Mann Whitney.
Target stochastic superiority rather than a median gap
The relative effect is the chance that a randomly selected Y exceeds a randomly selected X, counting ties halfway.
A value of one half is the null target. Equal medians alone do not imply that target when the distributions differ in other ways. The effect orientation is explicit: values above one half mean a random Y tends to exceed a random X. Equal pairs receive half credit, which matters for ordinal scores and repeated measurements. For the published tied example the effect is about0.7889610, the statistic about3.1374675 and the two-sided p-value about0.00578621. Exchanging X and Y should change the effect to one minus itself and reverse the signed statistic while preserving the two-sided p-value. This symmetry is a useful interpretation check before describing which sample tends to be larger.
Build placements in both groups
For each X, calculate its fraction of favorable comparisons against Y. Repeat from the Y perspective to obtain the second placement variance.
The two placement variances enter separately. This studentization is the important distinction from an exchangeable-label rank-sum reference.
Work through the checked default example
Published example gives W=3.1374674823 and p=0.005786208666. Reversing groups negates W and complements relative effect. Identical arrays give effect0.5,W0,p1.
The estimated favorable-comparison probability is 0.788961039, with placement standard error 0.0921000905. The t reference uses approximately 17.682842 degrees of freedom and gives a two-sided probability of 0.00578621. For every X observation, its placement records the proportion of Y observations above it, with half credit for ties. The analogous Y placements use the same oriented pair comparison. The two placement variances are estimated separately and divided by their own sample sizes. Their sum supplies the squared standard error, while a Welch-style expression supplies the approximate degrees of freedom. This construction allows the underlying distributions to have different shapes and spreads. It does not assume that a single location shift explains their relationship, so interpreting its p-value as a test of unequal medians needs additional distributional assumptions.
Use the small-sample t reference cautiously
Welch-style degrees of freedom depend on both placement variances and sample sizes. The resulting t tail is an approximation.
Very small samples or degenerate placements can defeat that approximation. This page does not label an asymptotic probability as an exact permutation result.
Keep the effect direction explicit
Here an effect above one half favors larger Y. Reversing the sample labels complements the effect and reverses the signed statistic.
A two-sided p value remains unchanged under reversal. Report direction and uncertainty alongside that p value rather than treating significance as effect size. The approximation becomes undefined when both placement variances vanish. Complete ordering can create such a degenerate situation, despite looking like strong separation in a dot plot. The calculator reports that limitation rather than dividing by zero or declaring an exact probability of zero. It also does not repair clustered or paired observations by treating their rows as independent. Use a method designed for that dependence structure instead. Confidence about superiority is sensitive to the sample size and ties; an estimated effect near one does not by itself establish a stable population ordering or a causal treatment benefit.
Recognize perfect ordering as a special boundary
If every Y exceeds every X, the estimated effect is one but placement variance can be zero. The ordinary t construction then has no finite denominator.
A rejected boundary calculation is not evidence of no difference. It means this uncertainty formula cannot describe that particular empirical ordering. A one-sided scientific question needs a prespecified direction and a corresponding probability calculation. This page reports a two-sided t-approximation probability, so halving it after looking at the observed sign is not a justified automatic conversion. Report the oriented effect and sample sizes alongside that probability; they communicate which comparison was made and how much information supports it.
A few questions, answered
Is the null equality of medians?
It is a relative-effect null of one half. Median-only interpretation needs additional distributional assumptions.
How are equal observations counted?
Each cross-sample tie contributes half a favorable comparison, and tied placements also enter the variance calculation.
Can spreads differ?
Yes. Separate placement variances are used; exchangeability of the entire two distributions is not required by this approximation.
Why can perfectly separated samples fail?
The placements can be constant, leaving zero estimated variance and an undefined t statistic.