moderndid.reg_did_rc#
- moderndid.reg_did_rc(y, post, d, covariates=None, i_weights=None, boot=False, boot_type='weighted', nboot=999, influence_func=False)[source]#
Compute the outcome regression DiD estimator for the ATT with repeated cross-section data.
Implements outcome regression difference-in-differences (DiD) estimator for the ATT when stationary repeated cross-sectional data are available. The estimator is a sample analogue of equation (2.2) in [2]. The estimator is given by
\[\widehat{\tau}^{reg} = \bar{Y}_{1,1} - \left[\bar{Y}_{1,0} + n_{treat}^{-1} \sum_{i|D_i=1} (\widehat{\mu}_{0,1}(X_i) - \widehat{\mu}_{0,0}(X_i))\right].\]The estimator follows the same spirit of the nonparametric estimators proposed by [1], though here the outcome regression models are assumed to be linear in covariates (parametric). The nuisance parameters (outcome regression coefficients) are estimated via 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, optional A 2D array of covariates to be used in the regression estimation. If None, this leads to an unconditional DiD estimator.
- i_weights
numpy.ndarray, optional A 1D array of weights. If None, then every observation has equal weight. Weights are normalized to have mean 1.
- bootbool, optional
Whether to use bootstrap for inference. Default is False.
- boot_type
str, optional Type of bootstrap (“weighted” or “multiplier”). Default is “weighted”.
- nboot
int, optional Number of bootstrap repetitions. Default is 999.
- influence_funcbool, optional
Whether to return the influence function. Default is False.
- y
- Returns:
RegDIDRCResultA named tuple containing:
- attfloat
The outcome regression DiD point estimate.
- sefloat
The outcome regression DiD standard error.
- ucifloat
Upper bound of a 95% confidence interval.
- lcifloat
Lower bound of a 95% confidence interval.
- bootsndarray or None
Bootstrap draws of the ATT if boot=True.
- att_inf_funcndarray or None
Influence function values if influence_func=True.
- argsdict
Arguments used in the estimation.
See also
ipw_did_rcInverse propensity weighted DiD for repeated cross-sections.
drdid_rcDoubly robust DiD for repeated cross-sections.
References
[1]Heckman, J., Ichimura, H., and Todd, P. (1997), “Matching as an Econometric Evaluation Estimator: Evidence from Evaluating a Job Training Programme”, Review of Economic Studies, vol. 64(4), p. 605–654. https://doi.org/10.2307/2971733
[2]Sant’Anna, P. H. C. and Zhao, J. (2020), “Doubly Robust Difference-in-Differences Estimators.” Journal of Econometrics, Vol. 219 (1), pp. 101-122. https://doi.org/10.1016/j.jeconom.2020.06.003