moderndid.mboot#

moderndid.mboot(inf_func, n_units, biters=999, alp=0.05, cluster=None, random_state=None)[source]#

Compute multiplier bootstrap for DiD influence functions.

Implements the multiplier bootstrap for computing standard errors and critical values for uniform confidence bands. It handles both individual and clustered data using Mammen weights.

Parameters:
inf_funcnumpy.ndarray

Influence function matrix of shape (n, k) where n is the number of observations and k is the number of parameters.

n_unitsint

Number of cross-sectional units.

bitersint, default=999

Number of bootstrap iterations.

alpfloat, default=0.05

Significance level for confidence intervals.

clusternumpy.ndarray, optional

Cluster indicators for each unit. If provided, bootstrap is performed at the cluster level.

random_stateint, Generator, optional

Controls the randomness of the bootstrap. Pass an int for reproducible results across multiple function calls. Can also accept a NumPy Generator instance.

Returns:
dict

Dictionary containing:

  • ‘bres’: Bootstrap results matrix of shape (biters, k)

  • ‘V’: Variance-covariance matrix

  • ‘se’: Standard errors for each parameter

  • ‘crit_val’: Critical value for uniform confidence bands

Notes

The function uses Mammen (1993) weights for the multiplier bootstrap. When clustering is specified, the bootstrap is performed at the cluster level to preserve within-cluster dependence.

References

[1]

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