How to use Causal Inference when A/B testing is not available

Harry Lu8 Jan 2024

Problem

An ad platform wants to know whether contextual targeting (matching an ad to the content a user is listening to) gives listeners a better ad experience. Advertisers buy contextual targeting together with other targeting options in the same campaign. The platform cannot assign contextual targeting at random, so a user-level A/B test is not possible. A direct comparison is biased because the groups differ in users, advertisers and content.

Example from the article: the author, a data scientist at Spotify, measured how contextual targeting of podcast ads changes user engagement, using only historical data.

Solution in brief

Estimate each unit's probability of being contextually targeted from observed user, advertiser and publisher attributes (the propensity score). Match treated and control units with similar scores, then compare the outcome across matched pairs. Run the same pipeline with a fake treatment (an A/A test) to confirm it finds no effect where none exists.

Questions this case answers
  • How to estimate the effect of a feature on user engagement when the treatment is bundled with other advertiser-chosen settings and cannot be randomly assigned
  • How to validate an observational effect estimate when hidden confounders may bias it
  • How to measure the effect of a targeting product on user experience when users cannot be randomized into treatment and control?
  • How to build a comparable control group from historical data using propensity scores?

Tools and methods

  • Propensity score matching (PSM) — builds a control group that looks like the treated group on observed attributes.
  • Logistic regression — predicts treatment status from covariates (any classifier works).
  • A/A test — runs the pipeline with a randomly assigned fake treatment as a bias check.
  • psmpy — Python package for the matching step.
Continue reading — it's free

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