Challenge your conclusionLesson 22 of 30 · 7 min
Let assignment generate the comparison
Run a paired randomisation test without breaking the experimental blocks.
In a paired randomised experiment, the order of A and B is chosen separately in each block. The sharp no-effect claim says that changing a label would leave each individual outcome unchanged. If that holds, swapping labels within each block gives the possible results of the assignment procedure.
SciPy’s samples permutation mode swaps the treatment labels while preserving pairs. The statistic here is . We enumerate all assignments for these eight invented pairs: label patterns. This differs from shuffling all sixteen readings together.
This interpretation requires that the label swaps match how the experiment was assigned and that one treatment does not affect the next. An observational study would need its own reason for treating the two labels in each pair as exchangeable.
Original labels
A₁ = 80 · B₁ = 72
A₂ = 130 · B₂ = 119
Flip first pair
A₁ = 72 · B₁ = 80
A₂ = 130 · B₂ = 119
Each row remains the same block. Times in ms.
What information would be lost by shuffling all readings across all machines?
Write a prediction (optional)
Run the prepared example
This page puts the example in the Python editor. Select Run Python with the code unchanged.
Invented data
A saved draft is open. To run the published example, open Editor tools and select Restore example. Recover draft brings your code back.
Execution error
Technical error details
What to compare
Find Exact assignment patterns and Two-sided permutation p-value. What stays together in every pattern, even when an A and a B label swap?
Your result
Result tools
The test enumerates 256 within-pair label patterns. Each pattern changes labels only inside a pair, which respects this assignment model.
Published example output
The site ran the original code to produce this reference. Build environment ↗
Mean B-minus-A (ms): -8.875 Exact assignment patterns: 256 Two-sided permutation p-value: 0.0078125
The test enumerates 256 within-pair label patterns. Each pattern changes labels only inside a pair, which respects this assignment model.
Change and run again
In the Python editor, change the first two entries of b from 72, 119 to 90, 140. Select Run Python again. Compare Mean B-minus-A (ms), Exact assignment patterns and Two-sided permutation p-value. How do the two larger B times change the evidence without changing the pairing? Return to the Python editor
What this example supports. Exact here means all label assignments were enumerated, not that the design assumptions are known to hold. The timings are invented.
Try a fresh case
In a randomised paired trial, which label permutation respects assignment?
Hints for this question
- Find where randomisation occurred.
- Keep the blocking structure while changing the assigned treatment labels.