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_func
numpy.ndarray Influence function matrix of shape (n, k) where n is the number of observations and k is the number of parameters.
- n_units
int Number of cross-sectional units.
- biters
int, default=999 Number of bootstrap iterations.
- alp
float, default=0.05 Significance level for confidence intervals.
- cluster
numpy.ndarray, optional Cluster indicators for each unit. If provided, bootstrap is performed at the cluster level.
- random_state
int,Generator, optional Controls the randomness of the bootstrap. Pass an int for reproducible results across multiple function calls. Can also accept a NumPy
Generatorinstance.
- inf_func
- Returns:
dictDictionary 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.