Six participants take part in a small experiment, and chance picks three of them for a new treatment. The treated three score 4, 5 and 6 points and the other three score 1, 2 and 3, so the treatment mean is 3 points higher. With so few people a normal model for the scores is hard to defend, yet the question remains whether random assignment alone could easily produce a gap this large. This lesson answers it by recomputing the difference for every assignment the design could have made, and it explains which rearrangements are legitimate, why, and what to do when there are too many to list.
Key terms
Sharp null hypothesis
Definition In an experiment with units , let and be the potential responses of unit under treatment and under control, assuming that each unit’s response depends only on its own assignment. Only one of the two is observed. A sharp null hypothesis specifies every unit’s treatment effect , so that under it the missing potential response of every unit can be computed from the observed one. The most common is the sharp null of no effect,
A constant effect, for every with a number fixed in advance, is also a sharp null. The weak null hypothesis that the average effect is zero is not sharp, because many different sets of individual effects have average zero.
In plain words Under the sharp null of no effect, each participant would have produced the same response in either group. The responses are then fixed numbers, and the only thing chance could have changed is which labels they carry. A zero average effect is a weaker claim, since gains for some units could cancel losses for others.
Example In the six-participant experiment the treated responses are , and and the control responses are , and . Under the sharp null of no effect, the participant who scored under treatment would also have scored under control, and the participant who scored under control would also have scored under treatment, so all twelve potential responses are known. Now suppose instead that two of the six units have effects and and the other four have none. The average effect is zero, so the weak null holds, while the sharp null of no effect is false. Knowing only that the average is zero would not tell us any unit’s missing response.
Randomization test
Definition A randomization test of a sharp null hypothesis needs three ingredients fixed before the responses are examined. They are the assignment mechanism the experiment actually used, which gives each allowed assignment a known probability, a test statistic , and a rule saying which values count as at least as extreme as the observed one. Under the sharp null every unit’s response under every allowed assignment is known, so the statistic can be computed for each . With a random assignment drawn from the mechanism and the assignment that occurred, the upper-tail p-value is
and a two-sided rule uses in place of . When all allowed assignments are equally likely, the p-value is the proportion of them whose statistic is at least as extreme as the observed one, the observed assignment included. If the sharp null is true, then for every between and , without any model for how the responses arose, because the only randomness the test uses is the randomness the investigator created.
In plain words Chance produced the observed split, so the fair comparison is with the other splits the same chance mechanism could have produced. If the sharp null is true, the observed statistic is just one draw from that collection, and a value far in its tail is surprising. A small p-value is evidence that the treatment changed the response of at least one unit in the study. It does not measure how large the effect is, and it does not show that every unit was affected.
Example Choosing of the participants uniformly at random gives equally likely assignments. Take the statistic , the treatment mean minus the control mean, whose observed value is . Treating the participants who scored , and is the only assignment with , treating those who scored , and is the only one with , and every other assignment gives a value strictly between. For a two-sided question with the rule , chosen in advance,
and for an upper alternative stated in advance the p-value is . Swapping the two groups of any assignment changes the sign of , so in this design no two-sided p-value can be smaller than . Picking the upper direction only after seeing the result would not keep the stated error rate.
Permutation test and permutation distribution
Definition A permutation test fixes a set of rearrangements of the data, such as all reassignments of the group labels that keep the group sizes, recomputes the test statistic for each rearrangement and compares the observed value with the recomputed ones. The permutation distribution is the distribution of the statistic over that set, with equal weight on each rearrangement, or with the design’s probabilities in a randomization test. The p-value is the proportion of rearrangements, weighted by those probabilities when they differ, whose statistic is at least as extreme as the observed value, counting ties as extreme. The test is valid, with for every when the null hypothesis is true, if that hypothesis makes every rearrangement in the set leave the joint distribution of the data unchanged and the set is closed under composition, so that one rearrangement followed by another is again in the set. All label shuffles, all shuffles within blocks and all sign changes within pairs are such sets. The next card calls this invariance of the distribution exchangeability. A randomization test is the permutation test whose rearrangements are exactly the assignments the experiment could have produced.
In plain words Shuffle the labels in every allowed way, recompute the same statistic each time, and see where the real value falls among the results. The list of shuffled values plays the part that a normal or t curve plays in other tests, but it is built from the observed data and needs no formula for the shape of the population.
Example For the six participants the assignments give the following values of the mean difference.
| Mean difference | |||||
|---|---|---|---|---|---|
| Assignments for each sign | 3 | 3 | 2 | 1 | 1 |
The counts add to , and the distribution is symmetric around because each assignment and its mirror image, with the groups swapped, have opposite differences. The observed value sits at the upper end, which gives the p-values and of the previous card. Every entry is recomputed from the actual responses, so the permutation distribution is conditional on these six numbers rather than read from a general table.
Exchangeability
Definition Random variables are exchangeable if for every permutation of the indices the rearranged vector has the same joint distribution as . Independent observations from one distribution are exchangeable. Suppose the observations of one group and the observations of the other are all independent. Then the null hypothesis that both groups come from the same distribution makes all observations independent and identically distributed. Given the pooled values, each of the ways of splitting them into groups of the original sizes is then equally likely, and the permutation test of that hypothesis is valid. In a randomized experiment the equal probabilities come from the design instead, and the sharp null fixes the responses, so no sampling model is needed. A null hypothesis saying only that two means are equal does not make the labels exchangeable when the groups can differ in spread or shape.
In plain words Exchangeable labels carry no information under the null hypothesis, so a shuffled data set is exactly as plausible as the real one. Whether that holds depends on the hypothesis and on how the data were produced, and a histogram cannot settle it.
Example Take two groups of sizes and from normal populations with the same mean but standard deviations and . The difference in sample means has variance . Shuffling the labels spreads the noisy values over both groups, and the shuffled differences have variance , where is the sample variance of all values. Since averages , this variance is on average, and the permutation distribution is much too narrow. In a simulation of such data sets, a two-sided permutation test of the difference in means at level , each run with random shuffles and the plus-one correction, rejected the true null hypothesis of equal means in nearly percent of them. With the standard deviations swapped between the groups it almost never rejected, and with equal standard deviations, where the labels are exchangeable, it rejected in about percent, matching the nominal level.
Restricted permutation
Definition A restricted permutation scheme allows only the rearrangements that respect the structure imposed by the design or by the null hypothesis, such as swaps within blocks or within pairs, or reassignments of whole clusters. In a randomization test the allowed rearrangements must be exactly the assignments the randomization could have produced, with their probabilities. In a randomized block design that treats of the units in block , chosen uniformly and independently across blocks, there are
equally likely assignments. For matched pairs in which an independent fair coin chooses the treated member of each pair, there are equally likely assignments, and under the sharp null of no effect each one keeps or reverses the sign of each within-pair difference , pair by pair, with taken as treatment minus control.
In plain words Shuffle only in the ways the chance mechanism could have shuffled. An assignment the design could never have produced is not a possible alternative result of this experiment, so it does not belong in the reference distribution. If whole classrooms were assigned, whole classrooms are shuffled, not individual students.
Example Suppose the six participants had been formed into three matched pairs before the study, and a coin chose the treated member of each pair. The treated members scored , and and their partners , and , so every pair difference is and the mean difference is . The allowed sign patterns give mean differences and once each and and three times each, so the exact two-sided p-value is . Shuffling all six labels freely would use splits, of which the design could never produce, such as treating both members of the pair that scored and . That free shuffle would give for the same statistic, an answer about an experiment that was never run.
Monte Carlo p-value and plus-one correction
Definition When the allowed rearrangements are too many to list, a Monte Carlo p-value is computed from rearrangements drawn independently at random from the null reference distribution, for example from the experiment’s assignment mechanism. Let be the number of draws whose statistic is at least as extreme as the observed one. The ratio estimates the exact p-value. The plus-one correction reports instead
counting the observed data as one more member of the reference set. Under the null hypothesis the observed statistic and the simulated ones are exchangeable, so for every and every , and the test keeps its stated level despite the simulation. The corrected value is never below . A complete enumeration already contains the observed assignment and needs no correction. A report states , , the convention, the random seed and the Monte Carlo standard error, which is about when the exact p-value is .
In plain words Sampling the reference set adds a second, purely numerical source of randomness on top of the experiment. The extra one keeps a finite simulation from reporting a p-value of zero just because it missed a rare tail, and it makes the procedure valid at its stated level. More draws make the answer more stable, but they cannot repair a reference set that breaks the design.
Example With draws, of which are at least as extreme,
If the exact p-value is near , the Monte Carlo standard error is about , so a run with another seed could easily differ by about . Had no draw been as extreme, the report would be , not . For the six participants all assignments can be listed, and the exact two-sided p-value is . Adding one there would wrongly give .
Check yourself
- In the six-participant experiment with three treated, suppose the treated participants had scored , and and the control participants , and . Find the observed mean difference and the exact two-sided p-value with the rule .
Show the answer
The treatment mean is and the control mean is , so the observed difference is . The six responses add to , so if the treated responses add to ,
The condition holds exactly when or . The treated sets with these sums are and , with sums and , and and , with sums and . So the exact two-sided p-value is .
- Three pairs of participants were matched before a study, and in each pair an independent fair coin chose the treated member. The treatment-minus-control differences were , and points. How many assignments did the design allow, and what is the exact two-sided p-value for the mean difference? A colleague instead pools the six responses and shuffles them freely into two groups of three. What is wrong with that?
Show the answer
Each pair has two possible assignments, so the design allows equally likely assignments. Under the sharp null of no effect each assignment keeps or reverses the sign of each difference. The observed mean difference is . The signed sums are , and once each and twice, so the possible mean differences are , and once each and twice. Only the all-positive and all-negative patterns reach an absolute mean of , so the exact two-sided p-value is .
The free shuffle uses splits, and of them put both members of some pair in the same group, which this design could never do. Its reference distribution therefore describes a different experiment. It also brings the differences between pairs back into the comparison, the very variation the pairing was meant to remove.
- A large randomized experiment has far too many possible assignments to list. A program draws assignments from the design and finds whose mean difference is at least as extreme as the observed one. Report the p-value with the plus-one correction and its approximate Monte Carlo standard error. What should be reported if had been ?
Show the answer
The corrected p-value is
Its Monte Carlo standard error is about , so the report gives together with , , the plus-one convention and the seed. The uncorrected ratio is a fine estimate of the exact p-value, but used as a p-value it does not guarantee the stated level. With the report would be , not . The exact p-value is never zero, because the observed assignment always counts as at least as extreme as itself, and more draws would locate it more precisely.