advanced 25 minutes

Non-Parametric Tests

Learn distribution-free statistical tests for when parametric assumptions fail. Master Mann-Whitney, Wilcoxon, and Kruskal-Wallis tests.

On This Page
Advertisement

What Are Non-Parametric Tests?

Non-parametric tests (distribution-free tests) don’t assume the data follows a specific distribution like normal.

Parametric TestNon-Parametric Alternative
One-sample t-testWilcoxon signed-rank
Independent t-testMann-Whitney U
Paired t-testWilcoxon signed-rank (paired)
One-way ANOVAKruskal-Wallis
Pearson correlationSpearman correlation

When to Use Non-Parametric Tests

Advantages

  • No distribution assumptions
  • Work with ordinal data
  • Robust to outliers
  • Valid for small samples

Disadvantages

  • Less statistical power than parametric tests
  • Harder to generalize
  • Results may be harder to interpret

1. Mann-Whitney U Test

Alternative to the independent two-sample t-test. Tests if two groups come from the same population.

Mann-Whitney U Test

H₀: The two populations are identical H₁: The populations differ in location (one tends to have larger values)

Based on ranks of combined data.

Mann-Whitney U Test

Compare treatment A vs B effectiveness (small samples):

Treatment ATreatment B
59
712
815
610

Step 1: Rank all data combined

ValueTreatmentRank
5A1
6A2
7A3
8A4
9B5
10B6
12B7
15B8

Step 2: Sum ranks for each group

  • Sum A = 1+2+3+4 = 10
  • Sum B = 5+6+7+8 = 26

Step 3: Calculate U U₁ = n₁n₂ + n₁(n₁+1)/2 - R₁ = 4×4 + 4×5/2 - 10 = 16 + 10 - 10 = 16 U₂ = n₁n₂ + n₂(n₂+1)/2 - R₂ = 4×4 + 4×5/2 - 26 = 16 + 10 - 26 = 0

U = min(U₁, U₂) = 0

Step 4: Compare to critical value or p-value For n₁=n₂=4, α=0.05 (two-tailed), critical U = 1

Since U = 0 ≤ 1, reject H₀.

Treatment B produces significantly larger values.


2. Wilcoxon Signed-Rank Test

Alternative to paired t-test. Tests if the median difference is zero.

Wilcoxon Signed-Rank

H₀: Median difference = 0 H₁: Median difference ≠ 0

Based on ranks of absolute differences.

Wilcoxon Signed-Rank Test

Before/after blood pressure measurements:

SubjectBeforeAfterDiffAbs DiffRankSigned Rank
1150145-551-1
2155148-772.5-2.5
3148151+33(exclude)
4160150-10104-4
5158151-772.5-2.5

Note: Exclude differences of 0 and average tied ranks.

Sum positive ranks: W+ = 0 Sum negative ranks: W- = 1 + 2.5 + 4 + 2.5 = 10

W = min(W+, W-) = 0

Compare to critical value. Small W indicates significant difference.

Conclusion: Treatment significantly reduced blood pressure.


3. Kruskal-Wallis Test

Alternative to one-way ANOVA. Compares three or more independent groups.

Kruskal-Wallis H Test

H₀: All populations have the same distribution H₁: At least one population differs

H=12N(N+1)i=1kRi2ni3(N+1)H = \frac{12}{N(N+1)} \sum_{i=1}^{k} \frac{R_i^2}{n_i} - 3(N+1)

Where:

  • N = total sample size
  • k = number of groups
  • Rᵢ = sum of ranks in group i
  • nᵢ = size of group i

If H is significant, use post-hoc tests (like Dunn’s test) to find which groups differ.

Kruskal-Wallis Test

Three pain medications rated on 1-10 scale:

Drug ADrug BDrug C
368
459
277

Rank all 9 values: Combined: 2, 3, 4, 5, 6, 7, 7, 8, 9

Sum of ranks:

  • Drug A: ranks 1+2+3 = 6
  • Drug B: ranks 4+5+6.5 = 15.5
  • Drug C: ranks 6.5+8+9 = 23.5

Calculate H: N = 9, k = 3, n₁ = n₂ = n₃ = 3

H = [12/(9×10)] × [6²/3 + 15.5²/3 + 23.5²/3] - 3(10) = 0.133 × [12 + 80.1 + 184.1] - 30 = 0.133 × 276.2 - 30 = 36.7 - 30 = 6.7

Compare to chi-square distribution (df = k-1 = 2) Critical χ²₀.₀₅(2) = 5.99

Since H = 6.7 > 5.99, reject H₀.

At least one drug differs in effectiveness.


4. Spearman Rank Correlation

Non-parametric alternative to Pearson correlation. Measures monotonic relationship.

Spearman Correlation

rs=16di2n(n21)r_s = 1 - \frac{6\sum d_i^2}{n(n^2-1)}

Where dᵢ = difference in ranks for observation i

Use when:

  • Data is ordinal
  • Relationship is monotonic but not linear
  • Outliers present

Choosing the Right Test

Research QuestionParametricNon-Parametric
One sample vs valuet-testWilcoxon signed-rank
Two independent groupst-testMann-Whitney U
Two paired measurementsPaired tWilcoxon signed-rank
3+ independent groupsANOVAKruskal-Wallis
Linear relationshipPearson rSpearman rₛ

Handling Ties

When values are tied (equal), assign the average rank to all tied values.

Handling Ties

Values: 5, 7, 7, 7, 10

Rankings: 1, (2+3+4)/3, (2+3+4)/3, (2+3+4)/3, 5

= 1, 3, 3, 3, 5

The three 7s each get rank 3 (the average of ranks 2, 3, 4).


Summary

In this lesson, you learned:

  • Non-parametric tests don’t require distributional assumptions
  • Mann-Whitney U: Compares two independent groups (t-test alternative)
  • Wilcoxon signed-rank: Compares paired observations (paired t alternative)
  • Kruskal-Wallis: Compares 3+ groups (ANOVA alternative)
  • Spearman correlation: Non-parametric correlation
  • Based on ranks rather than actual values
  • Use when assumptions fail or data is ordinal

Practice Problems

1. When would you choose Mann-Whitney U over an independent t-test?

2. Group A scores: 12, 15, 18 Group B scores: 22, 25, 28 Calculate the sum of ranks for each group.

3. Five subjects have before/after differences: -3, +5, -2, -4, -1 Calculate W+ and W- for the Wilcoxon signed-rank test.

4. A Kruskal-Wallis test yields H = 8.5 with 3 groups (df=2). Critical χ² = 5.99 at α = 0.05. What’s the conclusion?

Click to see answers

1. Use Mann-Whitney when:

  • Sample sizes are small (< 30)
  • Data is not normally distributed
  • Data is ordinal (rankings, scales)
  • Outliers are present
  • Variances are very unequal

2. Combined and ranked: 12(1), 15(2), 18(3), 22(4), 25(5), 28(6)

  • Group A sum: 1 + 2 + 3 = 6
  • Group B sum: 4 + 5 + 6 = 15

3. Absolute differences and ranks:

  • |-3| = 3 → rank 3 (negative)
  • |+5| = 5 → rank 5 (positive)
  • |-2| = 2 → rank 2 (negative)
  • |-4| = 4 → rank 4 (negative)
  • |-1| = 1 → rank 1 (negative)

W+ = 5 (only the +5) W- = 1 + 2 + 3 + 4 = 10

4. H = 8.5 > 5.99 (critical value) Reject H₀. There is significant evidence that at least one group differs from the others.

Next Steps

Continue with advanced statistics:

Advertisement

Was this lesson helpful?

Help us improve by sharing your feedback or spreading the word.