moderndid.ipw_did_rc#

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

Implements the inverse propensity weighted (IPW) estimator for the ATT with repeated cross-section data, as proposed by [1] and discussed in [2]. The estimator is given by the sample analogue of equation (2.3) in [2] as

\[\tau = \frac{1}{\mathbb{E}[D]} \mathbb{E}\left[\frac{D-p(X)}{1-p(X)} \frac{T-\lambda}{\lambda(1-\lambda)} Y\right].\]

IPW weights are not normalized to sum up to one, that is, the estimator is of the Horwitz-Thompson type.

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

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

See also

std_ipw_did_rc

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

Notes

The IPW estimator is less robust than doubly robust methods as it relies solely on correct specification of the propensity score model. We recommend using doubly robust methods when there is uncertainty about model specification.

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