Skip to main content

Randomization and Allocation

Randomization is a known probability mechanism for assigning eligible units. It supports comparable treatment groups in repeated assignment and a randomization-based account of uncertainty. It does not promise identical realized groups or repair attrition, noncompliance, interference, or outcome measurement.

Prerequisites​

Complete Units, Treatment, and Outcomes. The Study Sprint assignment unit is initially the student.

Learning goals​

  • Specify an allocation ratio, assignment mechanism, seed handling, and audit trail.
  • Distinguish chance baseline imbalance from failed randomization.
  • Explain allocation concealment and why random assignment is not necessarily blinded delivery.

A reproducible allocation​

Freeze eligibility before drawing assignments. Specify the ratio—here 1:1—and whether the exact arm counts are fixed. Generate the assignment once, store the immutable unit-to-arm table and algorithm metadata, restrict access until enrollment is fixed, and never rerun because a draw looks unattractive.

import random

students = [(f"s{i:02d}", 48 + i) for i in range(24)]
rng = random.Random(3612)
order = list(range(len(students)))
rng.shuffle(order)
treatment = set(order[:12])
control_scores = [score for i, (_, score) in enumerate(students) if i not in treatment]
treatment_scores = [score for i, (_, score) in enumerate(students) if i in treatment]

print(f"assignment control={len(control_scores)} treatment={len(treatment_scores)}")
print(
"baseline mean "
f"control={sum(control_scores) / len(control_scores):.1f} "
f"treatment={sum(treatment_scores) / len(treatment_scores):.1f}"
)

The seed makes this teaching allocation reproducible; in a real experiment, access control and an audit record matter more than publishing a guessable seed before assignment. A secure service or independent allocator may be needed when manipulation is plausible.

Balance is a property to diagnose, not manufacture afterward​

Chance imbalance is compatible with correct randomization. Report baseline variables by arm to describe the realized sample and detect impossible patterns or implementation failures. Do not test each baseline variable and then declare randomization “successful” only when every p-value exceeds 0.05.

If a few strong pre-treatment prognostic variables are known, prespecified blocking or covariate adjustment can improve precision. Rerandomization is a distinct design whose acceptance rule and analysis must be planned; repeatedly drawing until the table looks favorable without accounting for that restricted mechanism is not complete randomization.

Concealment, blinding, and probabilities​

Allocation concealment prevents knowledge of the next assignment from influencing enrollment. Blinding limits knowledge of received treatment after assignment. Digital or educational interventions may be impossible to blind, but outcome scoring, data processing, and analysis can sometimes remain masked.

Store each unit's assignment probability. Unequal allocation can be sensible when treatment is expensive, learning about treatment safety needs more exposure, or arm variances differ, but 1:1 allocation is usually most precise for a fixed total size under equal variances and costs. Adaptive allocation requires its own prospectively evaluated operating characteristics.

Common mistakes​

  • Alternating by arrival order and calling the predictable sequence random.
  • Rerunning the randomizer until covariates look balanced.
  • Assigning before eligibility is frozen, allowing selective enrollment.
  • Assuming equal arm sizes guarantee exchangeability.
  • Forgetting that the assignment probabilities and restrictions affect the analysis.

Practice​

Write an allocation specification naming the frozen roster, assignment unit, ratio, random mechanism, restrictions, person or service executing it, concealment procedure, stored fields, and response to implementation errors.

Next steps​

Blocking, Stratification, and Pairing shows how prespecified restrictions can improve balance on important prognostic factors.

Primary sources​

Checked 2026-10-15: NIST/SEMATECH, completely randomized designs, CONSORT 2010 statement, and Fisher, The Design of Experiments.