Estimating Dose-Response Curves When DoubleML Falls Short

DoubleML's partially linear model returns a single slope. A doubly robust estimator recovers nonlinear dose-response curves even if one model is wrong.

Estimating Dose-Response Curves When DoubleML Falls Short

Not all treatments are binary: marketing spend, price, discount depth, app notifications, customer service response times. Rather than asking “did this treatment work?”, we often need to know “what’s the right amount?” When the treatment is continuous and chosen rather than randomised, a common choice is double machine learning (Chernozhukov et al. 2018), usually the partially linear model in DoubleML (Bach et al. 2022). For a binary treatment, DoubleML’s interactive model is doubly robust; for a continuous treatment, the partially linear model is the usual choice, and it has three limitations that matter in practice:

  • It returns one number. The effect is assumed linear, so a rise-then-fall or a saturating curve comes back as a single slope.
  • Its default score isn’t doubly robust. With a wrong treatment model the estimate is biased, however good the outcome model is.
  • It gives one answer per population. If you need a curve for each of 200 groups, looping over them gives noisy slopes for the small ones.

This article runs one simulation per limitation and shows an estimator that addresses all three: the doubly robust dose-response estimator of Kennedy et al. (2017), with a second stage that partially pools curves across a hierarchy. It then looks at three practical questions: which machine learning models to use, how existing packages compare, and what to do when a confounder is unmeasured.

1. One slope versus a whole curve

Let’s start with the partially linear model. DoubleML’s DoubleMLPLR fits

Y = θD + g(X) + ε

where D is the treatment, X the confounders and g(X) the effect of the confounders on the outcome. DoubleML estimates θ with two machine learning models: an outcome model, which predicts Y from X, and a treatment model, which predicts D from X. It then regresses what’s left of Y on what’s left of D (this is called partialling out).

Models like these are called nuisance models: we need them, but don’t care about them for their own sake. Cross-fitting (each row’s predictions come from models trained on other rows) and an orthogonal score (an estimating equation that is insensitive to small errors in the nuisance models) stop the regularisation in these models from biasing θ, which is what makes its confidence interval valid. The catch is the θD term: it assumes the effect is linear, so every extra unit of treatment has the same effect wherever you start.

If the true effect is a curve, you still get a single slope back: roughly the curve’s average slope across the doses in your data.

The alternative is to estimate the whole curve: for every dose a, the average outcome if everyone received dose a. It takes three steps:

Step 1: Cross-fit two nuisance models. An outcome model μ(x, a) = E[Y | X, A]; unlike DoubleML’s outcome model, this one includes the dose as an input. And a generalised propensity score (GPS; Hirano and Imbens 2004) π(a | x): the density of the dose given X.

Step 2: Build a pseudo-outcome. Combine them into one number per row, ξ, whose average at each dose is the causal curve.

Step 3: Smooth, with pooling. Regress ξ on the dose with penalised splines (Eilers and Marx 1996), sharing strength across a hierarchy of groups.

Step 2 is where the robustness comes from. It starts with a regression estimate, the outcome model’s prediction at dose a averaged over everyone, which on its own is an S-learner. It then adds a correction: the residuals of units that actually got a dose near a, weighted by how unusual that dose was for them so that they represent everyone. If the outcome model is right, the correction is just noise; if it’s wrong, the correction removes the error, provided the model of who gets which dose is right. One of the two has to be right, not both: that’s double robustness.¹

Step 3 turns these noisy per-row numbers into a smooth curve and, when there are groups, lets small groups borrow strength from larger ones.

¹ The pseudo-outcome is ξ = (Y − μ(X, A)) · ϖ(A)/π(A | X) + m(A), where μ is the outcome model, π the density of the dose given X, ϖ the overall density of the dose and m(a) the outcome model averaged over X at dose a (Kennedy et al. 2017). For a binary treatment this is the AIPW estimator behind DoubleML’s DoubleMLIRM.

2. Nonlinear effects

Two nonlinear shapes are common:

  • Saturating. Diminishing returns. The first £10k of ad spend in a region buys more conversions than the next £10k, and the 20th app notification this month adds almost nothing.
  • Inverted U. Too much of a good thing. Deeper discounts win orders but give away margin, and a higher price raises revenue per unit until volume falls away.

