Why Pool Ranks Across Groups?
When comparing several independent groups with a rank-based procedure, the first calculation is to place all observations on one common rank scale. Ranking the groups separately would give each group its own scale and would not show how its observations compare with observations from the other groups. Pooling lets us see where the observations from each group fall in the combined ordering.
This tutorial covers the rank calculations used before a Kruskal–Wallis analysis: ordering pooled observations, handling ties, and finding group rank sums and mean ranks. It does not calculate or interpret the Kruskal–Wallis test statistic. The essential discipline is simple: sort all observations together, assign ranks, and then use the group labels to collect the assigned ranks.
The observations must be measured on a scale that can be ordered, and the groups must be independent for the intended independent-groups analysis. In the usual sampling setup, observations are independent within and across groups. Ranking does not require the groups to have the same size. Keep every observation’s group label attached to it throughout the sorting process.
How to Assign Pooled Ranks
First sort all observed values from smallest to largest. The smallest value receives rank 1, the next receives rank 2, and so on. If there are no ties, the observation in position \(r\) simply receives rank \(r\). A tied block occupies several consecutive positions; every observation in that block receives the average of those positions.
For example, if three observations are tied in positions 4, 5, and 6, each receives rank \((4+5+6)/3=5\). The tied observations remain separate observations: each contributes rank 5 to the rank sum of its own group.
After ranking, compute each group’s rank sum by adding its assigned ranks. Divide that sum by the group’s sample size to obtain its mean rank. A group’s mean rank is the average of the ranks assigned to its observations; it is not the average of the original data values.
Combine all groups’ values in one list while retaining each value’s group label.
Sort the pooled list from smallest to largest and identify each block of tied values.
Give untied observations their positions and give every observation in a tie the average of the positions in that tie.
Find each group’s rank sum, then divide by its group size for its mean rank.
Worked Examples
Worked Example: Rank Sums With No Ties
A hypothetical study compares a measurement from three independent groups. The observations are A: 12, 7, 15; B: 9, 18; and C: 5, 11, 14. Find each group’s rank sum and mean rank. Use ascending ranks.
Method. Pool and sort all eight observations. Since none are tied, their ranks are their positions in the ordered list.
| Ordered value | Group | Rank |
|---|---|---|
| 5 | C | 1 |
| 7 | A | 2 |
| 9 | B | 3 |
| 11 | C | 4 |
| 12 | A | 5 |
| 14 | C | 6 |
| 15 | A | 7 |
| 18 | B | 8 |
Group A has ranks 2, 5, and 7, so \(R_A=2+5+7=14\), and \(\bar R_A=14/3=4.6667\). Group B has ranks 3 and 8, so \(R_B=3+8=11\), and \(\bar R_B=11/2=5.5\). Group C has ranks 1, 4, and 6, so \(R_C=1+4+6=11\), and \(\bar R_C=11/3=3.6667\). Mean ranks are rounded to four decimal places here.
Check. The rank sums total \(14+11+11=36\). The ranks 1 through 8 also total \(8(9)/2=36\), so the group sums account for every pooled rank exactly once. This method avoids ranking each group separately, which would not give ranks on a common scale.
Worked Example: Average Ranks for Ties Shared Across Groups
A hypothetical screening study records values from three independent groups: A: 4, 7, 7; B: 2, 7, 9; and C: 4, 10. Find each group’s rank sum and mean rank, assigning average ranks to ties.
There are \(N=3+3+2=8\) observations. In ascending order, the values are 2; two observations equal to 4; three equal to 7; 9; and 10. The value 2 occupies rank 1. The two 4s occupy positions 2 and 3, so each receives \((2+3)/2=2.5\). The three 7s occupy positions 4, 5, and 6, so each receives \((4+5+6)/3=5\). The values 9 and 10 receive ranks 7 and 8.
| Value or tied block | Group membership | Assigned rank for each observation |
|---|---|---|
| 2 | B | 1 |
| 4, 4 | A, C | 2.5 each |
| 7, 7, 7 | A, A, B | 5 each |
| 9 | B | 7 |
| 10 | C | 8 |
Group A receives ranks 2.5, 5, and 5, giving \(R_A=2.5+5+5=12.5\) and \(\bar R_A=12.5/3=4.1667\). Group B receives ranks 1, 5, and 7, giving \(R_B=1+5+7=13\) and \(\bar R_B=13/3=4.3333\). Group C receives ranks 2.5 and 8, giving \(R_C=2.5+8=10.5\) and \(\bar R_C=10.5/2=5.25\). Mean ranks are rounded to four decimal places where needed.
Check. The rank sums total \(12.5+13+10.5=36\), equal to \(8(9)/2=36\). The group sizes also total \(3+3+2=8\). The tied values belong to different groups, but their ranks are assigned from the pooled ordering, not separately by group.
Worked Example: Unequal Group Sizes and More Than One Tie
A hypothetical quality study compares recorded values from three independent groups: A: 3, 8, 8; B: 1, 5, 8; and C: 5, 9, 12. Calculate each group’s rank sum and mean rank.
There are \(N=9\) observations. In ascending order, 1 is in position 1 and receives rank 1; 3 is in position 2 and receives rank 2. The two observations equal to 5 occupy positions 3 and 4, so both receive \((3+4)/2=3.5\). The three observations equal to 8 occupy positions 5, 6, and 7, so each receives \((5+6+7)/3=6\). The value 9 receives rank 8 and the value 12 receives rank 9.
Group A has values 3, 8, and 8, so its ranks are 2, 6, and 6. Thus \(R_A=2+6+6=14\), and \(\bar R_A=14/3=4.6667\). Group B has values 1, 5, and 8, so its ranks are 1, 3.5, and 6. Thus \(R_B=1+3.5+6=10.5\), and \(\bar R_B=10.5/3=3.5\). Group C has values 5, 9, and 12, so its ranks are 3.5, 8, and 9. Thus \(R_C=3.5+8+9=20.5\), and \(\bar R_C=20.5/3=6.8333\). Mean ranks are rounded to four decimal places where needed.
Check. The group sizes are all 3, for a total of 9 observations. The rank sums total \(14+10.5+20.5=45\), equal to \(9(10)/2=45\). This check works even though tied ranks are fractional.
Common mistake avoided. Do not give each tied observation the rank of the first position it occupies. The two 5s are not both rank 3, and the three 8s are not all rank 5. Averaging each block’s occupied positions preserves the total rank sum.
Why Average Ranks Preserve the Total
A useful check is that all group rank sums together must equal the sum of ranks assigned to the entire pooled sample. Average ranks for ties preserve that total because each tied block receives exactly the sum of the positions it occupies, distributed equally among its observations.
Adding this equality over all tied and untied positions shows that the sum of all assigned ranks is unchanged from the sum of the integers 1 through \(N\):
The first equality holds because every observation belongs to exactly one group, so every assigned rank contributes to exactly one group rank sum. The final equality is the formula for the sum of the first \(N\) positive integers. This is a calculation check, not a substitute for correctly ordering the data: incorrect group assignments can still lead to a plausible-looking table, so verify the pooled ordering as well.
Common Errors to Avoid
The following mistakes change rank sums or make them incomparable across groups:
- Ranking within each group. Do not restart the ranks at 1 for each group. The pooled observations share one rank scale.
- Breaking a tie arbitrarily. Observations with equal values receive the same average rank, regardless of their group labels or how they appear in the data list.
- Giving each tied value the lowest occupied rank. This reduces the total assigned ranks. For example, in the previous tied example, assigning ranks 2, 2 to the two 4s and 4, 4, 4 to the three 7s gives group sums \(R_A=10\), \(R_B=12\), and \(R_C=10\), totaling 32 rather than the required 36. The correct average ranks are 2.5 for each 4 and 5 for each 7; the correct group sums are 12.5, 13, and 10.5.
- Confusing rank sum and mean rank. A group’s rank sum depends on both its observations and its size. The mean rank is the rank sum divided by that group’s observation count.
- Forgetting to carry the group labels. A pooled sorted list without group labels is not enough to calculate the group rank sums.
Once the group rank sums and mean ranks are correct, they provide the ranked summaries needed for a Kruskal–Wallis analysis. Whether those summaries lead to a test statistic, and how that statistic is assessed, are separate questions. At this stage, focus on accurate pooling and rank assignment.
Check Your Understanding
For each problem, pool all groups before assigning ranks. Use average ranks for ties.
- Independent groups have observations A: 3, 9; B: 2, 7; and C: 5, 11. Find each group’s rank sum and mean rank. (Answer: \(R_A=7,\ R_B=5,\ R_C=9\); mean ranks \(3.5,\ 2.5,\ 4.5\), respectively.)
- Groups have observations A: 1, 4, 4; B: 2, 4; and C: 7. Find the tied rank and each group’s rank sum and mean rank. (Answer: each 4 receives rank 4; \(R_A=9,\ R_B=6,\ R_C=6\); mean ranks \(3,\ 3,\ 6\), respectively.)
- Three independent groups have values A: 6, 2; B: 4, 8; and C: 1, 7. Find each group’s rank sum and mean rank. (Answer: \(R_A=6,\ R_B=9,\ R_C=6\); mean ranks \(3,\ 4.5,\ 3\), respectively.)
- Groups have observations A: 2, 2, 6; B: 2, 5; and C: 8. Find the average rank for the tied values and each group’s rank sum and mean rank. (Answer: each 2 receives rank 2; \(R_A=9,\ R_B=6,\ R_C=6\); mean ranks \(3,\ 3,\ 6\), respectively.)
- Groups have observations A: 10, 12; B: 10, 14; and C: 10, 16. Find the rank assigned to the tied values of 10, then calculate each group’s rank sum and mean rank. (Answer: each 10 receives rank 2; \(R_A=6,\ R_B=7,\ R_C=8\); mean ranks \(3,\ 3.5,\ 4\), respectively.)