moderndid.std_ipw_did_panel#

moderndid.std_ipw_did_panel(y1, y0, 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 panel data.

Implements the standardized inverse propensity weighted (IPW) estimator for the ATT with panel 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.1) in [2] as

\[\widehat{\tau}_{std}^{ipw,p} = \mathbb{E}_{n}\left[\left(\widehat{w}_{1}^{p}(D) - \widehat{w}_{0}^{p}(D,X;\widehat{\gamma})\right) \left(Y_{1}-Y_{0}\right)\right].\]
Parameters:
y1numpy.ndarray

A 1D array of outcomes from the post-treatment period.

y0numpy.ndarray

A 1D array of outcomes from the pre-treatment period.

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

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

See also

ipw_did_panel

Non-standardized version of Abadie’s IPW DiD estimator for panel data.

std_ipw_did_rc

Standardized IPW DiD estimator for repeated cross-section data.

Notes

The standardized IPW estimator normalizes weights within each group, 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