From Pooled Ranks to Pairwise Wins
The rank-sum test compares two independent samples by pooling their observations and ranking them together. The resulting rank statistic can be easier to interpret when translated into a count: how many times does an observation from one sample exceed an observation from the other? This count is the Mann–Whitney statistic. Dividing it by the number of cross-sample pairs gives a direct measure of how often one sample tends to produce larger values.
Suppose \(X_1,\ldots,X_m\) are independent observations from one population and \(Y_1,\ldots,Y_n\) are independent observations from another, with the two samples independent of each other. The samples need not have equal sizes. The statistic depends on comparisons between the \(mn\) pairs \((X_i,Y_j)\), not on comparisons within either sample.
Some references define the statistic in the opposite direction, counting \(Y_j>X_i\). Always check the stated convention before interpreting a reported value. Under the convention above, a large \(U_X\) indicates that \(X\)-sample observations tend to exceed \(Y\)-sample observations. The reverse-direction statistic satisfies \(U_Y=mn-U_X\), including when ties receive half-credit in each direction.
Pairwise Probability of Superiority
For independent population observations \(X\) and \(Y\), define the probability of superiority in the \(X\)-over-\(Y\) direction by \(\theta=P(X>Y)+\frac12P(X=Y)\). The half-tie convention treats a tied comparison as neither a full win nor a full loss. If both populations are continuous, \(P(X=Y)=0\), so \(\theta=P(X>Y)\). If the populations can have tied values, the tie term must be stated when using this convention.
The number of comparisons in the denominator is \(mn\), because each of the \(m\) observations in the first sample is compared with each of the \(n\) observations in the second. This is not the total number of pairs among all \(m+n\) pooled observations: pairs drawn from the same sample are not part of this comparison.
Worked Example: Counting Wins Without Ties
A hypothetical study compares two independent groups’ completion times, measured in minutes. The first group has \(X=\{8,11,14,17\}\), and the second has \(Y=\{6,10,13,16,20\}\). Treat these as the observed samples; determine the cross-sample win count and the estimated probability of superiority for the first group.
Method. For each \(X_i\), count the \(Y_j\) values that it exceeds. There are \(m=4\) observations in the first sample and \(n=5\) in the second, so there are \(mn=4(5)=20\) cross-sample pairs.
The observation \(8\) exceeds only \(6\), contributing \(1\) win. The observation \(11\) exceeds \(6\) and \(10\), contributing \(2\). The observation \(14\) exceeds \(6\), \(10\), and \(13\), contributing \(3\). The observation \(17\) exceeds \(6\), \(10\), \(13\), and \(16\), contributing \(4\). Therefore, \(U_X=1+2+3+4=10\).
The estimated probability of superiority is \(\widehat{\theta}=U_X/(mn)=10/20=0.5000\). In this sample, half of all cross-sample pairs are wins for the first group. A check is that the remaining \(10\) pairs are losses: the \(Y\) observation \(20\) exceeds all four \(X\) observations, and the other \(Y\) values account for the remaining losses. There are no ties, and wins plus losses equal \(20\).
Common mistake avoided: dividing \(10\) by \(\binom{9}{2}=36\) would use all pooled pairs, including pairs within each group. The relevant denominator is \(4(5)=20\), the number of cross-sample pairs.
How the Rank Sum Encodes the Count
The pairwise count can be calculated directly from the observations, but it can also be recovered from a pooled rank sum. Pool the \(m+n\) observations and rank them from smallest to largest. If values are tied, assign each tied observation the average of the ranks they would have occupied. Let \(R_X\) be the sum of the ranks assigned to the \(X\)-sample observations.
The term \(m(m+1)/2\) is the sum of the ranks that the \(X\) observations would receive if they occupied the lowest \(m\) positions. Each time an \(X\) observation is ranked above a \(Y\) observation, the \(X\)-rank sum increases relative to that lowest-position baseline. With ties, average ranks allocate half of the tied comparison to each direction.
Rank all \(m+n\) observations together in increasing order, assigning average ranks to tied values.
Calculate \(R_X\), the sum of the pooled ranks belonging to the \(X\) sample.
Calculate \(U_X=R_X-m(m+1)/2\), then divide by \(mn\) if the probability-of-superiority estimate is required.
The identity follows by viewing each \(X\)-rank as its average position among all pooled observations. The total \(X\)-rank sum includes the \(X\)-sample’s own positions as well as its positions relative to the \(Y\) observations. Subtracting \(1+2+\cdots+m=m(m+1)/2\) removes the baseline contribution from the \(X\) observations’ own ranks. What remains is the total cross-sample comparison score: one for each \(X\) above a \(Y\), zero for each \(X\) below a \(Y\), and one-half for a tied cross-sample pair. This is precisely \(U_X\).
Worked Example: Using Pooled Midranks With Ties
A hypothetical laboratory records measurement values from two independent groups. The observed \(X\) sample is \(\{2,4,4,7\}\), and the observed \(Y\) sample is \(\{1,4,6\}\). Use pooled midranks to find \(U_X\) and estimate the probability of superiority.
Method. There are \(m=4\) observations in \(X\), \(n=3\) in \(Y\), and \(mn=12\) cross-sample pairs. In the pooled ordered data, \(1\) has rank \(1\), \(2\) has rank \(2\), and the three observations equal to \(4\) occupy ranks \(3,4,5\). Each value of \(4\) receives their average rank, \((3+4+5)/3=4\). The value \(6\) has rank \(6\), and \(7\) has rank \(7\).
The \(X\)-sample ranks are \(2,4,4,7\), so \(R_X=2+4+4+7=17\). The baseline is \(m(m+1)/2=4(5)/2=10\). Hence \(U_X=17-10=7\), and \(\widehat{\theta}=7/12=0.5833\) to four decimal places.
Check by direct pair counting: \(X=2\) beats \(Y=1\), contributing \(1\). Each of the two \(X=4\) observations beats \(Y=1\) and ties \(Y=4\), contributing \(1+\frac12=1.5\) apiece. Finally, \(X=7\) beats all three \(Y\) observations, contributing \(3\). The total is \(1+1.5+1.5+3=7\), agreeing with the rank-sum calculation.
Common mistake avoided: the two tied \(X=4\) values each have a separate comparison with the single \(Y=4\), so there are two tied cross-sample pairs. Counting each tie as a full win, or counting only one tie, would give the wrong statistic.
Why the Normalized Statistic Estimates a Probability
Each cross-sample pair has a score of \(1\), \(1/2\), or \(0\). If \(X_i\) and \(Y_j\) are independent observations from the two populations, the expected score for any one pair is \(P(X_i>Y_j)+\frac12P(X_i=Y_j)=\theta\). The sample statistic sums these scores across all \(mn\) pairs. This explains why dividing by \(mn\) produces a natural estimate of the population comparison probability.
This argument uses the same population comparison probability for every pair, as is the case when each sample is independently and identically distributed within its group. The pair scores are not all mutually independent, because different pairs can share an observation; that dependence does not change the expectation calculation. Independence between the two samples and representative sampling from the populations are important for interpreting the estimate as a population comparison.
Worked Example: Interpreting a Rank Sum and Its Direction
A hypothetical equipment study has \(m=5\) readings in a new process group and \(n=4\) readings in a reference group. The sum of the pooled ranks for the new-process readings is \(R_X=29\). Find the Mann–Whitney statistic under the \(X>Y\) convention, estimate the probability of superiority, and interpret the direction.
Method. The baseline rank sum is \(m(m+1)/2=5(6)/2=15\). Thus \(U_X=R_X-15=29-15=14\). There are \(mn=5(4)=20\) cross-sample pairs, so \(\widehat{\theta}=14/20=0.7000\).
The sample estimate indicates that the new-process observation exceeds the reference observation in about \(70\%\) of cross-sample comparisons under the win-and-half-tie convention. In the reverse direction, \(U_Y=20-14=6\), giving \(6/20=0.3000\). The two directional estimates add to \(1\), as they should.
This is a statement about pairwise comparisons, not a statement that every new-process reading is larger, nor that the difference between typical readings is \(0.70\) units. A probability-of-superiority estimate is dimensionless; it does not measure the size of a difference.
Common mistake avoided: interpreting \(U_X=14\) as a probability or as the number of \(X\) observations that exceed every \(Y\) observation confuses a count of pairs with an observation-level count. The probability estimate is \(14/20\), based on all cross-sample pairs.
Interpretation and Exam Traps
A value of \(\widehat{\theta}\) near \(0.5\) means that the observed cross-sample comparisons are close to balanced under this scoring convention. Values above \(0.5\) favor larger \(X\) observations, and values below \(0.5\) favor larger \(Y\) observations. This comparison is meaningful even if the two populations have different shapes, but it should not automatically be translated into a claim about a difference in medians or a pure location shift.
The statistic summarizes ordering, not magnitude. A pair with a difference of \(0.01\) contributes the same as a pair with a difference of \(100\), provided both are strict wins in the same direction. Also, the observations must be paired across independent samples only for the purpose of counting all cross-group combinations; they are not matched pairs. A paired-data design requires a different analysis.
- Check the direction. Confirm whether the statistic counts \(X>Y\) or \(Y>X\) before interpreting a large value.
- Use the cross-sample denominator. The probability estimate uses \(mn\), not the number of all pooled pairs.
- Handle ties consistently. With midranks, a cross-sample tie contributes one-half to \(U_X\).
- Separate ranking from size. The statistic describes relative ordering and does not retain the numerical distances between observations.
Check Your Understanding
For each problem, use the convention that \(U_X\) counts \(X\)-over-\(Y\) wins and awards half-credit for ties.
- Let \(X=\{3,8\}\) and \(Y=\{2,5,9\}\). Find \(U_X\) and the estimated probability of superiority. (Answer: \(U_X=3\), \(\widehat{\theta}=3/6=0.5000\).)
- Let \(X=\{4,6,10\}\) and \(Y=\{1,6,8\}\). Count the strict wins and ties separately, then find \(U_X\) and \(\widehat{\theta}\). (Answer: \(5\) strict wins and \(1\) tie; \(U_X=5.5\), \(\widehat{\theta}=5.5/9=0.6111\).)
- A sample of size \(m=3\) has pooled rank sum \(R_X=18\), and the other sample has size \(n=4\). Find \(U_X\) and the normalized estimate. (Answer: \(U_X=18-3(4)/2=12\), \(\widehat{\theta}=12/12=1.0000\).)
- Let \(X=\{1,3,5\}\) and \(Y=\{2,3,4\}\). Find the strict-win count, tie count, \(U_X\), and the estimated probability. (Answer: \(4\) strict wins and \(1\) tie; \(U_X=4.5\), \(\widehat{\theta}=4.5/9=0.5000\).)
- For two samples of sizes \(5\) and \(3\), a reported statistic under the \(X>Y\) convention is \(U_X=9\). Find the estimated probability in the \(X\)-over-\(Y\) direction and the corresponding reverse-direction estimate. (Answer: \(\widehat{\theta}_{X>Y}=9/15=0.6000\); the reverse-direction estimate is \(6/15=0.4000\).)