moderndid.drdid_trad_rc#
- moderndid.drdid_trad_rc(y, post, d, covariates, i_weights=None, boot=False, boot_type='weighted', nboot=999, influence_func=False, trim_level=0.995)[source]#
Compute the traditional doubly robust DiD estimator for the ATT with repeated cross-section data.
Implements the doubly robust difference-in-differences (DiD) estimator for the ATT with repeated cross-sectional data, as defined in equation (3.3) in [1]. The estimator is given by
\[\widehat{\tau}_{1}^{dr,rc} = \mathbb{E}_{n}\left[\left(\widehat{w}_{1}^{rc}(D,T) - \widehat{w}_{0}^{rc}(D,T,X;\widehat{\gamma})\right) (Y - \mu_{0,Y}^{rc}(T,X;\widehat{\beta}_{0,0}^{rc}, \widehat{\beta}_{0,1}^{rc}))\right].\]This estimator uses a logistic propensity score model and linear regression models for the outcome among the comparison units in both pre and post-treatment time periods. Importantly, this estimator is not locally efficient.
The propensity score parameters are estimated using maximum likelihood, and the outcome regression coefficients are estimated using ordinary least squares.
- Parameters:
- y
numpy.ndarray A 1D array of outcomes from both pre- and post-treatment periods.
- post
numpy.ndarray A 1D array of post-treatment dummies (1 if post-treatment, 0 if pre-treatment).
- d
numpy.ndarray A 1D array of group indicators (1 if treated in post-treatment, 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.
- y
- Returns:
DRDIDTradRCResultA NamedTuple containing the ATT estimate, standard error, confidence interval, bootstrap draws, and influence function.
See also
drdid_imp_local_rcImproved and locally efficient DR-DiD estimator for repeated cross-section data.
drdid_imp_rcImproved, but not locally efficient, DR-DiD estimator for repeated cross-section data.
drdid_rcLocally efficient DR-DiD estimator for repeated cross-section data.
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