moderndid.std_ipw_did_rc#

moderndid.std_ipw_did_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 standardized inverse propensity weighted DiD estimator for the ATT with repeated cross-section data.

Implements the standardized inverse propensity weighted (IPW) estimator for the ATT with repeated cross-section data, as proposed by [1] and discussed in [2]. This is the Hajek-type estimator, where weights are normalized to sum to one. The estimator is given by equation (4.2) in [2] as

\[\widehat{\tau}_{std}^{ipw,rc} = \mathbb{E}_{n}\left[\left(\widehat{w}_{1}^{rc}(D,T) - \widehat{w}_{0}^{rc}(D,T,X;\widehat{\gamma})\right) Y\right].\]
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 or None

A 2D array of covariates for propensity score estimation. An intercept must be included if desired. If None, leads to an unconditional DiD estimator.

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:
StdIPWDIDRCResult

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

See also

ipw_did_rc

Non-standardized version of Abadie’s IPW DiD estimator for repeated cross-section data.

Notes

The standardized IPW estimator normalizes weights within each group-period cell, making it a Hajek-type estimator. This can provide more stable estimates when there is substantial variation in weights across groups.

References

[1]

Abadie, A. (2005). Semiparametric difference-in-differences estimators. The Review of Economic Studies, 72(1), 1-19. https://doi.org/10.1111/0034-6527.00321

[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