Overview of the didhetero Methods
Shunsuke Imai (imai.shunsuke.57n@st.kyoto-u.ac.jp), Lei Qin (qinlei6d@unii.ac.jp), Takahide Yanagi (yanagi@econ.kyoto-u.ac.jp)
overview.Rmd
Introduction
This vignette provides an overview of estimation and uniform inference methods that can be implemented using the didhetero package.
For the sake of brevity, we omit many details of our methods here, which can be found in Imai, Qin, and Yanagi (2025).
Staggered DiD Setup
We consider essentially the same staggered difference-in-differences (DiD) setup as in Callaway and Sant’Anna (2021).
We have balanced panel data for which we observe the following variables for units and periods .
The outcome variable .
The binary treatment such that and that implies for any .
The “group” if for some , and otherwise.
The -dimensional vector of the pre-treatment covariates that includes a scalar continuous covariate as an element of particular interest.
Target Parameters
To examine the heterogeneity in treatment effects with respect to groups, periods, and continuous covariate values, we consider two types of target parameters:
The group-time conditional average treatment effect (CATT) given .
The summary parameters that aggregate CATTs with estimable weighting functions.
CATT is where and denote the potential outcomes given and , respectively, and is a value of . Estimating over is helpful in understanding the treatment effect heterogeneity with respect to group , calendar time , and covariate value .
The aggregated parameter is where denotes the set of realized treatment timings and is an estimable weighting function that determines the causal interpretation of this aggregated parameter.
Examples include:
The event-study-type conditional average treatment effect .
The group-specific conditional average treatment effect .
The calendar-time conditional average treatment effect .
The simple weighted conditional average treatment effect .
Doubly Robust Identification, Estimation, and Uniform Inference
We can show that is identified by a conditional doubly robust (DR) estimand , which is a conditional counterpart of the DR estimand in Callaway and Sant’Anna (2021). This identification result serves as a building block of estimation and uniform inference for CATT and the aggregated parameter.
To perform uniform inference for over a set of , we can construct a uniform confidence band for over the set of by a family of intervals, denoted as with where is a three-step estimator computed with certain parametric estimation procedures and nonparametric local polynomial regressions, is a pointwise standard error, and is a uniform critical value obtained from an analytical method or weighted bootstrapping.
To perform uniform inference for the aggregated parameter, we can construct a uniform confidence band for over the set of and the variable specific to the summary parameter of interest (e.g., treatment exposure time ) by a family of intervals, denoted as with where is an estimator obtained as an empirical analogue of , is a pointwise standard error, and is a uniform critical value via an analytical method or multiplier bootstrapping.
Importantly, to ensure the validity of uniform inference, the critical value must not depend on and is larger than the standard Wald-type pointwise critical value (i.e., the quantile of the standard normal distribution). Similarly, the uniform critical value should not depend on and the variable specific to the summary parameter of interest (e.g., treatment exposure time ) and is larger than the standard Wald-type pointwise critical value.
Recommendations
For constructing the uniformly valid critical value, the bootstrap would work better than the analytical method.
For the choice of the local polynomial order, the recommended default is
p = 2
.For the bandwidth, we recommend different choices depending on the local polynomial order. When
p = 2
, the recommended default is to use the IMSE-optimal bandwidth for local linear regression (bwselect = "IMSE1"
). Whenp = 1
, the recommended default is to use the rule-of-thumb undersmoothing for local linear regression (bwselect = "US1"
). This is because we need to make bias arising from kernel smoothing asymptotically negligible for justify our uniform confidence bands. In this view,bwselect = "IMSE2"
is not recommended.Although checking for the heterogeneity in pre-trends is useful for assessing the credibility of the identifying assumptions, doing so may widen the confidence intervals in post-treatment periods. In this view, we set
pretrend = FALSE
as the default.To examine the heterogeneity in all key variables and covariate values, the recommended default is
uniformall = TRUE
.
References
Callaway, B., & Sant’Anna, P. H. (2021). Difference-in-differences with multiple time periods. Journal of Econometrics, 225(2), 200-230. Link
Imai, S., Qin, L., & Yanagi, T. (2025). Doubly Robust Uniform Confidence Bands for Group-Time Conditional Average Treatment Effects in Difference-in-Differences. arXiv preprint arXiv:2305.02185. Link