moderndid.mboot_twfep_did#

moderndid.mboot_twfep_did(linrep, n_units, n_bootstrap=1000, random_state=None)[source]#

Compute multiplier bootstrap for TWFE panel data DiD using Mammen weights.

Implements the standard multiplier bootstrap for Two-Way Fixed Effects difference-in-differences with panel data (2 periods and 2 groups) using Mammen’s (1993) binary weights.

Parameters:
linrepnumpy.ndarray

Influence function values, stacked as [pre-period, post-period].

n_unitsint

Number of cross-sectional units.

n_bootstrapint, default=1000

Number of bootstrap iterations.

random_stateint | numpy.random.Generator | None, default=None

Controls random number generation for reproducibility.

Returns:
numpy.ndarray

Bootstrap ATT estimates of shape (n_bootstrap,).

Notes

The weights are generated at the unit level and then duplicated across time periods to maintain the panel structure.

References

[1]

Mammen, E. (1993). “Bootstrap and wild bootstrap for high dimensional linear models”. The Annals of Statistics, 21(1), 255-285.