Metter. / Mixtapes / Methods Mixtape / Experimental Design

01 · Experimental Design

Stratified Randomization Design

A randomization design that divides the sample into strata defined by important baseline characteristics before assigning treatment, ensuring each stratum contains a proportional share of both treatment and control units — improving precision and guaranteeing balance on the stratification variables.


What it is

Stratified randomization (also called block randomization or randomisation within strata) assigns treatment separately within pre-defined subgroups of the sample rather than across the full sample at once. If a study stratifies on gender and region, treatment is assigned independently within each gender-region cell, guaranteeing that each cell has the specified treatment share. The result is a sample where treatment and control groups are mechanically balanced on the stratification variables, which improves statistical power and protects against chance imbalance.

In a pure simple random assignment, the treatment and control groups are expected to be balanced on all baseline covariates but are not guaranteed to be. With small samples, chance imbalance can be substantial. Stratification eliminates imbalance on the stratification variables entirely and tends to reduce imbalance on correlated variables as well.

When to use it

Stratification is appropriate in almost every RCT where sample sizes are modest (below a few thousand) and where the stratification variables are strong predictors of the outcome. The design is standard in development economics evaluations and widely considered best practice. The main constraint is that stratification variables must be known before randomization and must be discrete (or discretisable into cells).

The practical decision is how many stratification variables to use. Duflo, Glennerster and Kremer (2007) recommend stratifying on the most important predictors of the outcome — often geography (region or cluster) and one or two strong individual-level characteristics (baseline outcome if available, gender, wealth tertile).

How it works

  1. Define strata. Cross-classify the sample by the stratification variables. Each unique combination of variable values defines one stratum (e.g., “female × poor district” is one stratum). Strata with fewer than 2 observations cannot be randomised and should be merged with adjacent strata.

  2. Assign treatment within each stratum. For each stratum, randomly assign the target share of units to treatment. For a 50/50 split, randomly select half the units in each stratum to receive treatment. For unequal splits, apply the target ratio within each stratum.

  3. Verify balance. After randomization, check that treatment and control groups are balanced on both stratification variables (by construction) and on other important baseline characteristics (empirically, but expected to be good).

  4. Analysis with stratum fixed effects. The analysis must control for stratum fixed effects (or stratum dummies) to recover the correct standard errors. Ignoring stratification in analysis produces conservative but valid estimates; including stratum effects improves precision.

Randomisation check. Run a balance table regressing each baseline covariate on treatment assignment, with stratum fixed effects. The F-test on joint significance of all covariates should not be significant. With perfect stratification on the strata variables, those coefficients will be zero by construction.

Key decisions

Number of strata. More strata provide finer balance but reduce the within-stratum sample size. Strata with only 2 observations (one treatment, one control) are problematic because any stratum-level shock cannot be distinguished from treatment. A practical guideline: aim for at least 4–6 observations per stratum. Total number of strata should not exceed 10–20% of the sample size.

Stratifying on baseline outcome. If a pre-treatment measure of the primary outcome is available, stratifying on it (typically in terciles or quartiles) is the most powerful stratification choice — it directly reduces variance of the outcome across arms. This is particularly valuable when baseline and endline outcomes are highly correlated (r > 0.5).

Randomisation inference. Stratified randomization is particularly well suited to randomisation inference (Fisher’s exact test generalised to the design). The randomisation distribution is computed by re-randomizing within strata many times, computing the test statistic each time. This approach is exact regardless of sample size and correctly accounts for the design.

Caveats & common mistakes

Not controlling for strata in analysis. A common error is stratifying during randomization but not including stratum fixed effects in the analysis regression. This produces valid but inefficient estimates — it throws away the precision gains from stratification. The regression should always include stratum fixed effects (or their equivalent, the stratification variables themselves as controls).

Too many strata with small samples. With 100 observations and 20 strata, average stratum size is 5. Small strata produce noisy within-stratum randomization and many strata with imbalanced assignments by chance. Merge thin strata before randomization.

Stratifying on post-treatment variables. Stratification variables must be measured before treatment assignment. Stratifying on a variable measured after randomization (even if it is intended as a “baseline” measure that occurs after enrollment) can induce post-treatment selection bias.

Analysis Guide

import pandas as pd
import numpy as np
import statsmodels.formula.api as smf

# 1. Define strata as the cross of region and female — each unique combination
#    is one stratum and units inside it will be randomised together to guarantee
#    mechanical balance on these variables
df["strata"] = df.groupby(["region", "female"]).ngroup()

# 2. Assign treatment within each stratum by ranking a uniform draw — ranking
#    within the stratum forces the target share inside every cell rather than
#    only on average across the full sample
np.random.seed(42)
df["rand_num"] = np.random.uniform(size=len(df))
df["rank_in_strata"] = df.groupby("strata")["rand_num"].rank(method="first")
df["strata_size"]    = df.groupby("strata")["strata"].transform("size")
df["treatment"]      = (df["rank_in_strata"] <= np.round(df["strata_size"] * 0.5)).astype(int)

# 3. Verify treatment share by stratum — each cell should hit ~50% (within +/-1
#    unit); large deviations indicate a coding error in the rank-based assignment
print(df.groupby("strata")["treatment"].agg(["mean", "size"]))

# 4. Balance check: regress each baseline covariate on treatment with stratum FEs —
#    C(strata) absorbs the stratification dummies; the treatment coefficient on
#    stratification variables should be ~0 by construction, and small for others
for cov in ["age", "hh_size", "log_expenditure"]:
  model = smf.ols(f"{cov} ~ treatment + C(strata)", data=df).fit(cov_type="HC1")
  print(cov, model.params["treatment"], model.pvalues["treatment"])

Reading the output

  • After correct stratified randomization, the treatment coefficient in the balance regressions should be near zero by construction for the stratification variables; any coefficient significantly different from zero indicates a coding or implementation error.
  • Treatment share per stratum should be within ±1 of the target (e.g., half of each stratum size); strata where the share deviates substantially have been assigned incorrectly.
  • Including stratum fixed effects in the outcome regression is required — omitting them is valid but loses the precision gain from stratification, typically 5–20% reduction in standard errors.
  • If a stratum has fewer than 4 observations, merge it with the nearest stratum before analysis; very thin strata inflate standard errors and produce unreliable fixed effect estimates.

References

Duflo, E., Glennerster, R., & Kremer, M. (2007). Using randomization in development economics research: A toolkit. In T. P. Schultz & J. Strauss (Eds.), Handbook of Development Economics, Vol. 4 (pp. 3895–3962). Elsevier.

Bruhn, M., & McKenzie, D. (2009). In pursuit of balance: Randomization in practice in development field experiments. American Economic Journal: Applied Economics, 1(4), 200–232. https://doi.org/10.1257/app.1.4.200

Imbens, G. W., & Rubin, D. B. (2015). Causal Inference for Statistics, Social, and Biomedical Sciences. Cambridge University Press.

Gerber, A. S., & Green, D. P. (2012). Field Experiments: Design, Analysis, and Interpretation. W. W. Norton.

Last updated: 5 June 2026