moderndid.drdid_imp_local_rc#

moderndid.drdid_imp_local_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 improved and locally efficient DR-DiD estimator for the ATT with repeated cross-section data.

Implements the locally efficient and improved doubly robust DiD estimator for the ATT with repeated cross-sectional data. The estimator is implemented as in equation (3.10) of [2] as

\[\begin{split}\widehat{\tau}_{2,imp}^{dr,rc} = \widehat{\tau}_{1,imp}^{dr,rc} + \mathbb{E}_{n}\left[\left(\frac{D}{\mathbb{E}_{n}[D]} - \widehat{w}_{1,1}^{rc}(D,T)\right) (\mu_{1,1}^{rc}(X; \widehat{\beta}_{1,1}^{ols,rc}) - \mu_{0,1}^{rc}(X; \widehat{\beta}_{0,1}^{wls,rc}))\right] \\ - \mathbb{E}_{n}\left[\left(\frac{D}{\mathbb{E}_{n}[D]} - \widehat{w}_{1,0}^{rc}(D,T)\right) (\mu_{1,0}^{rc}(X; \widehat{\beta}_{1,0}^{ols,rc}) - \mu_{0,0}^{rc}(X; \widehat{\beta}_{0,0}^{wls,rc}))\right],\end{split}\]

where \(\widehat{\tau}_{1, i m p}^{d r, r c}\) is the improved DR-DiD estimator that is not locally efficient and

\[\widehat{\tau}_{1,imp}^{dr,rc} = \mathbb{E}_{n}\left[\left(\widehat{w}_{1}^{rc}(D,T) - \widehat{w}_{0}^{rc}(D,T,X;\widehat{\gamma}^{ipt})\right) (Y - \mu_{0,Y}^{lin,rc}(T,X;\widehat{\beta}_{0,1}^{wls,rc}, \widehat{\beta}_{0,0}^{wls,rc}))\right].\]

This estimator uses a logistic propensity score model and separate linear regression models for the control and treated groups’ outcomes in both pre and post-treatment periods. The resulting estimator is doubly robust and locally efficient.

Parameters:
ynumpy.ndarray

A 1D array of outcomes from both pre- and post-treatment periods.

postnumpy.ndarray

A 1D array of post-treatment dummies (1 if post-treatment, 0 if pre-treatment).

dnumpy.ndarray

A 1D array of group indicators (1 if treated in post-treatment, 0 otherwise).

covariatesnumpy.ndarray

A 2D array of covariates for propensity score and outcome regression. An intercept must be included if desired.

i_weightsnumpy.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.

nbootint, default=999

Number of bootstrap repetitions.

influence_funcbool, default=False

Whether to return the influence function.

trim_levelfloat, default=0.995

The trimming level for the propensity score.

Returns:
DRDIDLocalRCResult

A NamedTuple containing the ATT estimate, standard error, confidence interval, bootstrap draws, and influence function.

See also

drdid_imp_rc

Improved, but not locally efficient, DR-DiD estimator for repeated cross-section data.

drdid_rc

Locally efficient DR-DiD estimator for repeated cross-section data.

drdid_trad_rc

Traditional (not locally efficient or improved) doubly robust DiD estimator.

Notes

The nuisance parameters are estimated as described in Section 3.2 of [2]. The propensity score is 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]\]

The outcome regression coefficients for the control group are estimated using weighted least squares,

\[\widehat{\beta}_{0,t}^{wls,rc} = \arg\min_{b \in \Theta} \mathbb{E}_{n} \left[\left.\frac{\Lambda(X^{\prime}\hat{\gamma}^{ipt})}{1-\Lambda(X^{\prime}\hat{\gamma}^{ipt})} (Y-X^{\prime}b)^{2} \right\rvert\, D=0, T=t\right]\]

and for the treated group using ordinary least squares.

\[\widehat{\beta}_{1,t}^{ols,rc} = \arg\min_{b \in \Theta} \mathbb{E}_{n} \left[\left(Y-X^{\prime}b\right)^{2} \mid D=1, T=t\right]\]

The resulting estimator is doubly robust and locally efficient.

References

[1]

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