AAmit’s LibraryLEARN · PRACTISE · REFLECT

Statistics and research methods · Worked lesson

Eight workshops, four coin flips

Start here: You need percentages, averages and the idea that the lower end of an interval can matter more than the best estimate. These data are invented.

The organisers want to test a one-page checklist again. This time, learners in a room share instructions, so giving some learners the checklist and others the old instructions would be difficult. The organisers assign a whole workshop at a time. There are 200 learners, but the experiment uses only four independent coin flips. The number of learners and the number of independent assignments answer different questions.

Match workshops before assigning the checklist

Fix the learner rosters and pair eight separate workshops using features known before assignment, such as time slot and prior experience. Each workshop has 25 eligible learners. For each of the four pairs, flip a fair coin to choose which workshop gets the checklist. The other gets the usual instructions. The four flips are independent.

Use the same task, deadline and grading rule in all rooms. Count at most one rework outcome per learner. Analyse workshops as assigned. For this example, assume that everyone's outcome is observed and that workshops cannot share materials or influence one another. Learners can discuss the checklist within their own workshop: that is part of what assigning it to the group means.

Calculate one difference per pair

The target is the average across these eight fixed workshop rosters of the rework rate if assigned usual instructions minus the rate if assigned the checklist. This is an effect of assignment, not of whether a learner actually used the checklist. Equal workshop sizes make that target learner-weighted here as well. A positive difference means less rework with the checklist. Subtract the checklist workshop’s rate from its matched usual workshop’s rate.

Scroll the table to see all columns.

Observed rework differences in the four workshop pairs
PairUsual: rework out of 25Checklist: rework out of 25Reduction
A54+4 percentage points
B64+8 percentage points
C74+12 percentage points
D84+16 percentage points

The average of the four paired differences is +10 percentage points. Because all eight workshops have the same size, the overall learner rates give the same estimate here: 26/100 − 16/100 = 10 points. That agreement does not turn the 200 learner records into 200 independent assignments. If the workshop sizes differed, an equally weighted workshop average and a learner-weighted estimate could differ. Decide which question you want to answer before collecting results.

Replay the four coin flips under no effect

Suppose assigning the checklist would not change any learner’s rework outcome. This is the sharp no-effect null: it lets us hold each workshop’s observed count fixed under every assignment. In each pair, switching which workshop gets the checklist reverses the sign of that pair’s difference. It is the fair assignment labels within each fixed pair that can switch. We do not shuffle observed learner outcomes or move workshops between pairs, and the magnitude of each paired difference stays fixed under this null.

With four independent fair flips, there are 2⁴ = 16 equally likely assignments, including the one observed. Recalculate the average under each:

Scroll the table to see all columns.

Three examples from the 16 possible assignments
Assignment relative to the observed onePaired differences in percentage pointsAverage
Keep all four+4, +8, +12, +16+10
Switch pair D only+4, +8, +12, −16+2
Switch all four−4, −8, −12, −16−10

For a two-sided test, count averages at least as far from zero as the observed +10. Only +10 and −10 qualify. The exact p-value for this test is therefore 2/16 = 0.125, including the observed assignment and its reverse. Under the no-effect hypothesis and this design, an absolute average this large occurs in 12.5% of possible assignments. With four fair pairs this symmetric two-sided test cannot yield a p-value below 2/16, even for its most extreme observation. This is not the probability that the checklist has no effect.

Keep the rollout question separate

The estimate is +10 points, but this experiment does not rule out the sharp no-effect hypothesis at a prespecified 5% test level. It also does not establish that the average reduction is at least 5 points. The test above asks whether all outcomes would be unchanged under assignment. It is not a confidence interval for the average effect, and rejecting that null would not prove the minimum worthwhile improvement.

If the rollout rule still requires a confidence interval whose lower endpoint is at least +5 points, use an interval that respects the workshop-level design. Plan enough independent workshop pairs for that decision. More learners per workshop can make its measured rate less sensitive to any one outcome, but do not add assignments to this exact test. Do not reuse the individual-level interval from the earlier lesson unchanged.

Try it

An equal pair. Suppose pair A has four reworks in each workshop instead. The paired differences are now 0, +8, +12 and +16. What are the new estimate and exact two-sided p-value?

