Permutation (Randomization) Test

Statistics
Introduced by
Good (2005); Edgington & Onghena (2007); resampling tradition
Year
2005
Type
Nonparametric resampling test

What does it do?

The permutation test is a nonparametric resampling procedure that builds a reference distribution for a test statistic from the data itself, by repeatedly reassigning the group labels.

It requires no parametric distributional assumption. If every possible relabelling is enumerated, the resulting p-value is exact; if only a finite number of random relabellings is used, the p-value is a Monte Carlo approximation whose precision depends on that number. Good (2005) and Edgington & Onghena (2007) treat the method systematically.

The intuition behind the method

Suppose the labels attached to observations, such as treatment versus control, carry no real information. Then the observed data could have arisen under any reassignment of those labels, and the observed statistic is just one of many equally plausible values. The permutation test recomputes the statistic after each random relabelling and records how often relabelling alone produces a value at least as extreme as the one observed. If such values are rare, the observed data are unlikely under the hypothesis that the groups share one distribution.

History

The permutation test belongs to the resampling tradition, in which the reference distribution is generated from the data themselves. Good (2005) and Edgington and Onghena (2007) are book-length treatments of the method, covering permutation, parametric, and bootstrap tests and randomization tests for experimental designs respectively. They are not accounts of the method's origin.

When to use it

Choose a permutation test when you need to compare groups or test an association and parametric assumptions such as normality are doubtful, or when you prefer a p-value that does not rest on a theoretical reference distribution. It can be applied to continuous, categorical, and ordinal outcomes, provided the chosen statistic can be computed for each relabelling. The essential requirement is that observations be exchangeable under the null hypothesis; if they are clustered, repeated, or ordered in time, shuffling labels across them breaks that requirement and the test should not be used as specified. When the sample is small, the number of distinct relabellings is limited, so consider full enumeration where it is feasible, or an alternative resampling method such as the jackknife or bootstrap listed under related pages. Choose the number of random permutations M so that the Monte Carlo error of the p-value is acceptable for the decision at hand, and check stability by rerunning with different random seeds.

Limitations and considerations

  • In small samples the number of distinct relabellings is limited, which bounds the smallest attainable p-value and reduces the power of the test. Full enumeration gives the exact result where it is feasible, but the number of possible relabellings grows rapidly with sample size. The metafor documentation, for example, gives k! possible arrangements for a model with moderators, reaching 3,628,800 for k = 10.
  • Validity depends on exchangeability; clustering, repeated measures, or time ordering can break it, and the test then answers a different question than the one intended.
  • Random relabelling can be computationally heavy, because the statistic is recomputed for each of the M relabellings.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Distribution-free in the sense that the reference distribution comes from relabelling the data themselves, so no normality or other parametric form is assumed; the main substantive assumption is exchangeability under the null.
  • When all possible relabellings are enumerated, the p-value is exact, which makes the procedure useful where exactness matters more than speed.
  • Flexible: any test statistic that can be computed for a given labelling, such as a difference in means, can be plugged into the same procedure.

Applications

  • Comparing two or more groups on an outcome when normality cannot be assumed.
  • Assessing whether an observed association or correlation is stronger than expected by chance.
  • Robust hypothesis testing in small or non-standard experimental designs where exact p-values are valued.
  • Testing regression coefficients: the test is built on the OLS estimate by permuting the terms (X'X)^-1 X'_i against the residuals e_i. Its reference distribution can differ from the t(n-k) distribution that applies under normal errors, and the same exchangeability requirement applies to the residuals.

How it works

How it works

1

Under the null hypothesis the two groups share one distribution, F1 = F2, so the group labels are exchangeable: any reassignment of observations to groups is equally likely. This exchangeability is the assumption the test relies on, and it is what justifies building the reference distribution from relabelled data. Because the null concerns the whole distribution, rejecting it means the groups differ in some respect, such as location, spread, or shape. A rejection obtained with a difference-in-means statistic is read as a difference in location only if the groups can reasonably be assumed to share the same shape.

Formula
H_0:\; F_1 = F_2 \quad (\text{labels are exchangeable})
2

The chosen statistic T, such as a difference in means, is computed for the observed labelling and for relabellings of the data. If every distinct relabelling is enumerated, the proportion of relabelled statistics whose absolute value is at least the absolute value of the observed statistic is the exact permutation p-value. When enumeration is infeasible, M random relabellings are drawn and the same proportion, as the formula shows, is an approximation to the exact value. Its Monte Carlo error decreases as M increases.

Formula
p = \frac{1}{M}\sum_{m=1}^{M} \mathbf{1}\{\,|T(\pi_m)| \ge |T_{\mathrm{obs}}|\,\}

Common pitfalls

  • Using too few random permutations, which leaves the estimated p-value noisy; the resolution of the p-value is set by M.
  • Applying the test when observations are not exchangeable under the null hypothesis, for example dependent or clustered data.
  • Running it on very small samples, where the number of distinct relabellings is limited and therefore constrains the attainable p-value and the power. Check how many relabellings exist, and consider full enumeration or an alternative resampling approach.
  • Reporting a p-value of exactly zero without acknowledging that the estimate is limited by the number of permutations drawn.
  • Because the formula compares absolute values of the statistic, it is a two-sided test; a one-sided hypothesis requires a signed statistic and a correspondingly one-sided comparison.
  • Treating a random-permutation p-value as exact. Repeated runs with different random seeds can give slightly different values, so set and report the seed and increase M until the result is stable.

Frequently asked questions

How many permutations do I need?

There is no fixed number that suffices for every problem. Choose M so that the Monte Carlo error of the p-value is small enough for your decision; more permutations sharpen the resolution of the p-value. Check stability by rerunning with different random seeds: if the p-value changes noticeably between runs, increase M. If every possible relabelling can be enumerated, the result is the exact test rather than an estimate.

What is exchangeability and why does it matter?

Exchangeability means that under the null hypothesis any reassignment of observations to groups is equally likely. It is the single assumption the permutation test relies on; if the data are clustered or ordered in time so that labels are not freely interchangeable, the test can be invalid.

How is a permutation test different from a bootstrap?

A permutation test reshuffles labels without replacement to test a null of no group difference, producing an exact p-value. The bootstrap resamples observations with replacement to estimate the variability of a statistic; it is aimed at confidence intervals and standard errors rather than an exact null test.

What should I do when the sample is too small?

With small samples the number of distinct relabellings is limited, which restricts the smallest p-value that can be attained and the power of the test. Where it is feasible, enumerate all relabellings for an exact result; otherwise consider an alternative resampling approach such as the jackknife or bootstrap.

Related methods

Sources

  1. Good, P. (2005). Permutation, Parametric and Bootstrap Tests of Hypotheses (3rd ed.). Springer.

    ISBN: 978-0387202792
  2. Edgington, E. S., & Onghena, P. (2007). Randomization Tests (4th ed.). CRC Press.

    ISBN: 978-1584885894