Balancing methods in A/B testing: stratification, matching and weighting

Artem Erokhin, Denis Lavrov, Andrey Vidanov, Ivan Shcherbak, Insaf Rashitov19 Dec 2023

Problem

An analyst has to estimate the effect of a treatment, but the groups were not formed at random. Assignment may depend on something that also drives the outcome, or a random split may be skewed on an important feature, especially on a small sample. The plain difference of group means then mixes the real effect with the difference between the groups.

Example from the article: a drug has no effect, but a doctor prescribes it more often to patients with family support, who recover more often anyway. The test group recovers at 0.53 and the control group at 0.43, so the drug looks like it adds 0.1.

Solution in brief

Make the groups comparable on observed covariates before comparing outcomes. There are three families of methods: stratification (weight strata by their population share), matching (pair each test object with a similar control object) and weighting (reweight objects by the inverse of their propensity score). For each, the article gives pros and cons, and it compares them on a synthetic dataset.

Questions this case answers
  • How to estimate the effect of a change when assignment to groups is not random and the groups differ on known covariates
  • How to choose and validate a covariate balancing method (stratification, matching, weighting) before trusting an effect estimate
  • How to estimate a treatment effect when groups were not assigned at random?
  • How to choose between stratification, matching and weighting for balancing test and control?

Tools and methods

  • Post-stratification — weights group means by stratum share
  • Matching (exact, coarsened exact, Mahalanobis, propensity score) — pairs test objects with similar control objects
  • Inverse probability of treatment weighting (IPTW) — reweights objects by propensity score
  • Balance diagnostics — statistical tests, standardized mean difference, QQ-plots
  • causallib — Python library used for the examples
  • MatchIt — R library with more balance plots
Continue reading — it's free

Google or a one-time email code. No password.