A Meta-learner for Heterogeneous Effects in Difference-in-Differences

Hui Lan, Haoge Chang, Eleanor Wiske Dillon, Vasilis Syrgkanis

Introduction

Difference-in-Differences (DiD) is a foundational tool in causal inference for observational panel data, relying on the "parallel trends" assumption: in the absence of treatment, the treated and control groups would have evolved similarly. While recent advances in DiD have been substantial, most methods only estimate average treatment effects. In modern applications, such as personalized medicine or targeted policy-making, researchers increasingly need to understand heterogeneous treatment effects—how the effect varies across different subgroups.

While machine learning has successfully estimated the Conditional Average Treatment Effect (CATE) in cross-sectional data, applying these methods directly to panel data under the DiD framework is mathematically flawed. Specifically, if researchers want to understand how the treatment effect varies based on a subset of variables (e.g., controlling for 100 economic variables to satisfy parallel trends, but only projecting the effect onto "age" and "income"), standard CATE estimators yield biased results.

This paper introduces a novel, doubly robust machine learning method for estimating heterogeneous treatment effects in panel data. By framing the estimation as a convex risk minimization problem, the authors allow researchers to use off-the-shelf ML models to uncover personalized treatment effects based on specific features, all while remaining mathematically robust to errors in the underlying statistical models.

Methodology

The authors propose a doubly robust meta-learner specifically designed for the Conditional Average Treatment Effect on the Treated (CATT). Their approach is built on several key innovations:

  1. Neyman Orthogonal Moments: The authors derive a new conditional moment equation for the CATT that satisfies Neyman orthogonality. This ensures their target estimate is highly insensitive to small estimation errors in "nuisance" models (e.g., models predicting the baseline outcome or the probability of receiving treatment).
  2. Convex Risk Minimization: They translate this orthogonal moment into an incomplete squared loss function. This turns a complex causal inference problem into a standard, strongly convex machine learning optimization task.
  3. Plug-and-Play ML: Because the problem is formulated as a standard loss function, researchers can plug in generic ML algorithms—such as XGBoost, Random Forests, or Neural Networks—to estimate the CATT.
  4. Extensions: The framework is extended to handle Instrumental Variables (IV-DiD) for cases of imperfect treatment compliance, and generalized to solve broader problems involving conditional functionals under covariate shift.

Experimental Setup

The researchers validated their approach across three distinct data environments:

  • Fully Synthetic Data: Simulated datasets with known data-generating processes to test Mean Squared Error (MSE) against a ground truth, including highly imbalanced setups where the control group was 10x larger than the treated group.
  • Semi-Synthetic Data: Bootstrapped from a real-world minimum wage dataset to provide realistic covariate distributions while maintaining a known, injected treatment effect.
  • Real-World Case Study: A county-level dataset (2001–2007) studying the effect of raising the minimum wage on teen employment, a classic problem in econometrics.

Key Insights and Results

Asymmetry as an Advantage

Standard CATE models require estimating what the outcome would have been under treatment for the control group. By focusing specifically on the CATT (effects on the treated), the authors avoid this requirement. This is a massive advantage in real-world datasets where the treated group is very small, making counterfactual treatment models hard to learn. In datasets where treated units were rare, standard meta-learners degraded severely, but the proposed CATT learner maintained strong performance.

Superior Accuracy

Across synthetic and semi-synthetic experiments, the proposed Doubly Robust (DR) CATT learner consistently achieved the lowest MSE.

MSE comparison showing the proposed DR CATT learner outperforming standard CATE baselines.

For example, on the semi-synthetic minimum wage data, the XGBoost-powered DR CATT achieved an MSE of 1.8 ± 0.09, significantly beating the standard CATE DR-learner, which scored 2.66 ± 0.07. The paper proves that simply plugging DiD outcomes into standard CATE meta-learners fails when projecting onto a subset of covariates because conditional parallel trends do not guarantee parallel trends under treatment. The new loss function elegantly bypasses this trap.

Real-World Discovery

When applied to the actual minimum wage dataset, the model automatically discovered a hidden, non-linear pattern: county population size heavily modifies the treatment effect.

Estimated CATT on teen employment across different county population sizes.

Raising the minimum wage had a notable negative effect on teen employment in small counties, but this negative effect shrank to near-zero for large counties. The XGBoost and Kernel implementations captured this dynamic effectively.

Limitations and Future Work

Like all DiD methods, this approach relies heavily on the conditional parallel trends assumption (or the alternative lagged dependent outcome assumption). If there are unobserved, time-varying confounders, the estimates will still be biased—though empirical evidence suggests this method degrades more gracefully than baselines when the assumption is slightly violated.

Looking forward, the authors outline how their framework can be naturally extended to handle "staggered rollouts" (where different units receive treatment at different times) by treating the "distance from initial treatment" as an additional covariate for the ML model. They also suggest applying their generalized covariate shift framework to prediction-powered inference.

Summary updated

BibTeX
@inproceedings{lan2025meta,
  author = {Hui Lan and Haoge Chang and Eleanor Wiske Dillon and Vasilis Syrgkanis},
  title = {{A Meta-learner for Heterogeneous Effects in Difference-in-Differences}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=bxPRPLPyqT},
}
Figure