Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Who finished first?
To compare two teams of runners, you could average their times, but one runner who tripped and took an hour would wreck the average. Instead, line everyone up in finishing order and ask: are team A’s runners mostly ahead? That uses only ranks, not how big each gap was, so one disaster barely matters.
Another trick: if the teams don’t really differ, the labels “A” and “B” are arbitrary. Shuffle them randomly many times and see how often a shuffled split looks as different as the real one. That’s a permutation test, and it needs no formula at all.
Robot task times, RL returns over seeds, and network latencies are skewed and full of outliers (a stalled run, a collapsed seed). Rank and permutation tests give trustworthy answers where the t-test’s normality assumption fails.
- 1. A rank test uses…
- 2. One huge outlier affects a rank test…
- 3. A permutation test reshuffles…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.Mann–Whitney (Wilcoxon rank-sum) test
Rank all values together, with ties given average ranks. Let be the sum of group A’s ranks, and . Equivalently, counts the pairs with . Under (same distribution), and . Use the normal approximation for moderate , or exact tables when is small. Interpretation: estimates .
Wilcoxon signed-rank (paired data)
Rank the absolute differences (dropping zeros), and sum the ranks of the positive ones: . Under (differences symmetric about 0), and .
Sign test
Count how many differences are positive. Under (median difference 0), that count is . It’s the most assumption-light test: 9 wins out of 10 gives .
- 1. Values 10, 20, 20, 30: the ranks are…
- 2. E U under H₀ with nₐ = n_b = 10?
- 3. The sign test uses the distribution…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 40 minUndergraduate students and practising engineers.Permutation tests
Under : “the group labels don’t matter” (exchangeability). Every relabelling of the pooled data is equally likely. The exact p-value is the fraction of the relabellings whose statistic is at least as extreme as the observed one.
- Any statistic works: difference in means, medians, trimmed means, or a classifier’s accuracy.
- For large , sample random permutations. Report , which keeps the test valid.
- Granularity: with 5 vs 5 seeds there are only 252 splits. A two-sided p can never be below . With 3 vs 3, never below 0.1.
Power: ranks vs means
The asymptotic relative efficiency of Mann–Whitney vs the t-test is for normal data. You lose 5% at most. It’s never below 0.864 for any distribution, and it’s unbounded for heavy tails. Mann–Whitney is a safe default.
Robust effect size
Report the Hodges–Lehmann shift, the median of all pairwise differences , with a rank-based CI. Or report . Means and t-intervals mislead when one seed collapses.
- 1. For normal data, Mann–Whitney's efficiency relative to the t-test is…
- 2. The smallest two-sided permutation p with 5 vs 5 observations?
- 3. A permutation test's validity requires…
Level 3: Advanced
★★★★☆ Advanced⏱ 40 minGraduate level, with full derivations and proofs.The null distribution of U
Under with continuous data, every assignment of ranks to groups is equally likely. is a sum of indicators, each with mean 1/2. The variance comes from counting the covariances between indicators that share an or a : . A CLT for U-statistics (Hoeffding, 1948) gives asymptotic normality. Ties reduce the variance by .
Why permutation tests are exact
Let be any statistic and the group of label permutations. Under exchangeability, the data and have the same distribution for every . So is uniformly distributed over the multiset , and the rank of the observed statistic among them is uniform. Rejecting when it falls in the top fraction has probability , for any sample size and any distribution. ∎ Fisher’s “lady tasting tea” (1935) was the first example.
What rank tests actually test
Mann–Whitney tests (stochastic equality), not equality of means or medians. With equal shapes, a shift in location is detected. With different shapes (one group more spread), it can reject even when the medians are equal. State the hypothesis you mean.
Exercise 3.1: Show E U = nₐn_b/2 under H₀
For continuous data and identical distributions, by symmetry. Sum over the pairs.
- 1. Permutation tests are valid for…
- 2. Mann–Whitney fundamentally tests…
- 3. Ties make Var U…
Level 4: Expert
★★★★★ Expert⏱ 40 minResearchers: original papers and open problems.Comparing RL algorithms over a handful of seeds
Final returns over 5 seeds per algorithm are typical, and heavy-tailed: one seed of algorithm B collapsed to 120. Welch’s t is diluted by that seed and calls the difference insignificant. Yet every A seed beat every B seed. The exact permutation test gives the smallest p achievable with 5 vs 5, which is 2/252 ≈ 0.008, and that floor is itself a warning about how little 5 seeds can show. Report the Hodges–Lehmann shift (62 here, not the 183 mean difference that the collapsed seed inflates) and . Run more seeds when you can (Henderson et al., 2018; Colas, Sigaud and Oudeyer, 2019; Agarwal et al., 2021).
Non-parametric tests in AI, robotics and aerospace
- Algorithm comparison. Wilcoxon signed-rank across datasets for two classifiers, and Friedman + Nemenyi for many (Demšar, 2006). Permutation tests on per-example losses compare models on the same test set.
- Feature importance. Permutation importance scores a feature by shuffling it and measuring the performance drop (Breiman, 2001).
- Latency and timing analysis. Real-time task durations are skewed with long tails, so rank tests and quantile comparisons are standard for comparing schedulers or middleware versions.
- Two-sample tests for shift. Kolmogorov–Smirnov, energy-distance and kernel (MMD) tests, calibrated by permutation, detect when deployment data differ from training data.
- Randomization inference for A/B tests on robot fleets: re-randomize the actual assignment to get exact p-values (Fisher’s sharp null).
References
- H. Mann, D. Whitney (1947). “On a test of whether one of two random variables is stochastically larger than the other.” Annals of Mathematical Statistics, 18(1).
- F. Wilcoxon (1945). “Individual comparisons by ranking methods.” Biometrics Bulletin, 1(6).
- R. A. Fisher (1935). The Design of Experiments. Oliver & Boyd.
- E. Pitman (1937). “Significance tests which may be applied to samples from any populations.” JRSS Supplement, 4(1).
- W. Hoeffding (1948). “A class of statistics with asymptotically normal distribution.” Annals of Mathematical Statistics, 19(3).
- J. Hodges, E. Lehmann (1963). “Estimates of location based on rank tests.” Annals of Mathematical Statistics, 34(2).
- P. Good (2005). Permutation, Parametric, and Bootstrap Tests of Hypotheses, 3rd ed. Springer.
- P. Henderson et al. (2018). “Deep reinforcement learning that matters.” AAAI.
- C. Colas, O. Sigaud, P.-Y. Oudeyer (2019). “A Hitchhiker’s guide to statistical comparisons of reinforcement learning algorithms.” ICLR RML workshop.
- L. Breiman (2001). “Random forests.” Machine Learning, 45.