Why Pool and Rank Two Samples?
When two independent groups are measured on the same numerical outcome, a comparison based on pooled ranks can be useful when a direct comparison of the raw values is not the focus. The essential operation is simple but must be done consistently: combine all observations, rank the combined list, then identify the ranks belonging to each group. Ranking each group separately does not preserve their relative positions and gives the wrong comparison.
This tutorial develops the mechanics of pooled ranking for two samples. It defines the rank-sum statistic and the equivalent Mann–Whitney statistic, including the convention for tied observations. These calculations describe the observed samples; they do not, by themselves, determine a test’s null distribution or significance.
The samples need to be independent for the usual two-sample rank-sum setting. For the ranking calculation itself, no particular parametric distribution is required: the observations must be comparable numerical measurements, but they need not be normally distributed. Each worked example below states that no parametric distribution is assumed. There is no interest rate or mortality assumption in these examples because the calculations concern ranks, not discounted cash flows or life contingencies.
Assigning Pooled Ranks
Write all observations in increasing order, keeping track of the sample to which each belongs. The smallest observation receives rank 1, the next receives rank 2, and so on. If two or more observations have the same value, they occupy a block of consecutive ranks; each receives the average of those ranks. Sample labels do not affect the assigned rank.
For example, if three observations tie for the values that would receive ranks 4, 5, and 6, each receives rank \((4+5+6)/3=5\). The three observations still occupy three places in the pooled ordering. Average ranks preserve the total rank sum, even though the tied observations receive noninteger ranks.
Combine both samples into one list and retain a label identifying each observation’s group.
Order the pooled values from smallest to largest. Give each tied block the average of its occupied ranks.
Add the pooled ranks for the selected sample to obtain its rank sum, such as \(R_X\).
Subtract \(n_X(n_X+1)/2\) from \(R_X\). Check the result using cross-sample pairs.
Worked Example: Ranking Two Untied Samples
A hypothetical clinic compares the number of minutes needed to complete a short intake task for two independent groups of clients. The observations are \(X: 12, 8, 15, 10\) and \(Y: 9, 13, 7\). The groups are independent; no parametric distribution is specified or needed. Find \(R_X\) and \(U_X\).
Method. Pool all seven observations and rank them in increasing order. In order, the values and sample labels are \(7_Y, 8_X, 9_Y, 10_X, 12_X, 13_Y, 15_X\), with ranks 1 through 7.
The \(X\) observations receive ranks 2, 4, 5, and 7. Therefore,
There are \(n_X=4\) observations in sample \(X\), so
Check by pairs. Count, for each \(X\) observation, the \(Y\) observations it exceeds. The value 8 exceeds 7 (1 win); 10 exceeds 7 and 9 (2 wins); 12 exceeds 7 and 9 (2 wins); and 15 exceeds 7, 9, and 13 (3 wins). Thus \(U_X=1+2+2+3=8\), agreeing with the rank-sum calculation.
The common mistake is to rank the two groups separately. That would give ranks within \(X\) of 1 through 4 and within \(Y\) of 1 through 3, obscuring which group’s observations are larger overall. Only the pooled ranks answer the intended question.
Why the Rank Sum Converts to a Pair Count
The Mann–Whitney statistic has a useful interpretation: it counts how many cross-sample comparisons favor \(X\), with a tied pair contributing one-half. More precisely, compare every \(X_i\) with every \(Y_j\). Add 1 when \(X_i>Y_j\), add 0 when \(X_i<Y_j\), and add \(1/2\) when \(X_i=Y_j\). The resulting total is \(U_X\).
The rank-sum formula follows by separating each \(X\) observation’s pooled rank into its position relative to the \(X\) observations and its position relative to the \(Y\) observations. For each \(X\) observation, its rank starts with 1. Across all \(X\) observations, those starting 1s total \(n_X\). Among the \(X\) observations themselves, each pair contributes a total of one to the sum of their ranks: the larger receives the later rank, or tied observations share the relevant positions by average rank. The within-\(X\) contribution beyond the starting 1s is therefore \(n_X(n_X-1)/2\). Together, the starting ranks and within-\(X\) positions total \(n_X(n_X+1)/2\). The remaining contribution to \(R_X\) comes from comparisons with \(Y\); these contribute 1 for an \(X\) value above a \(Y\) value, 0 below it, and one-half for a tie. That remaining contribution is \(U_X\). Hence,
This identity holds when pooled ties receive average ranks. It also provides a practical way to check the calculation: calculate \(U_X\) both from the rank sum and by counting cross-sample pairs.
Worked Example: Average Ranks for Tied Observations
A hypothetical insurer compares the number of days two independent processing teams take to resolve a routine file. The recorded values are \(A: 4, 7, 7, 11\) and \(B: 5, 7, 9\). No parametric distribution is specified or required. Calculate \(R_A\) and \(U_A\), giving tied pairs half-credit in the pair-count check.
Method. Pool and order the values. The value 4 from \(A\) receives rank 1, and 5 from \(B\) receives rank 2. The three observations equal to 7 occupy ranks 3, 4, and 5, so each receives the average rank
The value 9 from \(B\) receives rank 6, and 11 from \(A\) receives rank 7. Sample \(A\) therefore has ranks 1, 4, 4, and 7:
With \(n_A=4\),
Check by pairs. The value 4 from \(A\) beats no \(B\) observations. Each value 7 beats 5 and ties 7, contributing \(1+1/2=1.5\); the two such \(A\) observations contribute 3. The value 11 beats 5, 7, and 9, contributing 3. Thus the pair total is \(0+3+3=6\), as required.
There are \(n_An_B=4(3)=12\) cross-sample pairs. The reverse statistic is \(U_B=12-U_A=6\), another check. The common mistake is assigning all three tied observations rank 3, or assigning them ranks 3, 4, and 5 according to sample label. Each must instead receive their shared average rank, 4.
The Two Mann–Whitney Statistics
For the other sample, define \(R_Y\) as the sum of its pooled ranks and \(U_Y=R_Y-n_Y(n_Y+1)/2\). Every cross-sample pair contributes a total of 1 to \(U_X+U_Y\): a strict comparison contributes 1 to one statistic and 0 to the other, while a tie contributes one-half to each. Consequently,
This relationship is useful for checking arithmetic and for translating between conventions. Some references report \(U_X\), others report \(U_Y\), and the two values need not be equal. State which group’s statistic is being reported. When there are ties, keep the half-credit convention: it makes the pair-count interpretation consistent with average pooled ranks.
Worked Example: Ties and the Pair-Count Check
Two independent hypothetical teams record the number of hours needed to complete a maintenance review. Their observations are \(P: 21, 17, 19, 19, 24\) and \(Q: 16, 19, 22, 25\). No parametric distribution is assumed. Find \(R_P\), \(U_P\), and the complementary statistic \(U_Q\).
Method. The pooled order begins with \(16_Q\) at rank 1 and \(17_P\) at rank 2. The three observations equal to 19 occupy ranks 3, 4, and 5, so each receives rank \((3+4+5)/3=4\). The remaining observations are \(21_P\) at rank 6, \(22_Q\) at rank 7, \(24_P\) at rank 8, and \(25_Q\) at rank 9.
The \(P\) ranks are 2, 4, 4, 6, and 8. Thus,
There are \(5(4)=20\) cross-sample pairs, so \(U_Q=20-9=11\). Check directly for \(P\): 17 exceeds 16 (1 win); each of the two 19s exceeds 16 and ties the single \(Q\) value 19, giving \(1.5\) each; 21 exceeds 16 and 19 (2 wins); and 24 exceeds 16, 19, and 22 (3 wins). The value 21 does not exceed 22, and 24 does not exceed 25. The total is \(1+1.5+1.5+2+3=9\), agreeing with \(U_P\). The complement is \(20-9=11\).
The common mistake is to count every tie as a full win for both groups. That would count a tied pair twice. Giving each group one-half for a tied pair ensures the two statistics sum to the total number of cross-sample pairs.
Common Errors and a Reliable Check
Pooled ranks and Mann–Whitney statistics are straightforward once the sample labels and tie rule are handled carefully. Before using either statistic in a subsequent test procedure, check these points:
- Pool before ranking. Ranking within each sample separately cannot measure the groups’ relative positions.
- Use average ranks for ties. Do not assign tied values arbitrary distinct ranks or give all of them the first rank in the tied block.
- Use the correct sample size in the conversion. For \(U_X\), subtract \(n_X(n_X+1)/2\), not \(n_Y(n_Y+1)/2\).
- State the direction. \(U_X\) counts comparisons favoring \(X\), with half-credit for ties; \(U_Y\) counts comparisons favoring \(Y\).
- Check the pair total. Verify that \(U_X+U_Y=n_Xn_Y\). A mismatch often signals a rank, tie, or sample-size error.
Check Your Understanding
For each problem, pool the values before ranking. Use average ranks for ties and give the final statistic for the named sample.
- Two independent samples are \(X: 6, 2, 10\) and \(Y: 4, 8\). Find \(R_X\) and \(U_X\). (Answer: \(R_X=9,\ U_X=3\))
- Two independent samples are \(A: 3, 6, 6, 10\) and \(B: 4, 6, 9\). Find \(R_A\) and \(U_A\), using half-credit for tied cross-sample pairs. (Answer: \(R_A=16,\ U_A=6\))
- Two independent samples are \(C: 12, 15, 18\) and \(D: 11, 15, 17, 20\). Find \(R_C\), \(U_C\), and \(U_D\). (Answer: \(R_C=11.5,\ U_C=5.5,\ U_D=6.5\))
- Two independent samples are \(L: 5, 8, 8, 13\) and \(M: 6, 8, 10, 14\). Find \(R_L\) and \(U_L\), and verify the pair-total identity. (Answer: \(R_L=16,\ U_L=6,\ U_M=10,\ U_L+U_M=16\))
- Two independent samples are \(G: 2, 9, 9, 15\) and \(H: 4, 9, 12\). Find \(R_G\) and \(U_G\), then check \(U_G\) by counting cross-sample wins with half-credit for ties. (Answer: \(R_G=16,\ U_G=6\))