Causal inference
Double/Debiased Machine Learning
Understand Neyman orthogonality, cross-fitting, nuisance rates, partially linear models, and limits of DML.
By the end you can
- Explain low-dimensional target parameters and high-dimensional nuisance functions
- Explain Neyman orthogonality and cross-fitting
- Implement DML for a partially linear treatment model conceptually
- Recognize support, identification, and weak-nuisance failures
Example
The effect looked strong until the models stopped scoring their own predictions
The estimate came out far from the truth on data that had nothing wrong with it. That is how the 2018 paper opens — with the failure rather than the cure. It draws the failure twice.
Figure 1 is a partially linear simulation. It has n = 500 observations and p = 20 covariates. A random forest holds everything nobody could hold in their head, and a naive, non-orthogonal plug-in estimator reads the treatment effect off it. The true nuisance function in that design is smooth and low-dimensional. That is the easy case, the one where flexible machinery should have nothing to fear. The estimate still lands far off the true value. Nothing about the data was adversarial. The regularization that made the forest fit well was enough on its own to shift the single number the study exists to produce.
Figure 2 changes one thing at a time on the same problem. The score is now the orthogonal one, and the nuisance functions are fit on the full sample. The estimator is still badly biased. Then the identical data is run again with two-fold cross-fitting, so that every prediction entering the score comes from a model fit outside the fold it is being scored on. The bias goes, and it goes at roughly the same spread. Of that panel the authors write, plainly: “Here, we see that the use of sample-splitting has completely eliminated the bias induced by overfitting.”
Two figures, two diseases. The first is regularization in the nuisance models leaking into the target. The second is those models grading their own homework. Neither figure touches a third thing. A variable neither model contains, pushing both who got treated and how the outcome turned out, survives every fold discipline in the paper. What you hold then is an honest measurement of the wrong quantity.
- The target parameter is the single number the study exists to produce — θ0 in the paper's notation — and it stays low-dimensional however large the machinery around it grows.
- The nuisance functions are the parts nobody reports — the flexible regressions for the outcome and for who was treated — which the score needs and the write-up never quotes.
- A Neyman-orthogonal moment or score, in the paper's phrase, is one with reduced sensitivity with respect to those nuisance parameters, so small errors in them barely move the target estimate.
- Cross-fitting is the rule that the predictions used on a fold must come from a model that never saw that fold; Figure 2 uses two folds and that is enough to remove the overfitting bias.
Two devices, and only one of the two diseases
Those are the two diseases in Figures 1 and 2, and double/debiased machine learning is a cure for exactly those two and no others. The paper's summary states the whole construction in one sentence: “We show that the impact of regularization bias and overfitting on estimation of the parameter of interest θ0 can be removed by using two simple, yet critical, ingredients: (1) using Neyman-orthogonal moments/scores that have reduced sensitivity with respect to nuisance parameters to estimate θ0, and (2) making use of cross-fitting which provides an efficient form of data-splitting.”
Two ingredients, and it is worth seeing why either alone is not enough. The first is the choice of score, the equation whose solution is the estimate. Many equations recover the target when the nuisance models are perfect. DML insists on one whose sensitivity to nuisance error is reduced. Nudge the outcome model or the treatment model slightly off and, to first order, the target does not move with it. Errors in the parts nobody reports stop travelling straight into the part everybody quotes. That is the answer to Figure 1.
That property holds around the truth. It says nothing about a nuisance model that is wrong because it memorised the rows it is now being scored on. That is why the orthogonal estimator in Figure 2 is still biased when the nuisances are fit on the full sample, and it is the second ingredient's job. Cross-fitting fits the nuisances outside a fold and evaluates the score inside it. Every prediction entering the estimate is then a prediction about data the fitting never saw.
Separating fitting from evaluating is not free, and the price has been measured. An honest rule buys coverage and pays for it in precision. Athey and Imbens reported both halves in PNAS in 2016: “Through a simulation study, we show that for our preferred method honest estimation results in nominal coverage for 90% confidence intervals, whereas coverage ranges between 74% and 84% for nonhonest approaches.” Honesty in their sense costs between 7% and 22% in mean squared error of the treatment effects. That is the trade in numbers. You give up some precision on the point estimate. The interval you get back means what it says.
What the two ingredients ask in return is a short list worth reciting before any run. The causal question has to be identified from the data you actually have. Treated and untreated units have to overlap enough to be compared at all. The score has to be the right score for the target you are claiming. The nuisance estimates have to converge fast enough for the argument to hold. Miss any of these and the machinery still runs, still prints an interval, and still means nothing. Handing a model every available column does not turn those columns into valid controls.
A workflow is just that list in working order. Define the score, which means naming the target and writing the Neyman-orthogonal moment equation for it. Partition the folds, which means respecting clusters, time, and whatever counts here as an independent unit. Fit the nuisances outside each fold. Evaluate the moments from out-of-fold residuals and score components. Then aggregate and report the target, its standard error, and some evidence of how much either depends on how you happened to draw the folds.
The score can be made insensitive to a bad regression. Nothing makes it insensitive to a bad assumption.
Key idea
Folds drawn on rows, when the unit is a person
Partition the folds is one line in that workflow and the easiest one to get wrong, because the default everywhere is to shuffle rows.
Rows are the independent unit only when each row is a separate story. Once a patient contributes many visits, a school many pupils, a household many purchases, a sensor many time blocks, or a network many connected members, shuffling rows puts pieces of the same story on both sides of the wall. This is not a hypothetical worry. It has been counted. A 2023 survey in Patterns went through the literature that uses machine learning and found leakage in 17 fields affecting 294 papers, sorted into a taxonomy of eight leakage types. Entry L3.2 in that taxonomy is exactly this failure. Kapoor and Narayanan describe it in one line: “In the extreme (but unfortunately common) case, training and test samples come from the same people or units.” A nuisance model trained on one side of such a split has, in effect, already seen the outcome it is later asked to predict on the other. And the correction can look clean while doing nothing, because the estimate settles and no diagnostic tells you which of the two diseases you treated.
The remedy has a standing reference, and it covers precisely the temporal, spatial and hierarchical cases listed above. Its conclusion is not hedged. Roberts et al. wrote in Ecography in 2017: “We also provide a series of simulations and case studies, in which we show that, for all instances tested, block cross-validation is nearly universally more appropriate than random cross-validation if the goal is predicting to new data or predictor space, or for selecting causal predictors.” They recommend blocking wherever a dependence structure exists — even when no correlation is visible in the fitted residuals. That is the case where a team is most likely to talk itself out of it.
So draw the boundary where units are genuinely independent, and keep it there even when it costs you balanced folds. For anything longitudinal, and for anything that will be deployed forward in time, the wall also has a direction. A nuisance model may use only what was available before the moment it is predicting.
Cross-fitting keeps only the promise its fold boundary actually makes.
Analogy
Noise-canceling around a signal you did record
A microphone circuit can be built to cancel background noise. It carries a running estimate of that noise and subtracts it. A well-designed circuit is arranged so that small errors in the estimate barely disturb the one tone you meant to keep. That is the same reduced sensitivity DML buys, played out in voltages rather than in moment conditions.
Push the comparison and it tells you the limit as well. The circuit cannot recover a tone the microphone never picked up, and it cannot subtract a second source nobody told it about. Cancellation is protection for a recording you managed to make.
Suppression buys precision on a signal that was captured; it conjures nothing that was not.
Example
Orthogonality is a construction, not one estimator
Nothing in the argument so far was specific to a single effect on a single outcome. Wherever you can write a Neyman-orthogonal score for a quantity, you can run the same discipline of fitting outside and evaluating inside around it. The same list of prerequisites comes along unchanged.
- For an average treatment effect, or the effect on the treated, the score leans on two nuisances at once, a model of the outcome and a model of who was treated.
- In the partially linear case — the setting of the paper's own Figures 1 and 2 — you residualize the treatment and the outcome on the controls, then read the effect from what is left of each.
- A continuous treatment costs more, because the score now needs a density over treatment values or a regression structure standing in for one.
- Policy parameters can be written the same way, with an orthogonal score aimed at the value of a rule or at some structural target beneath it.
Comparison
One column moved and the other did not
It helps to keep two columns in mind, because the paper's own application has trouble in each and only one of them gets solved.
On one side sits everything about estimation. How the nuisance functions were fit, whether their errors leak into the target, whether the model that made a prediction had already seen the row it is predicting. The paper's 401(k) application shows how much that side can move. The data is the 1991 Survey of Income and Program Participation, the treatment is 401(k) eligibility, the outcome is net financial assets. With no controls at all the effect is enormous: “Turning to the results, it is first worth noting that the estimated ATE of 401(k) eligibility on net financial assets is $19,559 with an estimated standard error of 1413 when no control variables are used.” The DML2 estimates in Table 2 all land between $6,830 and $9,247. Those were computed over 100 sample partitions, with 2-fold and 5-fold cross-fitting, across six different nuisance learners: lasso, regression tree, forest, boosting, neural net and ensemble. Twelve combinations of learner and fold count, one narrow band. That is what a solved estimation problem looks like.
On the other side sits everything about design. Whether treatment is as good as randomly assigned given the covariates you have. Whether the groups overlap enough to compare. Whether the quantity you named is the quantity a decision actually needs. None of that moved across those twelve runs, and none of it can, because it is a claim about how the data came to exist and the estimator only ever sees the data. Worse, the reflex that seems to help it hurts something else. A 2021 paper in the Journal of Econometrics opens on exactly that point: “Researchers often argue that unconfoundedness is more plausible when more covariates are included in the analysis. Less discussed is the fact that covariate overlap is more difficult to satisfy in this setting.” Overlap is a restriction that tightens as covariates are added. D'Amour and his four co-authors then make it checkable rather than rhetorical. Under strict overlap with bound η, no classifier of treated against control covariate distributions can have accuracy above 1 - η. Train that classifier and you have an upper-bound test on the assumption the whole estimate rests on.
The method solves an estimation problem sitting inside a larger causal design. The trap is mistaking the noise it removes for the doubt it leaves standing.
Traditional plug-in
Insert fitted nuisances into a target formula.
- Simple
- First-order bias
- Sensitive to overfitting
Orthogonal DML
Use score insensitive to small nuisance errors.
- Flexible learners
- Cross-fitting
- Rate conditions
Design failure
Unmeasured confounding or no overlap.
- Not nuisance error
- No algorithmic repair
- Needs new evidence
Steps
Ask for the four pieces one at a time
An audit goes wrong the moment an implementation is handed over as a single function call, because a bundle can only pass or fail as a bundle. Ask for it in pieces, and ask in this order.
The score first — which target does it estimate, and is the moment equation the orthogonal one for that target or a convenient approximation of it. The nuisances next — what was fit, on which columns, and how well it predicted out of fold. Then the folds — what defines a unit here, whether the split respects that definition, and whether time order was preserved where it matters. Last the causal assumptions, written out as sentences somebody is willing to defend, not buried in an appendix.
That is not an idiosyncratic checklist. It is the shape of a serious implementation. DoubleML, the reference package for R, states its anatomy in one line: “The double machine learning framework consists of three key ingredients: Neyman orthogonality, high-quality machine learning estimation and sample splitting.” The package exposes them as separate arguments — score, learners, dml_procedure, and n_folds together with n_rep — and defaults to n_folds = 5. Its authors, writing in the Journal of Statistical Software in 2024, report that K = 4 or K = 5 works better than K = 2, and they recommend repeating the estimation over multiple sample splits. That is where the last line of the workflow comes from. n_rep is the published way to show how much the answer depends on the draw.
Kept apart, each piece can fail where you can see it. Bundled, a failure in the fourth hides comfortably behind good numbers from the first three.
- 1
Write the moment
Target and nuisance functions with orthogonality rationale.
- 2
Choose fold unit
Cluster, person, site, or time period.
- 3
Validate nuisances
Out-of-fold calibration, support, and residual behavior.
- 4
Inspect score
Tails, influence, and fold contribution.
- 5
Stress specification
Learner libraries, folds, trimming, and target variants.
When the machinery earns its keep
Reach for DML when the nuisance functions really are complicated — many covariates, relationships nobody would have guessed — while the thing you must report stays a single number, and when that number needs an interval somebody is going to act on. Those conditions together make the case.
That second condition deserves more suspicion than it usually gets, because flexibility and honest intervals are not the same achievement. A competition run at the 2016 Atlantic Causal Inference Conference tested exactly this. Thirty methods were submitted across two tracks, 15 do-it-yourself and 15 black-box. The black-box submissions, together with the post-competition methods, were evaluated on 7,700 datasets: 77 scenarios by 100 replications, 58 covariates each. The results appeared in Statistical Science in 2019. On overall performance the verdict was clear, and it favours flexibility: “The most consistent conclusion was that methods that flexibly model the response surface perform better overall than methods that fail to do so.” On intervals it was not. Every interval was intended to have 95% coverage. The last nine methods ranked by coverage all fell below 75%. Point accuracy and interval honesty were separate results in the same table.
So test the case instead of assuming it. A DML estimate should beat a transparent baseline. It should also hold still when you swap the learner library for another reasonable one — the way the 401(k) estimates held inside one band across six learners.
Where the design already did the work — a clean randomized comparison, a handful of covariates, a model you can write on a single line — a simpler estimator is easier to defend and frequently loses nothing in efficiency. The machinery exists to absorb nuisance complexity. There is nothing in it that repairs a design.
An estimate that moves when you change the learner was never an estimate of the treatment.
Key takeaways
- DML keeps one low-dimensional target — θ0 in the 2018 paper's notation — separate from the complicated functions the estimate needs but nobody reports.
- The first of the paper's two ingredients is a Neyman-orthogonal moment or score, built to have reduced sensitivity with respect to the nuisance parameters, so that small errors in them barely move the target.
- The second ingredient is cross-fitting: in Figure 2 of the same paper an orthogonal estimator fit on the full sample is still badly biased, and two folds on identical data remove that bias at roughly the same spread.
- Folds must be drawn around the unit that is genuinely independent, and forward in time wherever time matters. Roberts et al. find block cross-validation nearly universally more appropriate for all instances tested, and Kapoor and Narayanan count leakage in 17 fields affecting 294 papers.
- Identification and overlap are prerequisites rather than outputs, and overlap gets harder as covariates are added: under strict overlap with bound η, no treated-against-control classifier can have accuracy above 1 - η.
- A simple design-based estimator can beat DML outright whenever the design was already doing the work, and flexible modelling is no guarantee of an honest interval — across 7,700 datasets with nominal 95% intervals, the last nine methods ranked by coverage all fell below 75%.