Skip to content

Non-Parametric Tests (Mann-Whitney, Wilcoxon)

When data is:

  • Not normally distributed
  • Heavy-tailed
  • Contains outliers

…it can be safer to compare median/rank behavior.

Mann–Whitney U test (two independent groups)

Section titled “Mann–Whitney U test (two independent groups)”

Alternative to the independent t-test.

Mann–Whitney
import numpy as np
from scipy import stats
 
A = np.array([1, 2, 2, 3, 100])
B = np.array([1, 1, 2, 2, 3])
 
u, p = stats.mannwhitneyu(A, B, alternative="two-sided")
print("U:", u)
print("p:", p)

Alternative to the paired t-test.

Wilcoxon
import numpy as np
from scipy import stats
 
before = np.array([10, 12, 11, 9, 13])
after  = np.array([11, 12, 12, 10, 14])
 
w, p = stats.wilcoxon(after - before)
print("W:", w)
print("p:", p)
  • Non-parametric tests often have less power when assumptions for parametric tests are satisfied.
  • Always combine tests with visualizations.
diagram When to switch to a non-parametric test mermaid
Outliers, heavy skew, or a broken normality assumption point toward rank-based tests.

Continue to A/B Testing Basics to apply these comparison tests to a real product experiment.

pch.coffeeTagline

pch.coffeeCta

pch.feedbackHeading

pch.feedbackSubheading