01 / 21

Nonparametric
Tests

Learn when and how to use distribution-free statistical tests: the Wilcoxon rank-sum and signed-rank methods for real-world biostatistics data.

Biostatistics

What Are Nonparametric Tests?

In statistics, parametric tests (like the \(t\)-test) assume your data follow a specific distribution: usually normal. Nonparametric tests make no such assumption about the underlying population distribution.

When to Use Nonparametric Methods

Non-Normal Data
Shapiro-Wilk or visual inspection shows data are skewed or heavy-tailed.
Small Samples
With \(n < 20\), normality is hard to verify, making rank-based tests safer.
Ordinal Data
Pain scales (1-10), Likert ratings, or any ranked measurement without equal intervals.

The Normality Assumption

Normal Distribution
\(\mu\)
✓ t-test works Skewed Distribution ✕ t-test unreliable ✓ Use nonparametric

Parametric tests assume the bell curve on the left. When your data look more like the right: use a nonparametric alternative.

The Ranking Process

Nonparametric tests replace raw data with ranks. Here is how ranking works:

Raw Values: 12 5 87 23 9 Sorted: 5 9 12 23 87 Ranks: 1 2 3 4 5

Wilcoxon Rank-Sum Test

The Wilcoxon rank-sum test (also called the Mann-Whitney \(U\) test) compares two independent groups to determine whether their population distributions differ.

1
Combine both samples into one pooled dataset.
2
Rank all observations from smallest to largest.
3
Sum the ranks for each group separately: \(W_1\) and \(W_2\).
4
Compare \(W\) to the expected value under \(H_0\) to get a \(p\)-value.

The Test Statistic \(U\)

Under \(H_0\)
Expected value: \(E(U) = \frac{n_1 \cdot n_2}{2}\)
Large samples
Use the normal approximation: \(Z = \frac{U - E(U)}{\sigma_U}\)

Wilcoxon Signed-Rank Test

The signed-rank test is for paired data (before/after, matched subjects). It tests whether the median difference between pairs is zero.

1
Compute differences: \(d_i = X_{i,\text{after}} - X_{i,\text{before}}\).
2
Discard any pairs where \(d_i = 0\).
3
Rank the absolute values \(|d_i|\) from smallest to largest.
4
Reattach signs: compute \(W^+ = \sum\) (ranks of positive \(d_i\)) and \(W^- = \sum\) (ranks of negative \(d_i\)).
5
Test statistic: \(W = \min(W^+, W^-)\). Compare to critical value.

Rank-Sum vs Signed-Rank

Rank-Sum (Mann-Whitney) Signed-Rank
Design Two independent groups One group, paired data
Parametric analog Two-sample \(t\)-test Paired \(t\)-test
What is ranked All pooled observations Absolute differences \(|d_i|\)
Null hypothesis Identical distributions Median difference = 0
Example Drug A vs Drug B groups Before vs after treatment

How to Choose Your Test

Is data normally distributed? Yes Use parametric test No Use nonparametric test Independent or paired groups? Independent Wilcoxon Rank-Sum (Mann-Whitney U) Paired Wilcoxon Signed-Rank

Example 1: Rank-Sum Test

A researcher compares recovery days for two independent groups of patients. Group A received a new drug (\(n_1 = 5\)): 4, 7, 12, 3, 9. Group B received a placebo (\(n_2 = 5\)): 8, 15, 11, 19, 14. Test at \(\alpha = 0.05\).

Pooled & Sorted 3 A 4 A 7 A 8 B 9 A 11 B 12 A 14 B 15 B 19 B Ranks 1 2 3 4 5 6 7 8 9 10
Group A ranks: \(1+2+3+5+7 = 18\)
Group B ranks: \(4+6+8+9+10 = 37\)

Example 1: Computing \(U\)

Example 2: Signed-Rank Test

Six patients had their blood pressure measured before and after a treatment. Is the treatment effective?

Patient Before After \(d_i\) \(|d_i|\) Rank
1148140-883
2155142-13135
3142139-331
4160150-10104
5138132-662
6170155-15156

Example 2: Result

1
Positive ranks: \(W^+ = 0\) (no patients had a positive difference).
2
Negative ranks: \(W^- = 3 + 5 + 1 + 4 + 2 + 6 = 21\).
3
Test statistic: \(W = \min(W^+, W^-) = \min(0, 21) = 0\).
4
Critical value for \(n=6\), \(\alpha = 0.05\) (two-tailed): \(W_{\text{crit}} = 0\).

Handling Tied Ranks

When two or more observations have the same value, assign each the average of the ranks they would occupy.

Tied Values Example 3 7 7 10 15 1 2.5 2.5 4 5
Tied: \(\frac{2+3}{2} = 2.5\)

Common Mistakes

✕ Wrong Test for Design
Using the rank-sum test on paired data (or vice versa). Always match the test to the study design.
✕ Ignoring Tied Ranks
Assigning sequential ranks instead of average ranks when ties exist. This inflates the test statistic.
✕ Using Nonparametric When Unnecessary
If data are normal and continuous, parametric tests have more statistical power. Do not default to nonparametric.

Question 1 of 5

Which nonparametric test is the appropriate alternative to the two-sample \(t\)-test?

Question 2 of 5

In the Wilcoxon signed-rank test, what do you rank?

Question 3 of 5

Three observations have the same value and would occupy ranks 4, 5, and 6. What rank should each receive?

Question 4 of 5

A key disadvantage of nonparametric tests compared to parametric tests is that they:

Question 5 of 5

In a rank-sum test with \(n_1 = 4\) and \(n_2 = 4\), the total number of ranks in the pooled sample is 8. What is the total sum of all ranks?