The Permutation Test

The permutation test is a nonparametric method for testing whether two distributions are the same. This test is exact, meaning that it is not based on large sample theory or approximations.

Suppose that and are two independent samples and is the hypothesis that two samples are identically distributed. This is the type of hypothesis we would consider when testing whether a treatment differs from a placebo. More precisely we are testing

Let be some test statistic. For example,

Let and consider forming all permutations of the data . For each permutation, compute the test statistic . Denote these values by . Under the null hypothesis, each of these values is equally likely. The distribution that puts mass on each is called the permutation distribution of . Let be the observed value of the test statistic. Assuming we reject when is large, the p-value is

Usually its not practical to evaluate all permutations. We can approximate the p-value by sampling randomly from the set of permutations. The fraction of times among these samples approximate the p-value.

Algorithm for Permutation Test

  1. Compute the observed value of the test statistic
  1. Randomly permute the data. Compute the statistic again using the permutated data.
  2. Repeat the previous step times and let denote the resulting values.
  3. THe approximate p-value is

Tip

In large samples, the permutation test usually gives similar results to a test that is based on large sample theory. The permutation test is thus most useful for small samples.