moderndid.aipw_did_rc_imp2#

moderndid.aipw_did_rc_imp2(y, post, d, ps, out_y_treat_post, out_y_treat_pre, out_y_cont_post, out_y_cont_pre, i_weights, trim_ps=None)[source]#

Compute the locally efficient AIPW estimator with repeated cross-section data.

For repeated cross-section settings (where different units are observed in pre and post periods), this estimator achieves local efficiency by incorporating all four outcome regression predictions (for treated and control units in both time periods). The estimator is given by equation (3.10) in [1] 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) - \mu_{0,1}^{rc}(X))\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) - \mu_{0,0}^{rc}(X))\right],\end{split}\]

where \(\widehat{\tau}_{1,imp}^{dr,rc}\) is the simplified AIPW estimator, and the additional terms provide an adjustment that makes the estimator locally efficient.

Parameters:
ynumpy.ndarray

A 1D array representing the outcome variable for each unit.

postnumpy.ndarray

A 1D array representing the post-treatment period indicator (1 for post, 0 for pre) for each unit.

dnumpy.ndarray

A 1D array representing the treatment indicator (1 for treated, 0 for control) for each unit.

psnumpy.ndarray

A 1D array of propensity scores (estimated probability of being treated, \(P(D=1|X)\)) for each unit.

out_y_treat_postnumpy.ndarray

A 1D array of predicted outcomes for treated units in the post-treatment period (e.g., \(\mathbb{E}[Y | X, D=1, \text{Post}=1]\)).

out_y_treat_prenumpy.ndarray

A 1D array of predicted outcomes for treated units in the pre-treatment period (e.g., \(\mathbb{E}[Y | X, D=1, \text{Post}=0]\)).

out_y_cont_postnumpy.ndarray

A 1D array of predicted outcomes for control units in the post-treatment period (e.g., \(\mathbb{E}[Y | X, D=0, \text{Post}=1]\)).

out_y_cont_prenumpy.ndarray

A 1D array of predicted outcomes for control units in the pre-treatment period (e.g., \(\mathbb{E}[Y | X, D=0, \text{Post}=0]\)).

i_weightsnumpy.ndarray

A 1D array of individual observation weights for each unit.

trim_psnumpy.ndarray

A 1D array used for trimming observations based on propensity scores.

Returns:
float

The AIPW ATT estimate for repeated cross-sections.

See also

aipw_did_panel

AIPW estimator for panel data.

aipw_did_rc_imp1

Improved 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