Blocked A/B Test — Block-Randomized Split Test

Statistics
Introduced by
R. A. Fisher (blocking principle); adapted to online A/B testing by industry practitioners
Year
1926 (blocking principle); 2000s–2010s (online A/B testing application)
Type
Randomized controlled experiment with variance reduction
Family
Experimental design

What does it do?

A blocked A/B test is an experimental design in which units (users, subjects, or clusters) are first partitioned into blocks of similar units and then randomly assigned to treatment A or treatment B separately within each block.

Because known prognostic variables are balanced across conditions by design, the treatment comparison is made within blocks, which removes block-related variation from the error term. When the blocking variables are strongly related to the outcome, the result is a more precise estimate of the treatment effect than an unblocked A/B test of the same size. When the blocking variables are only weakly related to the outcome, the gain in precision is small.

The intuition behind the method

Imagine testing a new checkout button color on an e-commerce site. Purchase rates differ markedly between mobile and desktop users, so a simple random split might by chance give one variant a larger share of mobile users, and that imbalance would mix with the effect of the button. Blocking addresses this: first divide users into mobile and desktop blocks, then randomize A or B within each block. Both variants now receive similar shares of each device type. Because the comparison is made within blocks, device-driven differences in purchase rates do not contribute to the error term, so the experiment is more sensitive to the effect of the button color.

History

R. A. Fisher's 1926 paper on the arrangement of field experiments is the origin given for the blocking principle. The method was later applied to online A/B testing by industry practitioners in the 2000s and 2010s.

When to use it

Use a blocked A/B test when you know before the experiment that a covariate (such as device type, user segment, geographic region, or time period) is likely to be strongly related to the primary metric, and you want to guard against that covariate contributing noise to the comparison. It is most useful when the blocking variable can be measured before assignment and each block will contain enough units in each condition to support a within-block comparison. Do not use blocking when no prognostic covariate is available, because the added design and analysis complexity then brings little benefit. Avoid it when the candidate blocking variable has so many categories that the blocks become too small, or when block membership cannot be determined before assignment.

Limitations and considerations

  • Blocking requires the blocking variables to be identified and measured before assignment; variables that are unknown or unmeasured at that point cannot be used.
  • Very small blocks reduce the reliability of within-block randomization and comparison, and can harm power rather than help it.
  • The analysis is more involved than a two-sample t-test, and the block structure must be correctly represented in the statistical model.
  • Blocking on a variable that is uncorrelated with the outcome provides little or no variance reduction and still adds design and analysis overhead.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Removes variation attributable to known prognostic covariates from the error term, which can increase statistical power without increasing the number of units.
  • Balances the chosen covariates across conditions by construction, so the comparison does not depend on chance imbalances in those covariates.
  • The treatment-by-block interaction terms can be examined to test whether the treatment effect differs between segments.
  • The analysis reduces to standard tools, namely a two-way ANOVA or a regression with block indicators, which are available in common statistical software.

Applications

  • Online product experiments that block by device type (mobile vs. desktop) or platform when comparing interface variants.
  • Clinical pilot studies that block by clinical site or baseline severity when comparing two treatment protocols.
  • Educational technology experiments that block by school or grade level when assessing a new learning tool.
  • Marketing email tests that block by customer lifecycle stage when measuring the effect of subject-line variants on open rates.
  • Agricultural and environmental studies that block by field location or soil type when comparing crop varieties or interventions.

How it works

How it works

1

Specify the hypothesis (for example, that variant B increases the conversion rate), choose the primary metric, and identify the blocking variables: characteristics expected to influence the outcome. Good blocking variables can be measured before treatment assignment, are correlated with the outcome, and are not affected by the treatment itself.

2

Partition all eligible units into mutually exclusive, exhaustive blocks based on the chosen blocking variables, so that units within a block are as similar as possible on those variables. Keep the number of blocks manageable: if blocks become very fine-grained, their sizes can become too small to support within-block comparisons, and statistical power can fall.

