01 / 21

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.

Statistics Nonparametric Methods

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?

✓ Robust to Outliers
Ranks bound the influence of extreme values: the largest observation always gets rank \( n \), regardless of how extreme it is.
✓ No Normality Needed
Valid for skewed, heavy-tailed, or otherwise non-normal data without requiring transformations.
✓ Works on Ordinal Data
Applicable even when measurements are only ordinal (e.g., Likert scales) and arithmetic means are meaningless.

The Ranking Process Visualized

RAW DATA 3.2 1.1 47.6 5.0 2.8 4.3 SORT + ASSIGN RANKS SORTED 1.1 2.8 3.2 4.3 5.0 47.6 RANKS 1 2 3 4 5 6 outlier tamed!

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.

1
Compute \( D_i = X_i - Y_i \) for each pair. Drop any \( D_i = 0 \).
2
Rank the absolute values \( |D_1|, |D_2|, \ldots, |D_n| \) from \(1\) to \( n \).
3
Sum positive ranks: \( W^{+} = \sum_{D_i > 0} R_i \).
4
Compare \( W^{+} \) to its null distribution (or use normal approx with \( E[W^{+}] = \frac{n(n+1)}{4} \)).

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.

VALUES (sorted) 2 5 5 5 8 9 NAIVE RANK 1 2 3 4 5 6 MIDRANK 1 3 3 3 5 6 tied: avg(2,3,4)=3

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.

Exact null distribution of W (m=3, n=3) 6 1 7 1 8 2 9 3 10 3 11 3 12 3 13 2 14 1 15 1 W (rank-sum for group 1) Frequency

How to Apply a Rank-Sum Test

1
State hypotheses: \( H_0: F_X = F_Y \) vs \( H_1 \) (one- or two-sided shift).
2
Pool and rank: Combine all \( N = m + n \) observations; rank from \(1\) to \( N \). Resolve ties with midranks.
3
Compute \( W \): Sum the ranks belonging to group 1 (the smaller group, by convention).
4
Find \( p \)-value: Use exact tables (small \( n \)) or normal approximation \( Z = \dfrac{W - m(N+1)/2}{\sqrt{mn(N+1)/12}} \).
5
Decide: Reject \( H_0 \) if \( p \leq \alpha \). Report \( W \), \( Z \), and \( p \).

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).

POOLED + SORTED 2.8 R=1 3.5 R=2 4.0 R=3 4.2 R=4 5.1 R=5 6.3 R=6 Treatment Control

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.12.16+6
2-0.50.52-2
3+3.43.48+8
4+1.81.85+5
5+0.30.31+1
6-1.21.24-4
7+2.72.77+7
8+0.90.93+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 \).

1
Expected value: \( E[W] = \frac{15 \cdot 36}{2} = 270 \).
2
Variance: \( \operatorname{Var}(W) = \frac{15 \cdot 20 \cdot 36}{12} = 900 \), so \( \text{SD} = 30 \).
3
Test statistic: \( Z = \frac{330 - 270}{30} = 2.00 \).
4
Two-sided \( p \)-value: \( 2 \cdot P(Z \geq 2.00) = 2 \cdot 0.0228 = 0.0456 \).
5
Decision: \( p = 0.046 < 0.05 \). Reject \( H_0 \): evidence of a location shift.

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

✕ Confusing the Two Wilcoxon Tests
The rank-sum (independent samples) and signed-rank (paired samples) are different tests with different null distributions. Always check the study design first.
✕ Ignoring Ties
Using uncorrected variance when ties exist reduces the test's power, making it harder to detect a true effect. Apply the midrank method and the tie correction factor to \( \operatorname{Var}(W) \).
✕ Calling It "Assumption-Free"
Rank tests still assume independent observations and (for location tests) equal shape/spread under \( H_0 \). They are distribution-free, not assumption-free.

Summary: Nonparametric Test Map

Scenario Parametric Test Rank-Based Alternative
One-sample / paired locationOne-sample / paired \( t \)-testWilcoxon signed-rank
Two independent groupsTwo-sample \( t \)-testWilcoxon rank-sum (Mann-Whitney \( U \))
\( k \) independent groupsOne-way ANOVA \( F \)-testKruskal-Wallis \( H \)-test
\( k \) related groupsRepeated-measures ANOVAFriedman test
CorrelationPearson \( 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: