Bell Statistics

What is stratified randomization?

Stratified randomization splits users into groups on a known characteristic and randomises separately within each. Both arms then contain the same mix by construction, removing a source of imbalance rather than adjusting for it after the fact.

Also called
stratification, blocking, block randomization, stratified sampling, balanced assignment
Allon Korem

Written by Allon Korem

Chief Executive Officer

Last updated

In plain English

Plain randomization balances everything in expectation and nothing in particular on any given run. Split 4,000 users evenly and you can easily end up with 8% more mobile traffic in one arm — not because anything is broken, but because that is what random variation does at that scale. If mobile users behave differently, that imbalance sits inside your result and cannot be distinguished from the treatment effect.

Stratified randomization removes the possibility for characteristics you name in advance. Divide users into strata — mobile and desktop, or new and returning, or by country — and run a separate balanced assignment within each. Both arms then contain exactly the same proportion of each stratum by construction. Blocking is the same idea under a different name, more common in clinical trials and in geo experiments, where markets are grouped into blocks of similar size before assignment.

The benefit shows up in two ways. Balance on the stratifying variable is guaranteed rather than probable, which removes a source of confounding that plain randomisation only makes unlikely. And when the variable predicts the outcome, variance falls, because the between-stratum differences no longer contribute noise to the comparison — the same logic that makes a paired t-test more sensitive than an unpaired one, applied at group level rather than individual level.

How much it buys depends almost entirely on scale, and this is the part most often misstated. At a few thousand users, imbalance is a genuine risk and stratifying is valuable. At a million users per arm, plain randomisation already balances every characteristic to within a fraction of a per cent, and the variance reduction from stratifying is typically under 2% — real, but not worth a pipeline. Its home is small experiments, geo tests with a few dozen markets, and any situation where one stratum is both small and very different from the rest.

There is a cheaper alternative for large experiments that captures most of the same benefit: analyse with regression adjustment rather than stratifying at assignment time. Including the covariate in the model at analysis removes its contribution to the variance without needing anything special in the assignment layer, and it can be added retrospectively. Stratification's advantage over that is guaranteed balance, which matters when the sample is small enough for imbalance to be plausible.

The formula

The variance decomposition is what explains both the benefit and why it fades at scale. Everything else is assignment bookkeeping.

Variance decomposition
Var_total = Var_within strata + Var_between strata

Stratifying removes the second term from the comparison. If strata differ little, that term was small and so is the gain.

The reduction
Var_stratified = Var_total · ( 1 − η² )

η² is the share of variance explained by the stratifying variable — the same form CUPED's (1 − ρ²) takes.

Expected imbalance under plain randomisation
SD of arm difference in a proportion ≈ √( p(1−p) / n )

At n = 4,000 that is about 0.8 percentage points; at n = 1,000,000 it is 0.05. The case for stratifying scales with this.

The analysis-side alternative
Y = β₀ + β₁·treated + β₂·stratum

Regression adjustment gets most of the variance benefit with no change to assignment — see the ANOVA calculator.

Worked example

A B2B product tests a pricing page change with 3,200 accounts, which is all the traffic available in a month. Account size varies enormously — 74% are small, 21% mid-market, 5% enterprise — and enterprise accounts convert at eight times the small-account rate. The team compares plain and stratified assignment by simulation before choosing.

Accounts available
3,200 (1,600 per arm)
Enterprise accounts
160 total, 5% of the base
Conversion: small / mid / enterprise
2.1% / 6.8% / 17.2%
Plain randomisation: SD of enterprise split
±1.4 percentage points of the arm
Simulated runs with >20% enterprise imbalance
18 of 100
Variance reduction from stratifying
31%

Stratifying by account size cuts the variance by 31% and eliminates an 18% chance of a materially unbalanced enterprise split.

Both numbers matter and the second is the more important one. A 31% variance reduction is a useful efficiency gain, equivalent to roughly 45% more traffic. But the 18-in-100 chance of a badly skewed enterprise split is the real risk: with 160 enterprise accounts converting at eight times the base rate, an arm receiving 20% more of them gains an apparent lift that has nothing to do with the pricing page. That is a confounded result that looks exactly like a successful test, and no amount of correct analysis afterwards can separate it from the treatment. This is the regime stratification is for. Worth stating the contrast plainly: at 3.2 million accounts rather than 3,200, the same simulation would show essentially zero chance of meaningful imbalance and a variance reduction of well under 2%, and the sensible answer would be plain randomisation with the covariate handled at analysis.

Common misconceptions

Stratified randomization is more random than plain randomization.
It is more constrained. Assignment is still random within each stratum, but the overall allocation is restricted to those that balance the strata. That restriction is the point — it removes outcomes that plain randomisation would have permitted and you would not have wanted, at the cost of a slightly more complex assignment layer.
You should stratify on every variable you have.
Each stratifying variable multiplies the number of strata, and with too many you end up with cells containing a handful of users, where balance becomes impossible and the whole exercise adds complexity for nothing. Pick the one or two variables that most strongly predict the outcome, and handle the rest at analysis if needed.
Stratification fixes imbalance in variables you did not stratify on.
It guarantees balance only on the variables used, and leaves everything else to chance exactly as before. That is the fundamental limit compared with what randomisation gives you in expectation across all variables, including unmeasured ones. Stratification strengthens a few specific guarantees; it does not create new ones.

Frequently asked questions

When is stratified randomization worth the complexity?
When the sample is small enough for imbalance to be plausible — roughly below ten thousand units — or when one stratum is both small and very different from the rest, such as enterprise accounts among mostly small ones. It is also standard in geo experiments, where a few dozen markets make imbalance very likely. Above a million users per arm the benefit is typically under 2% and rarely justifies changing the assignment layer.
Is it better to stratify at assignment or adjust at analysis?
Adjusting at analysis captures most of the variance reduction, needs no change to the assignment system, and can be applied retrospectively — for large experiments it is usually the better trade. Stratifying at assignment additionally guarantees balance, which is what you want when the sample is small enough that a bad split is a real possibility rather than a theoretical one.
Is blocking the same as stratification?
In practice yes, and the words are used interchangeably in experimentation. Blocking is the older term from agricultural and clinical trial design, where units are grouped into blocks of similar characteristics before assignment; stratification is more common in survey and online experiment contexts. Both mean grouping units on a known variable and randomising within groups. Any distinction is disciplinary rather than substantive.

Related terms

  • Metric sensitivity

    Whether the number can move at all in the time you have — the property that decides which metrics are usable.

  • Randomization

    The one mechanism that makes a comparison causal — and the four ways it silently fails.

  • Regression adjustment

    Control for what you knew before the test started — the general case that CUPED is one instance of.

  • Winsorization

    Pull the tail in rather than cutting it off — and choose the threshold before you see the results, or it is not a method.

Calculate it

  • A/B test sample size

    Size a two-proportion experiment before you launch, then read the lift and its interval once it lands.

  • Chi-square test

    Test a contingency table of counts for association — any number of rows and columns.

Knowing the term is the easy part

Applying it to a live measurement problem is the part that goes wrong. If you are designing an experiment, reading a result you do not trust, or trying to work out what your marketing actually caused, that is the work we do.

References