Permutation
Tests
Understand randomization-based inference: how shuffling data under the null hypothesis lets us compute exact p-values without distributional assumptions.
What Is a Permutation Test?
A permutation test (also called a randomization test) is a nonparametric method for hypothesis testing. Instead of relying on theoretical distributions like the \(t\) or \(\chi^2\) distribution, it builds a reference distribution by rearranging (permuting) the observed data itself.
Why Permutation Tests Matter
The Null Hypothesis & Exchangeability
Permutation tests rest on a single key assumption: under \(H_0\), the data labels (which group each observation belongs to) are exchangeable: swapping labels doesn't change the joint distribution.
The Permutation Distribution
For \(N\) total observations split into groups of size \(n_1\) and \(n_2\), the total number of distinct permutations is:
Computing the p-value
The p-value is the proportion of permuted test statistics that are as extreme or more extreme than the observed statistic \(T_{\text{obs}}\).
Permutation vs. Bootstrap Tests
| Permutation Test | Bootstrap Test | |
|---|---|---|
| Resampling Method | Shuffle labels without replacement | Resample observations with replacement |
| What It Tests | Specific null hypothesis \(H_0\) | Estimates sampling distribution of a statistic |
| Primary Output | p-value | Confidence interval |
| Assumption | Exchangeability under \(H_0\) | Sample is representative of population |
| Sample Size | Works well even for \(n < 20\) | Needs moderate \(n\) for reliable CIs |
How to Conduct a Permutation Test
Worked Example: Drug Trial
A small clinical trial compares a new drug to a placebo. Recovery times (days) are recorded for each group:
Mean: \(\bar{X}_1 = 5.25\)
Mean: \(\bar{X}_2 = 10.50\)
Permuting the Labels
Under \(H_0\), we pool all 8 values: {3, 5, 6, 7, 9, 10, 11, 12}. Then we randomly assign 4 to "Drug" and 4 to "Placebo" and compute \(T^*\).
Example Result: p-value
After enumerating all 70 permutations, we count how many produce a difference as extreme as \(T_{\text{obs}} = -5.25\):
Larger Samples: Monte Carlo Approach
With larger groups, exact enumeration is infeasible. For \(n_1 = 20, n_2 = 25\), the number of permutations is:
Monte Carlo Precision
The Monte Carlo p-value \(\hat{p}\) is itself a random variable. Its standard error depends on the number of permutations \(M\):
Rough estimate: suitable for exploratory analysis
Standard for most published research
High precision: needed for very small p-values
Exact vs. Approximate Permutation Tests
| Exact | Monte Carlo Approximate | |
|---|---|---|
| Method | Enumerate all \(\binom{N}{n_1}\) | Random sample of \(M\) permutations |
| p-value | Exact (no randomness) | Approximate (with SE) |
| Feasible When | \(\binom{N}{n_1} \lesssim 10^6\) | Any sample size |
| Computation | Can be slow for large \(N\) | Fast, easily parallelizable |
| Reproducibility | Always same result | Set seed for reproducibility |
Common Mistakes
Question 1 of 5
In a permutation test, what does the null hypothesis assume about the group labels?
Question 2 of 5
You have two groups of sizes \(n_1 = 5\) and \(n_2 = 5\). How many distinct permutations of group labels exist?
Question 3 of 5
A Monte Carlo permutation test with \(M = 10{,}000\) random shuffles finds that 320 permuted statistics exceed the observed statistic in absolute value. What is the two-sided p-value?
Question 4 of 5
Which of the following is the key difference between a permutation test and a bootstrap test?
Question 5 of 5
A researcher runs a Monte Carlo permutation test with \(M = 500\) and gets \(p = 0.048\). A colleague says this p-value is unreliable. Why?