moderndid.drdid_imp_panel#
- moderndid.drdid_imp_panel(y1, y0, d, covariates, i_weights=None, boot=False, boot_type='weighted', nboot=999, influence_func=False, trim_level=0.995)[source]#
Compute the improved and locally efficient DR-DiD estimator for the ATT with panel data.
Implements the locally efficient and improved doubly robust DiD estimator for the ATT with panel data, as described in [2]. The estimator is given by
\[\widehat{\tau}_{imp}^{dr, p} = \mathbb{E}_{n}\left[\left(\widehat{w}_{1}^{p}(D) - \widehat{w}_{0}^{p}(D, X ; \widehat{\gamma}^{ipt})\right) \left(\Delta Y - \mu_{0, \Delta}^{lin, p}(X ; \widehat{\beta}_{0, \Delta}^{wls, p})\right)\right].\]The estimator uses a logistic propensity score model estimated via inverse probability tilting as described in [1], and a linear regression model for the outcome evolution of control units (estimated via weighted least squares).
- Parameters:
- y1
numpy.ndarray A 1D array of outcomes from the post-treatment period.
- y0
numpy.ndarray A 1D array of outcomes from the pre-treatment period.
- d
numpy.ndarray A 1D array of group indicators (=1 if treated, =0 otherwise).
- covariates
numpy.ndarray A 2D array of covariates for propensity score and outcome regression. An intercept must be included if desired.
- i_weights
numpy.ndarray, optional A 1D array of observation weights. If None, weights are uniform. Weights are normalized to have a mean of 1.
- bootbool, default=False
Whether to use bootstrap for inference.
- boot_type{“weighted”, “multiplier”}, default=”weighted”
Type of bootstrap to perform.
- nboot
int, default=999 Number of bootstrap repetitions.
- influence_funcbool, default=False
Whether to return the influence function.
- trim_level
float, default=0.995 The trimming level for the propensity score.
- y1
- Returns:
DRDIDPanelResultA NamedTuple containing the ATT estimate, standard error, confidence interval, bootstrap draws, propensity score flag, and influence function.
See also
drdid_panelLocally efficient doubly robust DiD estimator for the ATT with panel data.
Notes
The nuisance parameters are estimated as described in Section 3.1 of [2]. The propensity score parameters are estimated using the inverse probability tilting estimator from [1]
\[\widehat{\gamma}^{ipt} = \arg\max_{\gamma \in \Gamma} \mathbb{E}_{n} \left[D X^{\prime} \gamma - (1-D) \exp(X^{\prime} \gamma)\right]\]and the outcome regression coefficients are estimated using weighted least squares
\[\widehat{\beta}_{0, \Delta}^{wls, p} = \arg\min_{b \in \Theta} \mathbb{E}_{n} \left[\left.\frac{\Lambda(X^{\prime} \hat{\gamma}^{ipt})}{1-\Lambda(X^{\prime} \hat{\gamma}^{ipt})} (\Delta Y - X^{\prime} b)^{2} \right\rvert\, D=0\right].\]The resulting estimator is not only locally efficient and doubly robust for the ATT, but it is also doubly robust for inference.
References
[1] (1,2)Graham, B. S., Pinto, C. C., & Egel, D. (2012). Inverse probability tilting for moment condition models with missing data. The Review of Economic Studies, 79(3), 1053-1079. https://doi.org/10.1093/restud/rdr047
[2] (1,2)Sant’Anna, P. H., & Zhao, J. (2020). Doubly robust difference-in-differences estimators. Journal of Econometrics, 219(1), 101-122. https://doi.org/10.1016/j.jeconom.2020.06.003 arXiv preprint: https://arxiv.org/abs/1812.01723