Rank-Based Tests
Distribution-Free Ideas
Master the foundations of nonparametric hypothesis testing: replace raw data with ranks, free yourself from distributional assumptions, and harness tests like Wilcoxon and Mann-Whitney.
What Are Rank-Based Tests?
A rank-based test replaces each observation with its rank (position when sorted from smallest to largest) and then performs inference on the ranks rather than the raw values. This makes the test distribution-free: its null distribution does not depend on the parametric form of the underlying population.
Why Go Distribution-Free?
The Ranking Process Visualized
The Wilcoxon Rank-Sum Test
Also called the Mann-Whitney \( U \) test. Compare two independent groups of sizes \( m \) and \( n \). Pool all \( N = m + n \) observations, rank them, and sum the ranks for group 1:
The Signed-Rank Test (Paired Data)
For paired observations \( (X_i, Y_i) \), compute differences \( D_i = X_i - Y_i \). Discard zeros, rank the \( |D_i| \), then attach the sign of each \( D_i \) to its rank.
Rank-Sum vs Signed-Rank
| Wilcoxon Rank-Sum | Wilcoxon Signed-Rank | |
|---|---|---|
| Design | Two independent samples | Paired / one-sample |
| Null \( H_0 \) | \( F_X = F_Y \) | Symmetric about \( \theta_0 \) |
| Statistic | \( W = \sum R_i \) (group 1 ranks) | \( W^{+} = \sum_{D_i>0} R_i \) |
| Equivalent | Mann-Whitney \( U \) | One-sample location test |
| Parametric analogue | Two-sample \(t\)-test | Paired \(t\)-test |
| ARE vs \(t\)-test | \( 3/\pi \approx 0.955 \) | \( 3/\pi \approx 0.955 \) |
Handling Ties in Ranks
When observations share the same value, assign each the average of the ranks they would occupy. This is called the midrank method.
Null Distribution via Permutations
Under \( H_0 \), all \( \binom{N}{m} \) ways to assign ranks to group 1 are equally likely. The exact null distribution of \( W \) is obtained by enumerating every possible rank assignment.
How to Apply a Rank-Sum Test
Example 1: Small-Sample Rank-Sum
Data: Treatment group \( (m=3) \): 4.2, 5.1, 6.3. Control group \( (n=3) \): 2.8, 3.5, 4.0. Test \( H_0: F_T = F_C \) at \( \alpha = 0.05 \) (two-sided).
Example 2: Signed-Rank Test
Paired data: 8 patients measured before and after treatment. Differences \( D_i \): +2.1, -0.5, +3.4, +1.8, +0.3, -1.2, +2.7, +0.9. Test \( H_0 \): median difference = 0.
| Pair | \( D_i \) | \( |D_i| \) | Rank of \( |D_i| \) | Signed Rank |
|---|---|---|---|---|
| 1 | +2.1 | 2.1 | 6 | +6 |
| 2 | -0.5 | 0.5 | 2 | -2 |
| 3 | +3.4 | 3.4 | 8 | +8 |
| 4 | +1.8 | 1.8 | 5 | +5 |
| 5 | +0.3 | 0.3 | 1 | +1 |
| 6 | -1.2 | 1.2 | 4 | -4 |
| 7 | +2.7 | 2.7 | 7 | +7 |
| 8 | +0.9 | 0.9 | 3 | +3 |
Example 3: Normal Approximation
Setup: Group A \( (m = 15) \) vs Group B \( (n = 20) \), so \( N = 35 \). Observed rank-sum for A: \( W = 330 \). Test \( H_0: F_A = F_B \) two-sided at \( \alpha = 0.05 \).
Mann-Whitney \( U \) Statistic
The Mann-Whitney \( U \) counts the number of pairs \( (X_i, Y_j) \) where \( X_i > Y_j \). It relates to \( W \) by a simple linear shift:
Pitman ARE: How Much Power Do We Lose?
The asymptotic relative efficiency (ARE) compares sample sizes needed for the same power. If ARE = 0.955, the rank test needs roughly \( 1/0.955 \approx 1.047 \times \) the sample size of the \(t\)-test:
| True Distribution | ARE (Rank-Sum vs \(t\)-test) | Implication |
|---|---|---|
| Normal | \( 3/\pi \approx 0.955 \) | Only 4.5% loss |
| Logistic | \( \pi^2/9 \approx 1.097 \) | Rank test wins |
| Double Exponential | \( 3/2 = 1.5 \) | Rank test 50% better |
| Cauchy | \( \infty \) | \(t\)-test fails entirely |
Common Mistakes
Summary: Nonparametric Test Map
| Scenario | Parametric Test | Rank-Based Alternative |
|---|---|---|
| One-sample / paired location | One-sample / paired \( t \)-test | Wilcoxon signed-rank |
| Two independent groups | Two-sample \( t \)-test | Wilcoxon rank-sum (Mann-Whitney \( U \)) |
| \( k \) independent groups | One-way ANOVA \( F \)-test | Kruskal-Wallis \( H \)-test |
| \( k \) related groups | Repeated-measures ANOVA | Friedman test |
| Correlation | Pearson \( r \) | Spearman \( r_s \) (rank correlation) |
Question 1 of 5
Under \( H_0 \) for the Wilcoxon rank-sum test with \( m = 4 \) and \( n = 6 \), what is the expected value of the rank-sum \( W \) for the group of size 4?
Question 2 of 5
The Wilcoxon signed-rank test is the nonparametric analogue of which parametric test?
Question 3 of 5
When several observations are tied in value, the standard procedure is to assign each:
Question 4 of 5
The Pitman asymptotic relative efficiency (ARE) of the Wilcoxon rank-sum test compared to the two-sample \(t\)-test, when the data truly come from a normal distribution, is approximately:
Question 5 of 5
The Mann-Whitney \( U \) statistic can be interpreted as an estimate of: