σ StatsDoge Causal inference workflows
9
Workflow·4 steps·branched

Dose–response with average potential outcomes (DoubleML APO)

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

For a multi-valued or continuous treatment: estimate E[Y(d)] at each dose and the contrasts between them, all cross-fitted.

1

Input · what goes in

Outcome Y, a multi-valued / continuous treatment D (the dose), and covariates X.

Show data format & exampleHide example

Format — one row per unit: outcome y, dose d, covariates X.

  y    d    x1    x2
 2.1   0    0.4  -1.1
 3.4   2   -0.1   0.6
 1.8   1    1.2   0.3
2

Pipeline · the recipe ⑂ has parallel branches

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

1
Data prep

Declare the multi-valued treatment

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

What happens here

Set up DoubleMLData with the dose as the treatment.

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

Average potential outcome at each level

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

What happens here

An orthogonal APO per dose level, cross-fitted with ML nuisances.

Formula
heta(d)=\mathbb{E}\!\left[\,Y(d)\, ight]
Reads from the input data Feeds into the final output
Key code
apo = dml.DoubleMLAPOS(dml_data, ml_g, ml_m, treatment_levels=levels).fit()

Reference / docs ↗

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

Contrasts between doses

Uncertainty quantification — standard errors, intervals, and aggregation.

What happens here

Differences of APOs give causal effects of moving from one dose to another.

Formula
heta(d)- heta(d')=\mathbb{E}\!\left[\,Y(d)-Y(d')\, ight]
Reads from the input data Feeds into the final output
Key code
apo.causal_contrast(reference_levels=0)

Reference / docs ↗

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

Plot the dose–response curve

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

What happens here

E[Y(d)] across the treatment range, with confidence bands.

Reads from the input data Feeds into the final output
Key code
# dose on x, APO on y, with CIs
Discussion on this step (0)
  • No comments on this step yet — be the first.
3

Output · what you get 4 figures

The data: outcome against treatment dose before adjustment.
Fig 1The data: outcome against treatment dose before adjustment.
Average potential outcome E[Y(d)] estimated at each treatment level.
Fig 2Average potential outcome E[Y(d)] estimated at each treatment level.
Causal contrasts between dose levels, with confidence intervals.
Fig 3Causal contrasts between dose levels, with confidence intervals.
The estimated dose–response curve across the treatment range.
Fig 4The estimated dose–response curve across the treatment range.

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.

For a multi-valued or continuous treatment: estimate E[Y(d)] at each dose and the contrasts between them, all cross-fitted.

Discussion (0)

  • No comments yet — start the conversation.