@@ -1119,6 +1119,46 @@ def test_bootstrap_weights_webb(self, ci_params):
11191119 assert br .overall_att_se > 0
11201120 assert np .isfinite (br .overall_att_p_value )
11211121
1122+ def test_bootstrap_weights_event_study (self , ci_params ):
1123+ """Bootstrap with non-default weights should work for event study aggregation."""
1124+ data = generate_test_data ()
1125+ n_boot = ci_params .bootstrap (50 )
1126+ est = ImputationDiD (
1127+ n_bootstrap = n_boot , bootstrap_weights = "mammen" , seed = 42
1128+ )
1129+ results = est .fit (
1130+ data , outcome = "outcome" , unit = "unit" , time = "time" ,
1131+ first_treat = "first_treat" , aggregate = "event_study" ,
1132+ )
1133+
1134+ br = results .bootstrap_results
1135+ assert br is not None
1136+ assert br .weight_type == "mammen"
1137+ assert br .event_study_ses is not None
1138+ assert len (br .event_study_ses ) > 0
1139+ for h , se in br .event_study_ses .items ():
1140+ assert se > 0 , f"Non-positive SE at horizon { h } "
1141+
1142+ def test_bootstrap_weights_group (self , ci_params ):
1143+ """Bootstrap with non-default weights should work for group aggregation."""
1144+ data = generate_test_data ()
1145+ n_boot = ci_params .bootstrap (50 )
1146+ est = ImputationDiD (
1147+ n_bootstrap = n_boot , bootstrap_weights = "mammen" , seed = 42
1148+ )
1149+ results = est .fit (
1150+ data , outcome = "outcome" , unit = "unit" , time = "time" ,
1151+ first_treat = "first_treat" , aggregate = "group" ,
1152+ )
1153+
1154+ br = results .bootstrap_results
1155+ assert br is not None
1156+ assert br .weight_type == "mammen"
1157+ assert br .group_ses is not None
1158+ assert len (br .group_ses ) > 0
1159+ for g , se in br .group_ses .items ():
1160+ assert se > 0 , f"Non-positive SE for group { g } "
1161+
11221162 def test_bootstrap_with_covariates (self , ci_params ):
11231163 """Bootstrap should work with covariates."""
11241164 data = generate_test_data ()
0 commit comments