moderndid.aipw_did_panel#
- moderndid.aipw_did_panel(delta_y, d, ps, out_reg, i_weights, trim_ps=None)[source]#
Compute the augmented inverse propensity weighted (AIPW) estimator for panel data.
For panel data settings (where the same units are observed before and after treatment), this estimator combines inverse propensity weighting with outcome regression approaches to achieve double robustness. The estimator is given by equation (3.7) in [1] as
\[\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],\]where \(\widehat{w}_{1}^{p}(D)\) and \(\widehat{w}_{0}^{p}(D, X ; \widehat{\gamma}^{ipt})\) are normalized weights for the treated and control groups, respectively, \(\Delta Y\) is the change in outcomes, and \(\mu_{0, \Delta}^{lin, p}\) is the predicted outcome change for the control group from a weighted least squares regression.
- Parameters:
- delta_y
numpy.ndarray A 1D array representing the difference in outcomes between the post-treatment and pre-treatment periods (Y_post - Y_pre) for each unit.
- d
numpy.ndarray A 1D array representing the treatment indicator (1 for treated, 0 for control) for each unit. Assumed to be time-invariant for panel data context here.
- ps
numpy.ndarray A 1D array of propensity scores (estimated probability of being treated, \(P(D=1|X)\) for each unit.
- out_reg
numpy.ndarray A 1D array of predicted outcome differences from the outcome regression model (e.g., \(\mathbb{E}[Y_{\text{post}} - Y_{\text{pre}} | X, D=0]\)) for each unit.
- i_weights
numpy.ndarray A 1D array of individual observation weights for each unit.
- trim_ps
numpy.ndarray A 1D array used for trimming observations based on propensity scores.
- delta_y
- Returns:
floatThe AIPW ATT estimate.
See also
aipw_did_rc_imp1Simplified AIPW estimator for repeated cross-sections.
aipw_did_rc_imp2Locally efficient AIPW estimator for repeated cross-sections.
References
[1]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