Paired & Randomization Tests
When observations are matched, the comparison must preserve the pairs. This page explains paired tests, design-based randomization, and planning sample size and power.
At a Glance¶
Reduce each independent pair to one difference. The sample size is the number of independent pairs.
Generate the null distribution using only assignments or sign changes justified by the randomization scheme.
Paired Comparisons¶
Use pairing when the same unit receives two conditions, or when two units are meaningfully matched. Examples include two measurements on the same participant or matched specimens from the same batch.
Define a consistent subtraction order:
Here counts pairs, not the individual measurements. The comparison becomes a one-sample problem for the differences:
To test ,
The exact result assumes independent, normally distributed differences. The two sets of raw measurements need not individually satisfy an independent-sample model. A two-sided confidence interval is
Why Pairing Can Improve Precision¶
When responses within pairs are positively correlated, subtracting removes shared unit-to-unit variation. With equal marginal variance and correlation ,
Strong positive correlation can give much better precision than an independent comparison of the same size.
Arbitrary matching does not guarantee a gain. Negative within-pair correlation can increase variance.
For crossover experiments, randomize or counterbalance treatment order. Time trends, learning, fatigue, and carryover can otherwise mimic treatment effects.
If a treatment permanently changes the unit, applying both conditions may not be appropriate.
Randomization & Permutation Tests¶
A randomization test asks: How unusual is the observed statistic among assignments allowed by the design, if treatment has no effect?
Choose a statistic, such as .
Compute its observed value .
Generate treatment assignments consistent with the original randomization.
Recompute the statistic for each assignment.
Count results at least as extreme as observed.
For a complete enumeration of equally likely assignments , a two-sided absolute-statistic test has
The added 1 includes the observed arrangement and avoids reporting a zero estimated -value.
| Design | Valid rearrangement |
|---|---|
| Completely randomized independent groups | Reassign labels while retaining the original group sizes. |
| Randomized matched pairs | Swap treatment labels within each pair, equivalent to sign-flipping each difference. |
| Randomized blocks | Reassign labels within blocks, preserving allocation counts. |
| Cluster-randomized experiment | Reassign whole clusters, not individual measurements. |
A bootstrap resamples observations to approximate sampling uncertainty. A permutation test rearranges labels to construct a null distribution. These are different procedures.
Planning Sample Size & Power¶
Choose the smallest effect worth detecting, , before data collection. Specify a significance level , desired power , and a plausible variance from earlier work or a pilot study.
For a balanced, two-sided independent comparison with common variance , a normal approximation gives
Here is the quantile of the standard normal distribution. Round up. These are planning approximations; small-sample procedures, attrition, clustering, and a different design may require different calculations.
| Change, holding other inputs fixed | Required sample size |
|---|---|
| Higher desired power | Increases. |
| Larger response variance | Increases. |
| Smaller significance level | Increases. |
| Smaller target effect | Increases; halving roughly quadruples . |
| More effective pairing | Decreases when it reduces . |
Increasing the number of correlated measurements is not the same as increasing the number of independent experimental units. Large samples do not fix confounding.
These calculations compare the paired normal-model test with exact within-pair sign randomization for the same illustrative differences.