Linear Regressions for Causal Conclusions

Mariya Mansurova10 Apr 2024

Problem

Analysts often see only correlations but have to decide what a change will do. A linear regression can estimate a treatment effect, but adding the wrong variables to it biases the estimate or inflates its error. Rollouts also tend to be non-random: a new tool goes first to the best-prepared group, so the groups differ before treatment.

Example from the article: a support team gives an LLM assistant to half of its agents and measures time spent per case. The treated agents have longer tenure, so the naive estimate overstates the assistant's effect.

Solution in brief

Write the outcome as a regression on the treatment flag plus controls chosen from a causal graph. Include confounders (affect both treatment and outcome) and outcome-only predictors that reduce noise. Leave out variables that only predict treatment, and variables that are consequences of the outcome. An interaction term gives effects per sub-group.

Questions this case answers
  • How to estimate a treatment effect with regression when assignment is only partly random and the groups differ in a variable that also drives the outcome
  • How to choose the control variables of an effect-estimating regression so that confounders are removed without adding bias or noise
  • How to read an A/B test or an observational comparison with a linear regression and get an unbiased effect estimate?
  • How to decide which variables to add to the regression so the treatment effect is not biased?

Tools and methods

  • Ordinary least squares in statsmodels — estimates the treatment coefficient, p-value and confidence interval.
  • Regression adjustment — adds covariates to narrow the interval or remove confounding.
  • Causal graph — decides which variables to control for.
  • Interaction term — separate effects for sub-groups, such as trained and untrained agents.
  • Weighted regression — handles agent-level averages instead of case-level rows.
Continue reading — it's free

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