In practice you rarely know the shape in advance, and the decision you need to make (how much, and where to stop) depends on it. So the method should find the shape rather than assume it.

The simulation:

  • 4,000 units and five covariates.
  • Three covariates drive both the dose (through nonlinear functions) and the outcome, so they confound the effect. A fourth changes how much the dose varies between units; the fifth does nothing.
  • The true effect is an inverted U in one dataset and a saturating curve in the other.
  • Both methods use the same learner for every nuisance model: a stack of gradient boosting and a spline regression (section 4 explains why).

Estimated dose-response curves: DR vs DoubleML

Each panel is one simulated dataset. Dashed black: the true dose-response curve. Blue: the DR curve, with a 95% band. Orange: DoubleML’s estimate, a straight line with slope θ. Curves cover the middle 90% of observed doses and are centred, since only the shape is being compared. Image by author.

The DR curve follows both shapes. DoubleML’s line can only tilt. On the inverted U its slope is close to zero: read on its own, it says the dose doesn’t matter, when moving away from the middle in either direction costs a lot. On the saturating curve it gives every unit the same return, understating it at low doses and overstating it at high ones.

3. Robustness to a wrong nuisance model

Both nuisance models are approximations, and with a continuous dose the model of who gets which dose is especially easy to get wrong: it has to describe the whole spread of doses each unit might get, not just the average one. Doses are often set by unwritten business rules (pricing tiers, budgets split by last year’s revenue, a cap on notifications), and some segments see a narrow range of doses while others see a wide one. The outcome model can be wrong too. So the test is what happens when one of them is wrong.

DoubleML’s partially linear model has two scores (estimating equations). The default, partialling out, only protects against a wrong outcome model: if the treatment model is wrong, θ is biased however good the outcome model is (Valentin et al. 2025). The alternative IV-type score is doubly robust, but only for the single slope θ. What we want is a doubly robust curve, which is what the pseudo-outcome from section 1 provides.

The simulation:

  • 3,000 units and 50 confounders: four with strong nonlinear effects on both the dose and the outcome, and 46 weak ones.
  • “Right” nuisance models are correctly specified. A “wrong” model treats every confounder as linear.
  • The true effect is the inverted U.

Each dataset gets a correct and a wrong version of the outcome model and of the dose model. The S-learner uses the outcome model alone, so it shows what the wrong outcome model costs you.

Estimation error with right and wrong nuisance models

Each panel shows each estimator’s error: its average estimated curve over 30 simulated datasets, minus the true curve. The dashed line at zero is the truth, so the closer to it the better. The blue band shows where 90% of the individual DR curves fall. Curves are centred. Image by author.

With the outcome model wrong, the S-learner misses the curve, while DR stays much closer, because the weighted residuals correct most of the error. With the dose model wrong, DR stays close. With both wrong, DR misses too: it needs at least one model right. DR’s remaining error sits at the ends of the dose range, where the wrong outcome model is most wrong and the fewest units are available to correct it.

4. Choosing the nuisance models

Real data rarely has a handful of confounders. A customer table has dozens of features: tenure, spend history, products held, past contacts. Most of them nudge both the dose a customer gets and their outcome a little. You don’t know which matter or how, so both nuisance models end up as flexible, regularised machine learning models. The choice of learner changed the answer a lot.

The simulation:

  • The same data as section 3: 3,000 units and 50 confounders.
  • Each estimator is fitted twice, changing only the machine learning model used for the nuisance models:
    • Boosting alone: gradient-boosted trees.
    • A stack: two models fitted side by side, boosted trees and a spline regression (a smooth curve in each confounder, like a GAM). Their predictions are combined as a weighted average, with the weights chosen by cross-validation.
  • Three estimators: the S-learner, DoubleML and the DR estimator, each fitted with both learners.

Because the nuisance models are only approximations of messy real-world relationships, the learner you choose is not a detail: it shapes how well any of these estimators recovers the true curve. That is why the earlier simulations used the stacked learner, and why the DR estimator is best paired with flexible, carefully chosen nuisance models when you need a whole dose-response curve rather than a single slope.