New DID Guide Just Dropped: Better Causal Inference in Panel Data (in R).
Brought to you by Professor Yiqing Xu and Ziyi Liu.
Professor Yiqing Xu and Ziyi Liu just put out a "New DID Methods" chapter from the fect (Fixed Effects Counterfactual Estimators) package user manual, which offers a comprehensive guide to implementing advanced DID estimators in R. It addresses the limitations of traditional TWFE models in causal panel analysis (which have well-documented issues when treatment effects are heterogeneous or dynamic) and complements their 2025 study, providing practical instructions and R code for researchers. Many researchers rely on TWFE DID models, but recent research has shown that these models can produce biased estimates when: a) treatment effects vary over time (e.g., some units respond faster or slower to the policy), b) different units receive treatment at different times (staggered adoption), and c) treatment effects are heterogeneous across individuals or groups. With more policy evaluations relying on DiD methods, ensuring accurate causal inference is more important than ever. This guide reflects the latest advances in the field, providing practical tools that researchers can implement straight away.
This chapter serves as a “hands-on” guide to implementing modern, HTE-robust DID methods in R, helping users produce more reliable causal inferences.
Some of the features of this chapter include:
Comprehensive Coverage of HTE-Robust Estimators: The chapter introduces various heterogeneous treatment effect (HTE) robust estimators developed as alternatives to TWFE models. These methods, proposed by researchers such as Cengiz et al. (2019), Sun and Abraham (2021), and Callaway and Sant’Anna (2021), are closely connected to the classic DID estimator.
Practical Implementation Guidance: Readers are guided through the implementation of these HTE-robust estimators in R, including instructions on creating event study plots to display estimated dynamic treatment effects. The chapter presents a recommended pipeline for analyzing panel data, covering data exploration, estimation, result visualization, and diagnostic tests.
Empirical Examples: The chapter illustrates these methods using two empirical examples: Hainmueller and Hangartner (2019), which examines the effects of indirect versus direct democracy on naturalization rates in Switzerland without treatment reversals, and Grumbach and Sahn (2020), which includes treatment reversals.
Sensitivity Analysis: It demonstrates how to implement the sensitivity analysis proposed by Rambachan and Roth (2023) using the imputation estimator and data from the first example, enhancing the robustness of causal inferences.
This guide is ideal for:
a) Economists, political scientists, and social scientists conducting policy evaluations
b) Researchers analyzing staggered treatment adoption in panel datasets
c) Anyone using DID estimators in R and looking for more robust methods
d) Those interested in event-study analysis for dynamic causal effects
If you're working with panel data and policy evaluations, using traditional TWFE methods could be leading you to incorrect conclusions. Their guide offers a state-of-the-art approach to estimating treatment effects with more accuracy and reliability.