σ StatsDoge Causal inference workflows
11
Workflow·5 steps·branched

Group & conditional effects with DoubleML (GATE / CATE)

Source DoubleML — Bach, Chernozhukov, Kurz & Spindler
Summary by StatsDoge

Slice the average effect: Group Average Treatment Effects and a CATE surface from a debiased IRM, with simultaneous confidence bands.

1

Input · what goes in

Outcome Y, binary treatment D, covariates X — plus the grouping variable(s) you want effects for.

Show data format & exampleHide example

Format — one row per unit: y, d ∈ {0,1}, covariates X.

  y     d   age  inc   educ
 1.2    1   41   38k   13
-0.3    0   53   21k   11
2

Pipeline · the recipe ⑂ has parallel branches

↑ Click any step in the diagram to read its logic, code, assumptions & discussion.

1
Data prep

Build DoubleMLData (y, d, X)

Data preparation — shapes the raw inputs into what the estimator expects.

What happens here

Declare outcome, binary treatment and covariates.

Reads from the input data Feeds into the final output
Key code
dml_data = dml.DoubleMLData(df, y_col='y', d_cols='d', x_cols=X)
Discussion on this step (0)
  • No comments on this step yet — be the first.
2
Estimation

Fit an Interactive Regression Model (IRM)

The core estimate — where the causal quantity itself is computed.

What happens here

Cross-fitted, Neyman-orthogonal IRM with ML nuisances — the per-unit signal for heterogeneity.

Formula
\psi(W; heta,\eta)=g_1(X)-g_0(X)+\dfrac{D\,(Y-g_1(X))}{m(X)}-\dfrac{(1-D)(Y-g_0(X))}{1-m(X)}- heta
Reads from the input data Feeds into the final output
Key code
dml_irm = dml.DoubleMLIRM(dml_data, ml_g, ml_m).fit()

Reference / docs ↗

Discussion on this step (0)
  • No comments on this step yet — be the first.
3
Heterogeneity

Group Average Treatment Effects

Heterogeneity — who is affected, and by how much, not just on average.

What happens here

Average the orthogonal signal within each group to get a GATE per subgroup.

Formula
heta_g=\mathbb{E}\!\left[\, heta(X)\mid G=g\, ight]
Reads from the input data Feeds into the final output
Key code
gate = dml_irm.gate(groups=groups); gate.confint(joint=True)

Reference / docs ↗

Discussion on this step (0)
  • No comments on this step yet — be the first.
4
Heterogeneity

CATE via a basis expansion

Heterogeneity — who is affected, and by how much, not just on average.

What happens here

Project the signal onto a spline basis to trace a smooth CATE in a covariate.

Formula
heta(x)\approx \phi(x)^ opeta,\qquad heta(x)=\mathbb{E}\!\left[\,Y(1)-Y(0)\mid X=x\, ight]
Reads from the input data Feeds into the final output
Key code
cate = dml_irm.cate(basis); cate.confint(X_grid, joint=True)

Reference / docs ↗

Discussion on this step (0)
  • No comments on this step yet — be the first.
5
Reporting

Plot with simultaneous bands

Reporting — turn the numbers into a figure or table a reader can act on.

What happens here

Show GATE bars and the CATE curve with joint (not pointwise) confidence bands.

Reads from the input data Feeds into the final output
Key code
# matplotlib: GATE bars + CATE curve with joint CIs
Discussion on this step (0)
  • No comments on this step yet — be the first.
3

Output · what you get 3 figures

Group Average Treatment Effects — the effect within each subgroup, with joint confidence bands.
Fig 1Group Average Treatment Effects — the effect within each subgroup, with joint confidence bands.
CATE estimated along a continuous covariate, with simultaneous bands.
Fig 2CATE estimated along a continuous covariate, with simultaneous bands.
A smooth CATE surface from a spline basis projection of the orthogonal signal.
Fig 3A smooth CATE surface from a spline basis projection of the orthogonal signal.

Figures reproduced from DoubleML — Bach, Chernozhukov, Kurz & Spindler — unofficial community showcase; all credit to the original authors.

⚠️ Unofficial community showcase of a DoubleML example. Not affiliated with the authors; figures are from the public documentation. All credit to Bach, Chernozhukov, Kurz & Spindler.

Slice the average effect: Group Average Treatment Effects and a CATE surface from a debiased IRM, with simultaneous confidence bands.

Discussion (0)

  • No comments yet — start the conversation.