Chuyển đến nội dung

Bài 13 · Potential Outcomes

Regression for Causal Effects

Use ordinary least squares to estimate causal effects under ignorability: choosing controls, interactions for heterogeneous effects, g-computation and what the treatment coefficient really means.

Linear regression is the workhorse of applied causal inference. Used carefully, the coefficient on the treatment variable is a causal effect. Used carelessly, it is just a partial correlation. This lesson shows what makes the difference.

When the coefficient is causal

In the model

TEXT
Y = a + tau * T + b1 * X1 + ... + bk * Xk + error

tau is the causal effect of T if

  1. the controls X block every backdoor path (conditional ignorability, see the assumptions),
  2. the functional form is roughly right (outcome is linear in X, effect is constant), and
  3. no control is a collider or a consequence of treatment (see mediators and bad controls).

The regression "controls for" X by comparing treated and untreated units with the same values of X.

Python OLS with controls

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Leaving out health (a confounder) biases the effect; including both confounders recovers about 1.5. Omitting age, which has a weaker link, changes things less. Which variables matter is a causal question.

Heterogeneous effects with interactions

If the effect depends on a covariate, add an interaction T * X. Centering X makes the main coefficient the effect at the average X, i.e. an estimate of the ATE.

Python Interaction and the average effect

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

With the interaction, the model tells you how the effect changes with x (slope about 0.8) and gives the ATE at the mean of x.

G-computation (standardization with a model)

A more flexible recipe, g-computation, uses the regression as a prediction machine:

  1. Fit a model of Y on T and X.
  2. Predict every unit's outcome as if treated (T=1) and as if untreated (T=0).
  3. Average the difference over the population (ATE) or over the treated (ATT).
Python G-computation with a fitted model

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The same fitted model gives both ATE and ATT just by averaging over different groups: another view of why estimand and estimator are separate.

Pitfalls of regression adjustment

  • Wrong functional form: if Y is curved in X, a straight line leaves residual confounding. Add polynomials or splines, or use matching.
  • Extrapolation: with poor overlap, regression silently predicts in regions without data.
  • Bad controls: adding mediators or colliders ruins the estimate.
  • Coefficient on a control is not causal: health's coefficient is just a nuisance parameter (the "Table 2 fallacy").
  • Standard errors: use robust (heteroskedasticity-consistent) errors in practice.

Regression with a binary treatment and many covariates weights strata by how much treatment variation they contain, so with heterogeneous effects it does not equal the ATE. G-computation and weighting avoid that.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. The coefficient on T in a regression is a causal effect if:

    Causal meaning comes from the assumptions, not from fit or significance.
  2. 2. In g-computation the ATT is obtained by:

    Predict Y(1) - Y(0) for each unit, then average over the treated.
  3. 3. Centering X before adding the T*X interaction makes the T coefficient:

    With a centered X, X = 0 corresponds to the mean.
  4. 4. Which is a bad control?

    Conditioning on a mediator removes part of the effect you want.

Summary

  • A regression coefficient is causal only under ignorability, correct form and sensible controls.
  • Interactions describe effect heterogeneity; centering gives the average effect.
  • G-computation predicts both worlds and averages, producing ATE or ATT.
  • Watch for misspecification, poor overlap and bad controls.

Next: Randomization Inference and the Bootstrap

Theo dõi tiến độ của bạn

Tạo tài khoản miễn phí để đánh dấu bài đã học và tiếp tục từ chỗ bạn dừng lại trên mọi thiết bị.