Skip to content
StatsOtter A workspace for causal thinking
Method library WORKFLOW / 018
Research workflow/5 steps

Double machine learning for the 401(k) effect (DoubleML)

Source DoubleML — Bach, Chernozhukov, Kurz & Spindler
01
The method workspace

Follow the analysis.

Select a node to explore the method

Method mapInput → 5 steps → output
START WITHInput data
ARRIVE ATResults
Read step 01
Inside the methodReasoning, equations & implementation
Step 1 of 5
01
Data prep

Build DoubleMLData (y, d, X, z)

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

What happens here

Declare outcome, treatment, covariates and (optionally) an instrument.

Reads fromNot specified Feeds into#2
Key code
dml_data = dml.DoubleMLData(df, y_col='net_tfa', d_cols='e401', x_cols=X)
Discussion on this step (0)
StatsOtterDiscussion starter · Editorial note

Before using this step, make its assumptions and its output explicit. A useful peer note explains what you would check, what could go wrong, or what would change your interpretation.

Questions to explore
  1. Which assumption matters most here, and what evidence could challenge it?
  2. What would you check before passing this output to the next step?

Peer discussion

  • Bring your experience, a question, or a different perspective.
02
Data contract

Inputs & data

Outcome (net financial assets), treatment (401(k) eligibility), covariates, and an instrument (eligibility) for the IV model.

Show data format & exampleHide example

Format — one row per household: outcome y, treatment d, covariates X (and instrument z for IIVM).

  net_tfa(y)  e401(d)  age  inc    educ  ...
   12000        1      41  38k    13
    -400        0      53  21k    11
03
Read the evidence

Results & interpretation

4 figures Workflow discussion 3
01FigureEffect estimates across PLR / IRM / IIVM models and ML learners, with 95% confidence intervals.
02FigureDistribution of net financial assets — the outcome variable.
03FigureTreatment-probability (propensity) distribution by 401(k) eligibility.
04FigureAn overview of the SIPP 401(k) sample used in the example.

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

Context & interpretation

The DoubleML 401(k) example (SIPP data). Build the DoubleMLData, choose ML learners, and estimate the effect three ways (PLR / IRM / IIVM). Unofficial summary.

Peer notes

Discuss the workflow (3)

  • 6

    Cross-fitting + Neyman-orthogonal scores = you can throw any ML at the nuisances and still get √n-consistent, valid CIs. This is the way.

    5

    And it generalizes AIPW cleanly. PLR for a quick read, IRM when effects are nonlinear in X.

  • 2

    The 401(k) example is the perfect teaching case. Same data, three orthogonal scores, sane answers.

  • 2

    Pairs beautifully with GRF: DoubleML for the average, causal forest for the heterogeneity.

IN THE MARGINS

Peer discussion