Course contentsShow
← Data Science
Lesson 1489 of 2,14537. A/B TestingFree lesson

Stratified Randomization Fundamentals

Learn how to randomize within subgroups to ensure balance on important covariates across treatment arms.

Stratified Randomization Fundamentals

What you'll learn: How to randomize within subgroups to ensure balance on important covariates across treatment arms.

The Core Idea

While simple random assignment gives every unit an equal chance of treatment, it can leave you with imbalanced groups on important characteristics—especially in smaller samples. Stratified randomization solves this by first dividing your sample into homogeneous subgroups (strata) based on key covariates, then randomizing within each stratum.

Think of it like dealing cards: instead of shuffling the entire deck and hoping you get a fair split of suits, you separate the deck by suit first, then deal evenly from each pile. This guarantees balance on suit distribution.

When and Why to Use It

Use stratified randomization when you have covariates that:

  • Strongly predict your outcome metric
  • Might naturally be imbalanced (e.g., region, user segment, device type)
  • Could introduce noise or confounding if left unbalanced

For example, if testing a mobile app feature where iOS users behave very differently from Android users, you'd stratify by platform. Within each platform, you randomly assign 50% to control and 50% to treatment. This ensures equal platform representation in both arms.

The Process

  1. Identify stratification variables (usually 1-3 key covariates)
  2. Create strata by grouping units with identical covariate values
  3. Randomize independently within each stratum using your chosen assignment method
  4. Verify balance across both stratification variables and other covariates

Unlike block randomization (which ensures balance over time), stratified randomization ensures balance across predefined population characteristics.

Key Takeaway: Stratified randomization improves precision and reduces variance by guaranteeing balance on important covariates, making your A/B test more statistically powerful and your treatment effect estimates more reliable.