Check the equal-pair answer

The new average is +9 points. To reach an absolute average of 9, the three nonzero differences must all have the same sign. The equal pair can use either assignment in both cases, so four of the 16 assignments qualify: p = 4/16 = 0.25. Count assignments, not distinct values of the statistic.

More independently assigned pairs. With six pairs, what is the smallest possible two-sided p-value for this test, if none of the differences are zero and they all point the same way?

Check the six-pair answer

There are 64 assignments and just two extremes, so the minimum in that situation is 2/64 = 0.03125. That arithmetic is not a sample-size recommendation or a prediction that six pairs will produce strong evidence.

Check by enumeration

from fractions import Fraction
from itertools import product

def paired_p_value(differences):
    diffs = tuple(map(Fraction, differences))
    if not diffs:
        raise ValueError("Supply at least one workshop pair.")
    observed = abs(sum(diffs))
    totals = [
        sum(sign * diff for sign, diff in zip(signs, diffs))
        for signs in product((1, -1), repeat=len(diffs))
    ]
    return Fraction(sum(abs(total) >= observed for total in totals), len(totals))

print(paired_p_value((4, 8, 12, 16)))          # 1/8
print(paired_p_value((0, 8, 12, 16)))          # 1/4
print(paired_p_value((4, 8, 12, 16, 20, 24)))  # 1/32

The code uses sums rather than averages because all assignments have the same number of pairs. Using integer percentage points keeps this example exact. Enumeration grows exponentially with the number of pairs; it is for small examples here.

Try it: Same twelve workshops, different chances of detecting a gain

You are planning the next checklist experiment. Twelve workshops each have 50 learners. A baseline measure available before assignment puts their pass rates at 40%, 42%, 44%, and so on up to 62%. In this invented exercise, each workshop would have exactly its baseline rate without the checklist and exactly eight percentage points more with it. There is no extra outcome noise or sharing between workshops.

Choose six pairs, then flip an independent fair coin in each pair to assign the checklist to one workshop. Compare two plans:

  • Pair neighbours: 40% with 42%, 44% with 46%, and so on.
  • Pair opposites: 40% with 62%, 42% with 60%, and so on.

Before you calculate: Which plan is more likely to detect the eight-point gain? Predict how often each would reject no effect across the 64 equally likely assignments. Use the same two-sided exact test as in the lesson, with a 5% threshold. Here the paired difference is checklist pass rate minus usual pass rate, so positive is better.

Answer: Pairing neighbours detects the gain in 64 of 64 assignments. The baseline gap in each pair is two points, so every observed paired difference is +6 or +10, regardless of which workshop is treated. All six differences are positive.

Pairing opposites detects it in 4 of 64 assignments (6.25%). The gaps are 22, 18, 14, 10, 6 and 2 points. In each of the four pairs with gaps above eight points, the higher-baseline workshop must get the checklist to make its difference positive. The other two pairs give positive differences either way. Only 2² = 4 assignments satisfy those four requirements.

Why does the sign pattern decide this example? None of the six paired differences can be zero here. When all six differences have the same sign, only the two most extreme label patterns match or exceed the observed absolute sum: 2/64 = 3.125%. When signs are mixed, at least four patterns qualify: the observed pattern, its reverse and the two more extreme patterns. That is at least 4/64 = 6.25%, above the 5% threshold.

Do not mix up the probabilities. The 64/64 and 4/64 figures are power under this particular eight-point scenario: the chance of detecting its specified gain over the possible assignments. For this toy no-effect comparison, keep the stated baseline rates as the rates without the checklist and let the checklist change no learner's outcome. Then the test gives 2/64 false rejections for either pairing, or 3.125% even though the cutoff is 5%. That exact fraction is for these fixed outcomes and these two pairing plans, not for every no-effect scenario. Neither result tells you how many workshops a real study needs. Real baseline measures may not predict future outcomes this well, effects can vary, and workshop sizes may differ. Pair using information you have before assignment, not outcomes observed afterward.

Glossary

unit of assignment
is what receives an intervention by random assignment: a workshop here.
matched pair
contains two units grouped by what was known before assignment.
sharp no-effect null
says no learner’s outcome would change under a different assignment.
exact randomization test
compares the observed statistic with those from assignments allowed by the actual design.