Course contentsShow
← Data Science
Lesson 1430 of 2,14536. Causal Inference BasicsFree lesson

Controlling for Confounders: Stratification

Control confounding by analyzing treatment effects within homogeneous subgroups defined by the confounder.

Controlling for Confounders: Stratification

You'll learn how to isolate true treatment effects by analyzing data within homogeneous subgroups.

The Core Idea

Stratification means dividing your data into layers (strata) where the confounding variable stays constant, then examining the treatment effect separately within each layer. By "holding the confounder steady," you can see if the treatment truly causes the outcome—or if the confounder was driving the relationship all along.

Think of it like comparing apples to apples. If you want to know whether a new study technique improves test scores, but older students tend to both use that technique and score higher naturally, you'd compare students of the same age who did vs. didn't use the technique. You stratify by age, creating separate groups (18-year-olds, 19-year-olds, etc.), and check if the technique works within each age group.

How Stratification Works

  1. Identify the confounder (from your previous analysis)
  2. Split your dataset into strata based on confounder values (e.g., age groups, income brackets)
  3. Calculate the treatment effect within each stratum
  4. Compare effects across strata—if the relationship disappears or reverses, the confounder was key

This is exactly what you'd do to avoid Simpson's Paradox: instead of looking at the overall relationship, you examine it within each level of the confounding variable.

When to Use Stratification

Stratification works best when:

  • You have a clearly identified confounder
  • The confounder has discrete levels or can be grouped meaningfully
  • You have enough data in each stratum for reliable estimates

Key Takeaway: Stratification neutralizes confounders by comparing treatment effects only within groups where the confounder is constant, revealing whether the treatment itself truly matters.