moderndid.wboot_drdid_ipt_rc2#

moderndid.wboot_drdid_ipt_rc2(y, post, d, x, i_weights, n_bootstrap=1000, trim_level=0.995, random_state=None)[source]#

Compute IPT bootstrap estimates for locally efficient doubly-robust DiD with repeated cross-sections.

Implements the bootstrap inference for the locally efficient doubly-robust difference-in-differences estimator using inverse probability tilting (IPT) for propensity score estimation. This version uses outcome regression on both treatment and control groups.

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.

xnumpy.ndarray

A 2D array of covariates (including intercept if desired) with shape (n_units, n_features). The first column MUST be an intercept for IPT.

i_weightsnumpy.ndarray

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

n_bootstrapint

Number of bootstrap iterations. Default is 1000.

trim_levelfloat

Maximum propensity score value for control units to avoid extreme weights. Propensity scores for control units greater than or equal to this level will lead to the observation’s weight being set to zero. Default is 0.995.

random_stateint, RandomState instance or None

Controls the random number generation for reproducibility.

Returns:
numpy.ndarray

A 1D array of bootstrap ATT estimates with length n_bootstrap.