moderndid.wboot_reg_rc#
- moderndid.wboot_reg_rc(y, post, d, x, i_weights, n_bootstrap=1000, random_state=None)[source]#
Compute bootstrap estimates for regression-based robust DiD with repeated cross-sections.
Implements a regression-based difference-in-differences estimator that uses outcome regression on the control group only, without propensity scores. It is designed for settings with 2 time periods and 2 groups. The estimator fits separate regressions for pre and post periods using control units only, then computes the ATT using these predictions.
- Parameters:
- y
numpy.ndarray A 1D array representing the outcome variable for each unit.
- post
numpy.ndarray A 1D array representing the post-treatment period indicator (1 for post, 0 for pre) for each unit.
- d
numpy.ndarray A 1D array representing the treatment indicator (1 for treated, 0 for control) for each unit.
- x
numpy.ndarray A 2D array of covariates (including intercept if desired) with shape (n_units, n_features).
- i_weights
numpy.ndarray A 1D array of individual observation weights for each unit.
- n_bootstrap
int Number of bootstrap iterations. Default is 1000.
- random_state
int,RandomStateinstanceorNone Controls the random number generation for reproducibility.
- y
- Returns:
numpy.ndarrayA 1D array of bootstrap ATT estimates with length n_bootstrap.
See also
wboot_drdid_rc1Doubly-robust bootstrap for repeated cross-sections.
wboot_ipw_rcIPW bootstrap for repeated cross-sections.