3

Within each block, randomly assign units to condition A (control) or condition B (treatment) with equal or pre-specified probability. This within-block randomization is the step that distinguishes the design from a simple random split of the whole population. Record block membership for each unit before exposure begins.

4

Deliver the assigned variant to each unit for the full experimental period, and keep the conditions separated to limit contamination between them. Collect the outcome data together with the block identifiers so that the block structure is available at the analysis stage.

5

Analyze the results with a model that includes the blocks, typically a two-way ANOVA or a regression with block indicators as covariates. For two conditions, the outcome of a unit is modelled as the overall mean, plus a condition effect, plus a block effect, plus random error. The block effects are estimated as nuisance terms, and the treatment effect is tested through the condition term. If each block contains exactly one unit per condition, the paired-comparison analysis is the equivalent approach. The block terms absorb the variation attributable to the blocking variables. When the blocks explain a substantial part of the outcome variation, this leaves a cleaner estimate of the treatment effect and a narrower confidence interval.

Common pitfalls

  • Ignoring the block structure at analysis time. Running an ordinary two-sample test without block terms leaves the block-related variation in the error term, so the estimate is less precise and the test is less sensitive than the design allows.
  • Post-hoc blocking. Defining blocks after outcomes have been observed means the blocks are not part of the randomized design, and grouping by outcome-related information can bias the comparison.
  • Over-blocking with many blocking variables. Crossing several variables produces many small blocks, which can leave too few units per condition within each block and erode the gain from blocking.
  • Treating blocking as stratified sampling. Blocking is an assignment procedure applied to a fixed set of experimental units; it is not a procedure for drawing a sample from a population.

Frequently asked questions

What is the difference between a blocked A/B test and a stratified A/B test?

In applied writing the two terms are sometimes used loosely for the same idea, but they describe different steps. Blocking is a design choice: units are grouped before assignment, and randomization is carried out separately within each block. Stratification can refer to a design choice of the same kind, but it is also used for post-hoc adjustment, where units were randomized without blocking and results are reweighted or adjusted by stratum afterwards. This page uses 'blocked' for the design-time procedure described above. Design-time blocking is generally the more controlled approach, because the balance is built into the assignment rather than corrected afterwards.

How do I choose which variables to block on?

Block on variables that (1) can be measured before treatment is assigned, (2) are expected to correlate with the primary outcome metric, and (3) are not affected by the treatment itself. Common choices in online experiments include device type, user tenure cohort, and geographic region. Avoid variables with many categories unless the sample is large enough to keep each block sufficiently populated in both conditions.

Does blocking change the sample size requirement?

Blocking can reduce the sample size needed for a given power level, because the variation attributable to the blocking variable is removed from the error term. The size of the gain depends on how strongly the blocking variable is correlated with the outcome. If the correlation is weak, blocking brings little benefit, and an unblocked A/B test may be just as suitable.

Can I use a blocked design with more than two variants?

Yes. With more than two conditions the design is called a blocked multi-arm experiment, or a randomized complete block design with multiple treatments. Units within each block are randomly assigned to one of the k conditions. The analysis generalizes to ANOVA or regression with block and treatment indicators, followed by planned or post-hoc comparisons.

What happens if I leave block indicators out of my analysis?

Leaving out the block terms means the block-related variation stays in the error term, so the estimate of the treatment effect is less precise than the design allows. Include block fixed effects (or a random-effects term for blocks) in the model, as described in the analysis step, so that the model matches the blocked design.

Related methods

Sources

  1. Fisher, R. A. (1926). The arrangement of field experiments. Journal of the Ministry of Agriculture of Great Britain, 33, 503–513.

    Open publication reference
  2. Kohavi, R., Tang, D., & Xu, Y. (2020). Trustworthy Online Controlled Experiments: A Practical Guide to A/B Testing. Cambridge University Press.

    ISBN: 9781108724265