How does double machine learning work?
Two nuisance models do the cleaning: one predicts which fields get the treatment from their background, the other predicts the outcome from the same background, and the leftovers are compared. The method is built so the two models’ errors matter only when multiplied together, and cross-fitting stops any model being judged on data it has memorised.
Module 3's last quick check: time zero is the moment everyone's clock starts, when each unit becomes eligible and the treatment decision is made. Starting everyone at the same moment stops you comparing long-term users with newcomers. In the prologue we met double machine learning on a nitrogen question.
One model predicts how much nitrogen each field got from its background; another predicts its protein from the same background; then the leftovers are compared. Today we look under the bonnet: what each part does, and what it quietly assumes. The two prediction models have an unflattering name: nuisance models. They aren't the answer; they're the cleaning. Model 1 learns which kinds of field tend to get the extra nitrogen. Model 2 learns how the background predicts protein.
Any flexible machine-learning method can do the job: random forests, boosted trees, neural networks. Nothing in the final answer depends on reading their insides, only on how well they predict. Machine-learning predictions are never perfect, and their errors tend to lean one way: they pull extreme cases towards the middle. Plug them into an ordinary analysis, and that lean biases the answer.
Double machine learning is built so that the final estimate depends on the two models' errors only when they're multiplied together. If each model is only modestly wrong, their product is small, and the answer barely moves. The property has a forbidding name, orthogonality, but the idea is simple: two small errors multiplied make a tiny one.
The second safeguard is cross-fitting. Split the fields into, say, five groups. Train the models on four, predict the fifth, and rotate until every field has a prediction from models that never saw it. A model judged on data it has memorised looks far better than it is, and that flattery would leak into the answer.
Three assumptions remain, whatever the machinery. First, no unmeasured confounding: every common cause of nitrogen and protein is in the data. Second, overlap: every kind of field had some chance of getting either treatment. If the best fields always got the extra pass, there's nothing to compare them with.
Third, a well-defined treatment: an "extra pass" can't mean a different product, rate and timing on every farm. Free implementations of double machine learning exist in Python and R. The judgement about those three assumptions doesn't come with them. Next: who benefits? Methods that find where an effect is bigger or smaller.
Three, whatever the machinery. No unmeasured confounding: every common cause of treatment and outcome is in the data. Overlap: every kind of field had some chance of getting either treatment. And a well-defined treatment: an “extra pass” can’t mean a different product, rate and timing on every farm. Free software implements the method; the judgement doesn’t come with it.
Every kind of unit must have had some chance of getting either treatment. If the best fields always got the extra pass of nitrogen, there are no comparable fields without it, so there is nothing to compare them with, and no method can supply the missing comparison.
Causal evidence is changing how farming is measured and rewarded. Leave your email and we will tell you when new films, courses and findings are published.
Prefer to read online? Vitagri also writes on Substack. See our privacy policy for how we use your email.