diff --git a/METHODOLOGY_REVIEW.md b/METHODOLOGY_REVIEW.md index b34adb47f..5f822d586 100644 --- a/METHODOLOGY_REVIEW.md +++ b/METHODOLOGY_REVIEW.md @@ -312,9 +312,17 @@ and covariate-adjusted specifications.) - [x] Bootstrap SE (Rademacher/Mammen/Webb) - [x] Control group composition (never_treated/not_yet_treated) - [x] All documented edge cases from REGISTRY.md +- [x] Cluster jackknife `vcov_type="jackknife"` (2026-11-25; Karim, Nielsen, + MacKinnon & Webb 2026, eq. 20): full-sample centering, `(H - 1)/H` factor, + full re-estimation, `t(H - 1)` reference. Overall, event-study and group + standard errors match R `did` 2.5.1 on delete-one-cluster samples to 1e-8 + (`benchmarks/R/generate_cs_jackknife_golden.R`); every quantity equals a + by-hand delete-one loop. Element-wise extension beyond the overall ATT is a + documented library choice backed by `benchmarks/data/cs_jackknife_size.json` **Test Coverage:** - 61 methodology verification tests in `tests/test_methodology_callaway.py` +- Cluster jackknife: `tests/test_staggered_jackknife.py` - Existing unit-test coverage in `tests/test_staggered.py` - R benchmark tests (skip if R not available) diff --git a/TODO.md b/TODO.md index 227b57102..ff3537573 100644 --- a/TODO.md +++ b/TODO.md @@ -37,7 +37,10 @@ Related tracking surfaces: | diagnostic_report admission for `EventStudyResults` surfaces (the TWFE event-study mode + `aggregate('event_study')` containers): DiagnosticReport/BusinessReport now REJECT the surface explicitly (Phase 3(a); previously a silent zero-check report / all-null headline) and practitioner_next_steps serves the generic fall-through - admission needs source-aware routing (the type-name-keyed `_APPLICABILITY`/`_HANDLERS` registries cannot discriminate the unified container's producers) and a scalar-vs-per-period headline design; MPD-native results received {parallel_trends, pretrends_power, sensitivity, bacon, design_effect}. PR 4c-ii (2026-10-25) DELETED the MPD-native branches that logic lived in (DiagnosticReport's `interaction_indices`+`vcov` joint-Wald covariance source, the `post_period_effects` heterogeneity source, the `pre_period_effects` Bonferroni/NaN-filter collector branch, the `avg_att` alias row, practitioner's `_handle_multi_period`) - recover them from git history (`git show 5a10b847^:diff_diff/diagnostic_report.py`) when admission lands; event-study results reach `_handle_generic` meanwhile | `diff_diff/diagnostic_report.py`, `diff_diff/business_report.py`, `diff_diff/practitioner.py` | 3(a) | Mid | Medium | | DiagnosticReport public skip bookkeeping omits RUNNER-level skips: `applicable_checks` reflects only gate outcomes, so a check whose runner returns `status="skipped"` (heterogeneity's empty/non-finite branches, `_pt_event_study`'s empty-coefs branch - a pre-existing pattern, now also reachable via a failed post-fit event-study derivation on bootstrapped / kit-less ImputationDiD/TwoStageDiD/ContinuousDiD fits) stays listed as applicable while `skipped_checks`/`schema["skipped"]` omit it, so automation reading the public fields can misclassify the check as completed; reconcile runner-returned skipped sections into the public bookkeeping (all checks, one convention) or resolve those availabilities at the gate | `diff_diff/diagnostic_report.py` | derived-ES review | Mid | Low | | Align the two pretrends container routes' `pre_periods=` contracts (the native MPD branch died in PR 4c-ii, so only the relative and calendar routes remain): the relative route silently collapses DUPLICATE requested labels (the calendar route rejects them, 3(a) R8), and it filters on SE only while the calendar route additionally requires a finite EFFECT (3(a) R9); one contract across both routes, with pinned rejection messages | `diff_diff/pretrends.py` | 3(a) R8 | Quick | Low | -| `EventStudyResults` inference-provenance fields: the container records no `vcov_type`/`cluster_name`/`n_clusters`/`df_convention`/Conley metadata, so a serialized surface cannot distinguish unit auto-clustering from explicit clustering, survey, Conley, or the one-way carve-out (3(a) R9 review). Adding them is a cross-producer M-092 schema amendment (six builders, to_dict/summary rendering, surface-suite pins) - follow the pre-cut amendment convention (optional fields appended last, ledger note same-diff) rather than bolting onto one producer | `diff_diff/results_base.py` | 3(a) R9 | Mid | Low | +| `EventStudyResults` inference-provenance fields: the container records no `vcov_type`/`cluster_name`/`n_clusters`/`df_convention`/Conley metadata, so a serialized surface cannot distinguish unit auto-clustering from explicit clustering, survey, Conley, or the one-way carve-out (3(a) R9 review). Adding them is a cross-producer M-092 schema amendment (six builders, to_dict/summary rendering, surface-suite pins) - follow the pre-cut amendment convention (optional fields appended last, ledger note same-diff) rather than bolting onto one producer. A consumer of the gap: `compute_pretrends_power` called on the container of a cluster-jackknife `CallawaySantAnna` fit cannot tell that the covariance is a jackknife one, so only `DiagnosticReport` (which sees the results object) skips the power calculation there | `diff_diff/results_base.py` | 3(a) R9 | Mid | Low | +| Cluster jackknife (`vcov_type="jackknife"`) for the other staggered estimators (`SunAbraham`, `ImputationDiD`, `TwoStageDiD`, `StackedDiD`, `EfficientDiD`). Karim, Nielsen, MacKinnon & Webb (2026) cover CSDID only, so each needs its own size simulation on the pattern of `benchmarks/python/cs_jackknife_size.py`. `SunAbraham` / `ImputationDiD` / `TwoStageDiD` already have a weight-based refit closure (`survey.compute_replicate_refit_variance`); `StackedDiD` accepts only `cluster="unit"` or `"unit_subexp"` and would need a cluster column first | `diff_diff/staggered_jackknife.py` | CS cluster jackknife | Heavy | Medium | +| `CallawaySantAnna(vcov_type="jackknife", allow_unbalanced_panel=True)`: refused today because `allow_unbalanced_panel` picks the repeated-cross-section route from the balance of the data and deleting a cluster can balance the panel, so delete-one refits could run a different estimator than the full sample. Needs the route pinned in the refits (run the RC levels estimator on every delete-one sample) with an equality test against a by-hand loop | `diff_diff/staggered.py` | CS cluster jackknife | Mid | Low | +| `DiagnosticReport` joint pre-trend test over-rejects on clustered fits with few clusters: for a `CallawaySantAnna(cluster=...)` `hc1` fit it compares the event-study Wald statistic with a chi-square (a finite denominator df is used only for `survey_design=` fits), ignoring the `t(G-1)` reference the per-row inference uses. In `benchmarks/data/cs_jackknife_size.json` (no violation, nominal 5%) it rejected 13-22% with 6 or more treated clusters per cohort and 62-78% with 2. Use an F reference with the cluster df (as the `df_survey` branch does) or fall back to Bonferroni below a cluster count, and re-run the simulation; check the other estimators that reach this branch | `diff_diff/diagnostic_report.py` | CS cluster jackknife | Mid | Medium | | Opt-in singleton-group pruning for TwoWayFixedEffects (static + event-study mode; reghdfe parity): singleton units/periods are currently RETAINED class-wide - the within-demeaned row is zero so points are unchanged, but N/G/residual-df count it and CR1/finite-sample SEs shift (~0.41019 -> 0.40962 measured; REGISTRY "Deviation from R" Note, R5 review) - reghdfe iteratively drops singletons by default while fixest retains them (diff-diff matches fixest); an opt-in knob needs iterative unit+period pruning with consistent cluster/survey/replicate/Conley array subsetting and a default-flip decision protocol (moves published SEs) | `diff_diff/twfe.py`, `diff_diff/estimators.py`, `diff_diff/utils.py` | 3(a) R5 | Mid | Low | | Cohort-timing validation input for the simultaneous-adoption event-study family (TWFE `event_study=True`; MultiPeriodDiD through 3.9): an optional `first_treat=`/`cohort=` column so simultaneous adoption becomes checkable under the contract-valid time-invariant `D_i` indicator - today the staggered-adoption advisory derives timing from within-unit 0->1 transitions, so it can only fire on off-contract time-varying `D_it` input, and with valid `D_i` adoption timing is not observable in the inputs at all (REGISTRY "staggered-adoption detection limit" Notes, both sections); design questions: validate-only vs steering error (the M-011 removal shipped in PR 4c-ii, so only the TWFE surface is in play) | `diff_diff/twfe.py`, `diff_diff/estimators.py` | 3(a) R2 | Mid | Medium | | `balance_e` replay on bootstrapped ImputationDiD/TwoStageDiD fits: the unrestricted ES/group surface is relayed since 4.0 PR 3c (computed at fit, `balance_e=None`; M-021/M-022), but `aggregate('event_study', balance_e=k)` still raises there - a balanced-window replay needs retained per-target psi (ImputationDiD: the panel-backed kit retains everything the psi precompute reads, so a seeded replay is tractable) / retained per-level GMM scores (TwoStageDiD: function-locals today) | `diff_diff/imputation_results.py`, `diff_diff/two_stage_results.py`, `diff_diff/aggregation.py` | 2(b) PR-3b | Mid | Low | diff --git a/benchmarks/R/generate_cs_jackknife_golden.R b/benchmarks/R/generate_cs_jackknife_golden.R new file mode 100644 index 000000000..4a25fa45f --- /dev/null +++ b/benchmarks/R/generate_cs_jackknife_golden.R @@ -0,0 +1,140 @@ +#!/usr/bin/env Rscript +# Golden values for CallawaySantAnna(vcov_type="jackknife"): the cluster +# jackknife (CV3) of Karim, Nielsen, MacKinnon & Webb (2026, arXiv:2602.12043), +# equation (20), computed with R `did` on delete-one-cluster samples. +# +# Usage: Rscript benchmarks/R/generate_cs_jackknife_golden.R +# Output: benchmarks/data/cs_jackknife_golden.json +# +# The procedure is the one the paper's R package `didjack` implements +# (https://github.com/liu-yunhan/didjack, MIT): refit did::att_gt on each +# delete-one-cluster sample, re-aggregate with did::aggte, and take +# CV3 = ((H - 1) / H) * sum_h (theta^(h) - theta)^2 +# around the full-sample estimate, with a t(H - 1) reference. `didjack` +# reports the overall ATT only; the same formula is applied here element-wise +# to the dynamic and group aggregates, which is the library's documented +# extension. `didjack` itself is not on CRAN and is not required: only `did` +# point estimates enter, so no clustering option is passed to att_gt. +# +# The panel is embedded in the JSON so the Python test refits exactly it. +suppressMessages({ + library(did) + library(jsonlite) +}) + +set.seed(20261125) + +n_states <- 12L +units_per <- 3L +n_periods <- 6L +cohort_of_state <- c(3, 3, 3, 5, 5, 5, rep(0, 6)) + +rows <- list() +k <- 1L +for (s in seq_len(n_states)) { + shock <- cumsum(rnorm(n_periods, 0, 0.4)) + g <- cohort_of_state[s] + for (j in seq_len(units_per)) { + u <- (s - 1L) * units_per + j + ufe <- rnorm(1) + for (t in seq_len(n_periods)) { + eff <- if (g != 0 && t >= g) 0.8 + 0.2 * (t - g) else 0 + rows[[k]] <- data.frame( + unit = u, state = sprintf("s%02d", s), t = t, g = g, + y = ufe + 0.3 * t + shock[t] + eff + rnorm(1, 0, 0.5) + ) + k <- k + 1L + } + } +} +df <- do.call(rbind, rows) +clusters <- unique(df$state) +H <- length(clusters) + +estimates <- function(data, est_method, control_group, base_period) { + out <- suppressWarnings(att_gt( + yname = "y", tname = "t", idname = "unit", gname = "g", data = data, + control_group = control_group, est_method = est_method, + base_period = base_period, bstrap = FALSE, cband = FALSE + )) + simple <- aggte(out, type = "simple", na.rm = TRUE, bstrap = FALSE, cband = FALSE) + dyn <- aggte(out, type = "dynamic", na.rm = TRUE, bstrap = FALSE, cband = FALSE) + grp <- aggte(out, type = "group", na.rm = TRUE, bstrap = FALSE, cband = FALSE) + list( + overall = simple$overall.att, + dyn_e = dyn$egt, dyn_att = dyn$att.egt, + grp_g = grp$egt, grp_att = grp$att.egt + ) +} + +cv3_se <- function(full, reps) sqrt((H - 1) / H * sum((reps - full)^2)) + +configurations <- list( + reg_nevertreated_varying = list("reg", "nevertreated", "varying"), + dr_nevertreated_varying = list("dr", "nevertreated", "varying"), + reg_notyettreated_varying = list("reg", "notyettreated", "varying"), + dr_nevertreated_universal = list("dr", "nevertreated", "universal") +) +library_control_group <- c(nevertreated = "never_treated", notyettreated = "not_yet_treated") + +golden_cfg <- list() +for (name in names(configurations)) { + cfg <- configurations[[name]] + full <- estimates(df, cfg[[1]], cfg[[2]], cfg[[3]]) + reps <- lapply(clusters, function(cl) { + estimates(df[df$state != cl, ], cfg[[1]], cfg[[2]], cfg[[3]]) + }) + for (r in reps) { + stopifnot(identical(r$dyn_e, full$dyn_e), identical(r$grp_g, full$grp_g)) + } + overall_loo <- vapply(reps, function(r) r$overall, numeric(1)) + se <- cv3_se(full$overall, overall_loo) + t_stat <- full$overall / se + crit <- qt(0.975, H - 1) + dyn_loo <- do.call(rbind, lapply(reps, function(r) r$dyn_att)) + grp_loo <- do.call(rbind, lapply(reps, function(r) r$grp_att)) + dyn_se <- vapply(seq_along(full$dyn_e), function(j) cv3_se(full$dyn_att[j], dyn_loo[, j]), numeric(1)) + grp_se <- vapply(seq_along(full$grp_g), function(j) cv3_se(full$grp_att[j], grp_loo[, j]), numeric(1)) + # A universal base period makes one horizon a reference (estimate 0 in every + # sample, hence a zero jackknife variance); the library reports NaN there. + live <- dyn_se > 0 + golden_cfg[[name]] <- list( + est_method = cfg[[1]], + control_group = unname(library_control_group[cfg[[2]]]), + base_period = cfg[[3]], + df = H - 1, + overall_att = full$overall, + overall_att_loo = overall_loo, + overall_se = se, + overall_p = 2 * pt(-abs(t_stat), H - 1), + overall_lci = full$overall - crit * se, + overall_uci = full$overall + crit * se, + event_times = full$dyn_e[live], + event_study_att = full$dyn_att[live], + event_study_se = dyn_se[live], + group_labels = full$grp_g, + group_att = full$grp_att, + group_se = grp_se + ) +} + +golden <- list( + meta = list( + did_version = as.character(packageVersion("did")), + r_version = R.version.string, + n_clusters = H, + note = paste0( + "Cluster jackknife (CV3, Karim et al. 2026 eq. 20) from did::att_gt + ", + "aggte on delete-one-cluster samples; t(H-1) reference. Overall ATT as ", + "in the didjack package; dynamic and group standard errors by the same ", + "formula element-wise." + ) + ), + clusters = clusters, + data = as.list(df), + configurations = golden_cfg +) + +out_path <- file.path("benchmarks", "data", "cs_jackknife_golden.json") +write_json(golden, out_path, digits = NA, auto_unbox = TRUE, pretty = TRUE) +cat("Wrote", out_path, "\n") diff --git a/benchmarks/data/cs_jackknife_golden.json b/benchmarks/data/cs_jackknife_golden.json new file mode 100644 index 000000000..44839da17 --- /dev/null +++ b/benchmarks/data/cs_jackknife_golden.json @@ -0,0 +1,90 @@ +{ + "meta": { + "did_version": "2.5.1", + "r_version": "R version 4.5.2 (2025-10-31)", + "n_clusters": 12, + "note": "Cluster jackknife (CV3, Karim et al. 2026 eq. 20) from did::att_gt + aggte on delete-one-cluster samples; t(H-1) reference. Overall ATT as in the didjack package; dynamic and group standard errors by the same formula element-wise." + }, + "clusters": ["s01", "s02", "s03", "s04", "s05", "s06", "s07", "s08", "s09", "s10", "s11", "s12"], + "data": { + "unit": [1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 33, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, 36, 36, 36, 36, 36, 36], + "state": ["s01", "s01", "s01", "s01", "s01", "s01", "s01", "s01", "s01", "s01", "s01", "s01", "s01", "s01", "s01", "s01", "s01", "s01", "s02", "s02", "s02", "s02", "s02", "s02", "s02", "s02", "s02", "s02", "s02", "s02", "s02", "s02", "s02", "s02", "s02", "s02", "s03", "s03", "s03", "s03", "s03", "s03", "s03", "s03", "s03", "s03", "s03", "s03", "s03", "s03", "s03", "s03", "s03", "s03", "s04", "s04", "s04", "s04", "s04", "s04", "s04", "s04", "s04", "s04", "s04", "s04", "s04", "s04", "s04", "s04", "s04", "s04", "s05", "s05", "s05", "s05", "s05", "s05", "s05", "s05", "s05", "s05", "s05", "s05", "s05", "s05", "s05", "s05", "s05", "s05", "s06", "s06", "s06", "s06", "s06", "s06", "s06", "s06", "s06", "s06", "s06", "s06", "s06", "s06", "s06", "s06", "s06", "s06", "s07", "s07", "s07", "s07", "s07", "s07", "s07", "s07", "s07", "s07", "s07", "s07", "s07", "s07", "s07", "s07", "s07", "s07", "s08", "s08", "s08", "s08", "s08", "s08", "s08", "s08", "s08", "s08", "s08", "s08", "s08", "s08", "s08", "s08", "s08", "s08", "s09", "s09", "s09", "s09", "s09", "s09", "s09", "s09", "s09", "s09", "s09", "s09", "s09", "s09", "s09", "s09", "s09", "s09", "s10", "s10", "s10", "s10", "s10", "s10", "s10", "s10", "s10", "s10", "s10", "s10", "s10", "s10", "s10", "s10", "s10", "s10", "s11", "s11", "s11", "s11", "s11", "s11", "s11", "s11", "s11", "s11", "s11", "s11", "s11", "s11", "s11", "s11", "s11", "s11", "s12", "s12", "s12", "s12", "s12", "s12", "s12", "s12", "s12", "s12", "s12", "s12", "s12", "s12", "s12", "s12", "s12", "s12"], + "t": [1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6], + "g": [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + "y": [1.75132784714209, 1.73574382348216, 3.03363072860733, 4.33458863863192, 5.09438204258281, 5.87837468752063, 1.07649761300785, 2.23730110383368, 4.59057839230812, 4.73214733322479, 5.12675792579319, 6.39833518347931, 2.45372212115089, 2.19115555445783, 3.04854411612161, 4.10013383562858, 5.16738311075584, 5.64014814003614, 1.13941104003511, -0.108577587444738, 1.19391726289975, 1.83383166296141, 2.76521964199376, 3.4336991201672, 0.697324428901843, -0.301765028700798, 2.48178758529993, 2.10060458633983, 3.54841321238888, 3.94103066414675, 1.48702132552057, -0.163699378059855, 1.1600674357694, 0.910388959074799, 2.80159390333421, 2.6314307186215, 1.53677946688848, 0.920170006114761, 3.09269466412839, 4.35510227419887, 4.45844554437584, 5.4062203380692, 1.62338503133221, 3.39584537317588, 4.02619345655162, 4.61542916049331, 5.22933492588686, 5.37449695161228, 1.26117475191984, 1.19992955465375, 3.09994636762523, 4.22078983225721, 4.83095673858582, 5.57434030913715, 0.744571941408311, 0.153836708305984, -0.0261324382648797, 0.561621053368058, 2.56715162112601, 2.19472395527326, -1.60395270889118, -0.975905302069707, -0.949262810325875, -1.25258999068024, 0.861790752990342, 0.96575687125162, 1.47112311971801, 0.74661550284819, 1.27587412656045, 0.331550414582027, 2.79319410784303, 3.73834997342827, 1.13357505272749, 1.88201101129896, 1.24744846464396, 1.81355330598566, 2.55327344036991, 2.04999769805629, -0.0685020026479912, -1.03007329040102, -0.248871010832833, -0.159570982629808, 0.857748109405051, 0.507099837466812, -1.12042216533311, -0.00424363741455674, 0.357442545472102, 0.626504749005323, 0.140894138317322, 1.31343480626849, 2.2998761617132, 0.631250544457804, 1.70887800917889, 1.56196328747454, 1.59718353747049, 2.95179531457179, 2.51291657628242, 1.70202876654076, 1.16854929421297, 1.13818803805296, 2.47881484083258, 3.15684516302406, 1.77195010292992, 2.45413957880033, 2.02269545098054, 2.65587444044511, 3.8439575044552, 4.36886844921389, 0.528721169981149, 1.45165128834779, 2.85749859716764, 3.05915550782216, 2.60419572835453, 2.55144151018597, 1.9789800904562, 2.70114377917138, 3.72123562201019, 4.13979174394321, 3.16160403191546, 3.32763537128801, 2.11947736793141, 3.12614273418178, 3.30416560131808, 4.53856162363193, 4.10779656182225, 3.31474797480027, -1.31811808701848, -0.538496539583795, -0.0433872614386177, -0.962218296732961, 0.210575005416683, 0.745093208977155, 1.2220939618889, 0.539854686317653, 0.807889966604559, 0.931484239636656, 2.60445743187386, 0.933799825194827, -0.332704294233786, 1.63629573626208, 0.674944403289226, 0.665347408463486, 1.69088446622156, 1.59803636283294, 1.64248446766108, 2.0230155928542, 1.57422166972405, 1.80557239687627, 2.06681965819468, 2.35806068319902, 1.89575241254641, 2.35952943981582, 1.79937992314112, 2.64669979609844, 3.18148931462777, 3.89871811780638, -0.185605334768905, 0.309387162245833, 0.0853131962682979, -0.288509465570275, 1.17068301769628, 2.24720265298491, 1.94739990611014, 2.5244011477004, 2.0995652335594, 4.00991817201495, 2.94739546956908, 3.29484142385545, -1.3903276388299, -0.733168735685146, -0.905832434821433, -0.0154811127569589, 0.165747037778783, 1.0524691136186, 1.4537095667228, 1.29077508641091, 2.16536074247612, 2.3334030116001, 2.26939099323273, 3.30867987955818, 0.972554396856939, 0.275402778185002, 1.11028811839734, 1.25517039343019, 2.06563049361527, 2.43003260287741, 0.24478152279843, 0.381729396474578, 0.254529749194744, 2.50349687791924, 2.63219748851535, 3.80439939612937, 1.39395660981281, 1.12225514354191, 0.909429550164691, 2.787431804105, 2.58310113634808, 3.67642856941392, -1.32892450782779, -1.80377185261684, -0.271600988104402, -1.44687406870152, 0.531923226970734, 1.56389765672972, 0.744294427553179, 0.693947119910502, -0.0997349741487852, 0.622393018874702, 3.01147544296011, 3.70366216450144, 1.35530176847792, 2.28463002712697, 1.96853708583054, 2.22376162729039, 3.93186912014873, 4.97427868054494] + }, + "configurations": { + "reg_nevertreated_varying": { + "est_method": "reg", + "control_group": "never_treated", + "base_period": "varying", + "df": 11, + "overall_att": 1.37334546027655, + "overall_att_loo": [1.24602138579255, 1.27911780193009, 1.25240308532711, 1.35426234246262, 1.58297756000869, 1.48247882266575, 1.28245984503693, 1.31196460871593, 1.3181141569931, 1.32263528077969, 1.45834536001767, 1.54655351011598], + "overall_se": 0.371813507714463, + "overall_p": 0.00354062029127559, + "overall_lci": 0.554989447475399, + "overall_uci": 2.1917014730777, + "event_times": [-3, -2, -1, 0, 1, 2, 3], + "event_study_att": [-0.547991587534621, -0.02073090619192, -0.497175891740851, 1.04392027479782, 1.08318555624057, 1.91890308965379, 2.06695800992875], + "event_study_se": [0.35332557915708, 0.185140194308405, 0.294227057928893, 0.377577043846233, 0.434658840471837, 0.279461330969768, 0.46629982974632], + "group_labels": [3, 5], + "group_att": [1.7729219193531, 0.574192542123442], + "group_se": [0.228814421959461, 0.776327311896495] + }, + "dr_nevertreated_varying": { + "est_method": "dr", + "control_group": "never_treated", + "base_period": "varying", + "df": 11, + "overall_att": 1.37334546027655, + "overall_att_loo": [1.24602138579255, 1.27911780193009, 1.25240308532711, 1.35426234246262, 1.58297756000869, 1.48247882266575, 1.28245984503693, 1.31196460871593, 1.3181141569931, 1.32263528077969, 1.45834536001767, 1.54655351011598], + "overall_se": 0.371813507714464, + "overall_p": 0.0035406202912756, + "overall_lci": 0.554989447475398, + "overall_uci": 2.1917014730777, + "event_times": [-3, -2, -1, 0, 1, 2, 3], + "event_study_att": [-0.547991587534621, -0.02073090619192, -0.497175891740851, 1.04392027479782, 1.08318555624057, 1.91890308965379, 2.06695800992875], + "event_study_se": [0.35332557915708, 0.185140194308405, 0.294227057928893, 0.377577043846233, 0.434658840471837, 0.279461330969768, 0.46629982974632], + "group_labels": [3, 5], + "group_att": [1.77292191935311, 0.574192542123442], + "group_se": [0.228814421959461, 0.776327311896495] + }, + "reg_notyettreated_varying": { + "est_method": "reg", + "control_group": "not_yet_treated", + "base_period": "varying", + "df": 11, + "overall_att": 1.39835369525268, + "overall_att_loo": [1.26745701577209, 1.30055343190963, 1.27383871530664, 1.36901278923601, 1.61217450965401, 1.50183352103036, 1.29056373573389, 1.35450091774065, 1.36298354754751, 1.34548756513196, 1.47395325586332, 1.58138932573083], + "overall_se": 0.378512081681221, + "overall_p": 0.00353628530888494, + "overall_lci": 0.565254220556915, + "overall_uci": 2.23145316994844, + "event_times": [-3, -2, -1, 0, 1, 2, 3], + "event_study_att": [-0.352769798769529, -0.02073090619192, -0.405843960485081, 1.0473754258298, 1.15475511013696, 1.91890308965379, 2.06695800992875], + "event_study_se": [0.375670550905074, 0.185140194308405, 0.294923637586002, 0.381403631216556, 0.458227971156661, 0.279461330969768, 0.46629982974632], + "group_labels": [3, 5], + "group_att": [1.81043427181729, 0.574192542123442], + "group_se": [0.203010729221472, 0.776327311896495] + }, + "dr_nevertreated_universal": { + "est_method": "dr", + "control_group": "never_treated", + "base_period": "universal", + "df": 11, + "overall_att": 1.37334546027655, + "overall_att_loo": [1.24602138579255, 1.27911780193009, 1.25240308532711, 1.35426234246262, 1.58297756000869, 1.48247882266575, 1.28245984503693, 1.31196460871593, 1.3181141569931, 1.32263528077969, 1.45834536001767, 1.54655351011598], + "overall_se": 0.371813507714464, + "overall_p": 0.0035406202912756, + "overall_lci": 0.554989447475398, + "overall_uci": 2.1917014730777, + "event_times": [-4, -3, -2, 0, 1, 2, 3], + "event_study_att": [0.977408910912966, 0.429417323378345, 0.497175891740851, 1.04392027479782, 1.08318555624057, 1.91890308965379, 2.06695800992875], + "event_study_se": [0.581709996578149, 0.418101817697936, 0.294227057928893, 0.377577043846233, 0.434658840471837, 0.279461330969768, 0.46629982974632], + "group_labels": [3, 5], + "group_att": [1.77292191935311, 0.574192542123442], + "group_se": [0.228814421959461, 0.776327311896495] + } + } +} diff --git a/benchmarks/data/cs_jackknife_size.json b/benchmarks/data/cs_jackknife_size.json new file mode 100644 index 000000000..e2a4c466e --- /dev/null +++ b/benchmarks/data/cs_jackknife_size.json @@ -0,0 +1,47 @@ +{ + "meta": {"alpha": 0.05, "ar1_coefficient": 0.8, "backend": "auto", "cohorts": [4, 6], "diff_diff_version": "4.0.0", "flag_margin": 0.03, "n_bootstrap": 499, "n_periods": 8, "n_replications": 1000, "seed": 20261125, "wall_seconds": 831.0, "workers": 12}, + "design_points": [ + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [{"overall": 0.077, "quantity": "es_-2", "rejection_rate": 0.121}], "index": 0, "n_clusters": 8, "n_replications": 1000, "n_treated_per_cohort": 1, "results": {"bootstrap": {"es_-2": {"coverage": 0.69, "n_defined": 1000, "n_fit": 1000, "n_reject": 308, "rejection_mc_se": 0.014599, "rejection_rate": 0.308, "share_undefined": 0.0}, "es_0": {"coverage": 0.739, "n_defined": 1000, "n_fit": 1000, "n_reject": 261, "rejection_mc_se": 0.013888, "rejection_rate": 0.261, "share_undefined": 0.0}, "es_1": {"coverage": 0.734, "n_defined": 1000, "n_fit": 1000, "n_reject": 263, "rejection_mc_se": 0.013922, "rejection_rate": 0.263, "share_undefined": 0.0}, "es_2": {"coverage": 0.75, "n_defined": 1000, "n_fit": 1000, "n_reject": 244, "rejection_mc_se": 0.013582, "rejection_rate": 0.244, "share_undefined": 0.0}, "es_3": {"coverage": 0.43, "n_defined": 1000, "n_fit": 1000, "n_reject": 567, "rejection_mc_se": 0.015669, "rejection_rate": 0.567, "share_undefined": 0.0}, "es_4": {"coverage": 0.445, "n_defined": 1000, "n_fit": 1000, "n_reject": 553, "rejection_mc_se": 0.015722, "rejection_rate": 0.553, "share_undefined": 0.0}, "overall": {"coverage": 0.734, "n_defined": 1000, "n_fit": 1000, "n_reject": 262, "rejection_mc_se": 0.013905, "rejection_rate": 0.262, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 869, "rejection_mc_se": 0.01067, "rejection_rate": 0.869, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 936, "rejection_mc_se": 0.00774, "rejection_rate": 0.936, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.81, "n_defined": 1000, "n_fit": 1000, "n_reject": 190, "rejection_mc_se": 0.012406, "rejection_rate": 0.19, "share_undefined": 0.0}, "es_0": {"coverage": 0.85, "n_defined": 1000, "n_fit": 1000, "n_reject": 150, "rejection_mc_se": 0.011292, "rejection_rate": 0.15, "share_undefined": 0.0}, "es_1": {"coverage": 0.829, "n_defined": 1000, "n_fit": 1000, "n_reject": 171, "rejection_mc_se": 0.011906, "rejection_rate": 0.171, "share_undefined": 0.0}, "es_2": {"coverage": 0.855, "n_defined": 1000, "n_fit": 1000, "n_reject": 145, "rejection_mc_se": 0.011134, "rejection_rate": 0.145, "share_undefined": 0.0}, "es_3": {"coverage": 0.554, "n_defined": 1000, "n_fit": 1000, "n_reject": 446, "rejection_mc_se": 0.015719, "rejection_rate": 0.446, "share_undefined": 0.0}, "es_4": {"coverage": 0.562, "n_defined": 1000, "n_fit": 1000, "n_reject": 438, "rejection_mc_se": 0.015689, "rejection_rate": 0.438, "share_undefined": 0.0}, "overall": {"coverage": 0.852, "n_defined": 1000, "n_fit": 1000, "n_reject": 148, "rejection_mc_se": 0.011229, "rejection_rate": 0.148, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 600, "rejection_mc_se": 0.015492, "rejection_rate": 0.6, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 927, "rejection_mc_se": 0.008226, "rejection_rate": 0.927, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.879, "n_defined": 1000, "n_fit": 1000, "n_reject": 121, "rejection_mc_se": 0.010313, "rejection_rate": 0.121, "share_undefined": 0.0}, "es_0": {"coverage": 0.916, "n_defined": 1000, "n_fit": 1000, "n_reject": 84, "rejection_mc_se": 0.008772, "rejection_rate": 0.084, "share_undefined": 0.0}, "es_1": {"coverage": 0.899, "n_defined": 1000, "n_fit": 1000, "n_reject": 101, "rejection_mc_se": 0.009529, "rejection_rate": 0.101, "share_undefined": 0.0}, "es_2": {"coverage": 0.917, "n_defined": 1000, "n_fit": 1000, "n_reject": 83, "rejection_mc_se": 0.008724, "rejection_rate": 0.083, "share_undefined": 0.0}, "es_3": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}, "es_4": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}, "overall": {"coverage": 0.923, "n_defined": 1000, "n_fit": 1000, "n_reject": 77, "rejection_mc_se": 0.00843, "rejection_rate": 0.077, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}}}, "seconds": 80.5, "units_per_cluster": 1}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [{"overall": 0.045, "quantity": "es_4", "rejection_rate": 0.086}], "index": 1, "n_clusters": 8, "n_replications": 1000, "n_treated_per_cohort": 2, "results": {"bootstrap": {"es_-2": {"coverage": 0.875, "n_defined": 1000, "n_fit": 1000, "n_reject": 124, "rejection_mc_se": 0.010422, "rejection_rate": 0.124, "share_undefined": 0.0}, "es_0": {"coverage": 0.849, "n_defined": 1000, "n_fit": 1000, "n_reject": 145, "rejection_mc_se": 0.011134, "rejection_rate": 0.145, "share_undefined": 0.0}, "es_1": {"coverage": 0.855, "n_defined": 1000, "n_fit": 1000, "n_reject": 144, "rejection_mc_se": 0.011102, "rejection_rate": 0.144, "share_undefined": 0.0}, "es_2": {"coverage": 0.87, "n_defined": 1000, "n_fit": 1000, "n_reject": 128, "rejection_mc_se": 0.010565, "rejection_rate": 0.128, "share_undefined": 0.0}, "es_3": {"coverage": 0.733, "n_defined": 1000, "n_fit": 1000, "n_reject": 266, "rejection_mc_se": 0.013973, "rejection_rate": 0.266, "share_undefined": 0.0}, "es_4": {"coverage": 0.727, "n_defined": 1000, "n_fit": 1000, "n_reject": 270, "rejection_mc_se": 0.014039, "rejection_rate": 0.27, "share_undefined": 0.0}, "overall": {"coverage": 0.845, "n_defined": 1000, "n_fit": 1000, "n_reject": 152, "rejection_mc_se": 0.011353, "rejection_rate": 0.152, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 449, "rejection_mc_se": 0.015729, "rejection_rate": 0.449, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 659, "rejection_mc_se": 0.014991, "rejection_rate": 0.659, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.944, "n_defined": 1000, "n_fit": 1000, "n_reject": 56, "rejection_mc_se": 0.007271, "rejection_rate": 0.056, "share_undefined": 0.0}, "es_0": {"coverage": 0.927, "n_defined": 1000, "n_fit": 1000, "n_reject": 73, "rejection_mc_se": 0.008226, "rejection_rate": 0.073, "share_undefined": 0.0}, "es_1": {"coverage": 0.932, "n_defined": 1000, "n_fit": 1000, "n_reject": 68, "rejection_mc_se": 0.007961, "rejection_rate": 0.068, "share_undefined": 0.0}, "es_2": {"coverage": 0.943, "n_defined": 1000, "n_fit": 1000, "n_reject": 57, "rejection_mc_se": 0.007332, "rejection_rate": 0.057, "share_undefined": 0.0}, "es_3": {"coverage": 0.844, "n_defined": 1000, "n_fit": 1000, "n_reject": 156, "rejection_mc_se": 0.011474, "rejection_rate": 0.156, "share_undefined": 0.0}, "es_4": {"coverage": 0.84, "n_defined": 1000, "n_fit": 1000, "n_reject": 160, "rejection_mc_se": 0.011593, "rejection_rate": 0.16, "share_undefined": 0.0}, "overall": {"coverage": 0.929, "n_defined": 1000, "n_fit": 1000, "n_reject": 71, "rejection_mc_se": 0.008122, "rejection_rate": 0.071, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 148, "rejection_mc_se": 0.011229, "rejection_rate": 0.148, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 618, "rejection_mc_se": 0.015365, "rejection_rate": 0.618, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.963, "n_defined": 1000, "n_fit": 1000, "n_reject": 37, "rejection_mc_se": 0.005969, "rejection_rate": 0.037, "share_undefined": 0.0}, "es_0": {"coverage": 0.952, "n_defined": 1000, "n_fit": 1000, "n_reject": 48, "rejection_mc_se": 0.00676, "rejection_rate": 0.048, "share_undefined": 0.0}, "es_1": {"coverage": 0.957, "n_defined": 1000, "n_fit": 1000, "n_reject": 43, "rejection_mc_se": 0.006415, "rejection_rate": 0.043, "share_undefined": 0.0}, "es_2": {"coverage": 0.964, "n_defined": 1000, "n_fit": 1000, "n_reject": 36, "rejection_mc_se": 0.005891, "rejection_rate": 0.036, "share_undefined": 0.0}, "es_3": {"coverage": 0.932, "n_defined": 1000, "n_fit": 1000, "n_reject": 68, "rejection_mc_se": 0.007961, "rejection_rate": 0.068, "share_undefined": 0.0}, "es_4": {"coverage": 0.914, "n_defined": 1000, "n_fit": 1000, "n_reject": 86, "rejection_mc_se": 0.008866, "rejection_rate": 0.086, "share_undefined": 0.0}, "overall": {"coverage": 0.955, "n_defined": 1000, "n_fit": 1000, "n_reject": 45, "rejection_mc_se": 0.006556, "rejection_rate": 0.045, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 75, "rejection_mc_se": 0.008329, "rejection_rate": 0.075, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 489, "rejection_mc_se": 0.015808, "rejection_rate": 0.489, "share_undefined": 0.0}}}, "seconds": 82.7, "units_per_cluster": 1}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [], "index": 2, "n_clusters": 8, "n_replications": 1000, "n_treated_per_cohort": 3, "results": {"bootstrap": {"es_-2": {"coverage": 0.84, "n_defined": 1000, "n_fit": 1000, "n_reject": 158, "rejection_mc_se": 0.011534, "rejection_rate": 0.158, "share_undefined": 0.0}, "es_0": {"coverage": 0.819, "n_defined": 1000, "n_fit": 1000, "n_reject": 180, "rejection_mc_se": 0.012149, "rejection_rate": 0.18, "share_undefined": 0.0}, "es_1": {"coverage": 0.837, "n_defined": 1000, "n_fit": 1000, "n_reject": 162, "rejection_mc_se": 0.011651, "rejection_rate": 0.162, "share_undefined": 0.0}, "es_2": {"coverage": 0.833, "n_defined": 1000, "n_fit": 1000, "n_reject": 166, "rejection_mc_se": 0.011766, "rejection_rate": 0.166, "share_undefined": 0.0}, "es_3": {"coverage": 0.736, "n_defined": 1000, "n_fit": 1000, "n_reject": 263, "rejection_mc_se": 0.013922, "rejection_rate": 0.263, "share_undefined": 0.0}, "es_4": {"coverage": 0.747, "n_defined": 1000, "n_fit": 1000, "n_reject": 250, "rejection_mc_se": 0.013693, "rejection_rate": 0.25, "share_undefined": 0.0}, "overall": {"coverage": 0.785, "n_defined": 1000, "n_fit": 1000, "n_reject": 212, "rejection_mc_se": 0.012925, "rejection_rate": 0.212, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 525, "rejection_mc_se": 0.015792, "rejection_rate": 0.525, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 720, "rejection_mc_se": 0.014199, "rejection_rate": 0.72, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.924, "n_defined": 1000, "n_fit": 1000, "n_reject": 76, "rejection_mc_se": 0.00838, "rejection_rate": 0.076, "share_undefined": 0.0}, "es_0": {"coverage": 0.92, "n_defined": 1000, "n_fit": 1000, "n_reject": 80, "rejection_mc_se": 0.008579, "rejection_rate": 0.08, "share_undefined": 0.0}, "es_1": {"coverage": 0.915, "n_defined": 1000, "n_fit": 1000, "n_reject": 85, "rejection_mc_se": 0.008819, "rejection_rate": 0.085, "share_undefined": 0.0}, "es_2": {"coverage": 0.916, "n_defined": 1000, "n_fit": 1000, "n_reject": 84, "rejection_mc_se": 0.008772, "rejection_rate": 0.084, "share_undefined": 0.0}, "es_3": {"coverage": 0.846, "n_defined": 1000, "n_fit": 1000, "n_reject": 154, "rejection_mc_se": 0.011414, "rejection_rate": 0.154, "share_undefined": 0.0}, "es_4": {"coverage": 0.848, "n_defined": 1000, "n_fit": 1000, "n_reject": 152, "rejection_mc_se": 0.011353, "rejection_rate": 0.152, "share_undefined": 0.0}, "overall": {"coverage": 0.887, "n_defined": 1000, "n_fit": 1000, "n_reject": 113, "rejection_mc_se": 0.010012, "rejection_rate": 0.113, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 181, "rejection_mc_se": 0.012175, "rejection_rate": 0.181, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 685, "rejection_mc_se": 0.014689, "rejection_rate": 0.685, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.959, "n_defined": 1000, "n_fit": 1000, "n_reject": 41, "rejection_mc_se": 0.00627, "rejection_rate": 0.041, "share_undefined": 0.0}, "es_0": {"coverage": 0.947, "n_defined": 1000, "n_fit": 1000, "n_reject": 53, "rejection_mc_se": 0.007085, "rejection_rate": 0.053, "share_undefined": 0.0}, "es_1": {"coverage": 0.95, "n_defined": 1000, "n_fit": 1000, "n_reject": 50, "rejection_mc_se": 0.006892, "rejection_rate": 0.05, "share_undefined": 0.0}, "es_2": {"coverage": 0.95, "n_defined": 1000, "n_fit": 1000, "n_reject": 50, "rejection_mc_se": 0.006892, "rejection_rate": 0.05, "share_undefined": 0.0}, "es_3": {"coverage": 0.921, "n_defined": 1000, "n_fit": 1000, "n_reject": 79, "rejection_mc_se": 0.00853, "rejection_rate": 0.079, "share_undefined": 0.0}, "es_4": {"coverage": 0.933, "n_defined": 1000, "n_fit": 1000, "n_reject": 67, "rejection_mc_se": 0.007906, "rejection_rate": 0.067, "share_undefined": 0.0}, "overall": {"coverage": 0.942, "n_defined": 1000, "n_fit": 1000, "n_reject": 58, "rejection_mc_se": 0.007392, "rejection_rate": 0.058, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 76, "rejection_mc_se": 0.00838, "rejection_rate": 0.076, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 569, "rejection_mc_se": 0.01566, "rejection_rate": 0.569, "share_undefined": 0.0}}}, "seconds": 83.9, "units_per_cluster": 1}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [{"overall": 0.13, "quantity": "es_-2", "rejection_rate": 0.164}, {"overall": 0.13, "quantity": "es_1", "rejection_rate": 0.162}], "index": 3, "n_clusters": 16, "n_replications": 1000, "n_treated_per_cohort": 1, "results": {"bootstrap": {"es_-2": {"coverage": 0.654, "n_defined": 1000, "n_fit": 1000, "n_reject": 345, "rejection_mc_se": 0.015032, "rejection_rate": 0.345, "share_undefined": 0.0}, "es_0": {"coverage": 0.646, "n_defined": 1000, "n_fit": 1000, "n_reject": 351, "rejection_mc_se": 0.015093, "rejection_rate": 0.351, "share_undefined": 0.0}, "es_1": {"coverage": 0.647, "n_defined": 1000, "n_fit": 1000, "n_reject": 350, "rejection_mc_se": 0.015083, "rejection_rate": 0.35, "share_undefined": 0.0}, "es_2": {"coverage": 0.693, "n_defined": 1000, "n_fit": 1000, "n_reject": 306, "rejection_mc_se": 0.014573, "rejection_rate": 0.306, "share_undefined": 0.0}, "es_3": {"coverage": 0.364, "n_defined": 1000, "n_fit": 1000, "n_reject": 636, "rejection_mc_se": 0.015215, "rejection_rate": 0.636, "share_undefined": 0.0}, "es_4": {"coverage": 0.349, "n_defined": 1000, "n_fit": 1000, "n_reject": 647, "rejection_mc_se": 0.015113, "rejection_rate": 0.647, "share_undefined": 0.0}, "overall": {"coverage": 0.657, "n_defined": 1000, "n_fit": 1000, "n_reject": 341, "rejection_mc_se": 0.014991, "rejection_rate": 0.341, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 918, "rejection_mc_se": 0.008676, "rejection_rate": 0.918, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 963, "rejection_mc_se": 0.005969, "rejection_rate": 0.963, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.713, "n_defined": 1000, "n_fit": 1000, "n_reject": 287, "rejection_mc_se": 0.014305, "rejection_rate": 0.287, "share_undefined": 0.0}, "es_0": {"coverage": 0.72, "n_defined": 1000, "n_fit": 1000, "n_reject": 280, "rejection_mc_se": 0.014199, "rejection_rate": 0.28, "share_undefined": 0.0}, "es_1": {"coverage": 0.718, "n_defined": 1000, "n_fit": 1000, "n_reject": 282, "rejection_mc_se": 0.014229, "rejection_rate": 0.282, "share_undefined": 0.0}, "es_2": {"coverage": 0.774, "n_defined": 1000, "n_fit": 1000, "n_reject": 226, "rejection_mc_se": 0.013226, "rejection_rate": 0.226, "share_undefined": 0.0}, "es_3": {"coverage": 0.413, "n_defined": 1000, "n_fit": 1000, "n_reject": 587, "rejection_mc_se": 0.01557, "rejection_rate": 0.587, "share_undefined": 0.0}, "es_4": {"coverage": 0.406, "n_defined": 1000, "n_fit": 1000, "n_reject": 594, "rejection_mc_se": 0.015529, "rejection_rate": 0.594, "share_undefined": 0.0}, "overall": {"coverage": 0.726, "n_defined": 1000, "n_fit": 1000, "n_reject": 274, "rejection_mc_se": 0.014104, "rejection_rate": 0.274, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 809, "rejection_mc_se": 0.012431, "rejection_rate": 0.809, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 954, "rejection_mc_se": 0.006624, "rejection_rate": 0.954, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.836, "n_defined": 1000, "n_fit": 1000, "n_reject": 164, "rejection_mc_se": 0.011709, "rejection_rate": 0.164, "share_undefined": 0.0}, "es_0": {"coverage": 0.84, "n_defined": 1000, "n_fit": 1000, "n_reject": 160, "rejection_mc_se": 0.011593, "rejection_rate": 0.16, "share_undefined": 0.0}, "es_1": {"coverage": 0.838, "n_defined": 1000, "n_fit": 1000, "n_reject": 162, "rejection_mc_se": 0.011651, "rejection_rate": 0.162, "share_undefined": 0.0}, "es_2": {"coverage": 0.872, "n_defined": 1000, "n_fit": 1000, "n_reject": 128, "rejection_mc_se": 0.010565, "rejection_rate": 0.128, "share_undefined": 0.0}, "es_3": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}, "es_4": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}, "overall": {"coverage": 0.87, "n_defined": 1000, "n_fit": 1000, "n_reject": 130, "rejection_mc_se": 0.010635, "rejection_rate": 0.13, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}}}, "seconds": 140.1, "units_per_cluster": 1}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [{"overall": 0.065, "quantity": "es_3", "rejection_rate": 0.117}, {"overall": 0.065, "quantity": "es_4", "rejection_rate": 0.111}, {"overall": 0.065, "quantity": "pretrend_bonferroni", "rejection_rate": 0.182}], "index": 4, "n_clusters": 16, "n_replications": 1000, "n_treated_per_cohort": 2, "results": {"bootstrap": {"es_-2": {"coverage": 0.831, "n_defined": 1000, "n_fit": 1000, "n_reject": 167, "rejection_mc_se": 0.011795, "rejection_rate": 0.167, "share_undefined": 0.0}, "es_0": {"coverage": 0.834, "n_defined": 1000, "n_fit": 1000, "n_reject": 165, "rejection_mc_se": 0.011738, "rejection_rate": 0.165, "share_undefined": 0.0}, "es_1": {"coverage": 0.834, "n_defined": 1000, "n_fit": 1000, "n_reject": 165, "rejection_mc_se": 0.011738, "rejection_rate": 0.165, "share_undefined": 0.0}, "es_2": {"coverage": 0.872, "n_defined": 1000, "n_fit": 1000, "n_reject": 127, "rejection_mc_se": 0.01053, "rejection_rate": 0.127, "share_undefined": 0.0}, "es_3": {"coverage": 0.72, "n_defined": 1000, "n_fit": 1000, "n_reject": 276, "rejection_mc_se": 0.014136, "rejection_rate": 0.276, "share_undefined": 0.0}, "es_4": {"coverage": 0.743, "n_defined": 1000, "n_fit": 1000, "n_reject": 256, "rejection_mc_se": 0.013801, "rejection_rate": 0.256, "share_undefined": 0.0}, "overall": {"coverage": 0.838, "n_defined": 1000, "n_fit": 1000, "n_reject": 158, "rejection_mc_se": 0.011534, "rejection_rate": 0.158, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 507, "rejection_mc_se": 0.01581, "rejection_rate": 0.507, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 679, "rejection_mc_se": 0.014763, "rejection_rate": 0.679, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.885, "n_defined": 1000, "n_fit": 1000, "n_reject": 115, "rejection_mc_se": 0.010088, "rejection_rate": 0.115, "share_undefined": 0.0}, "es_0": {"coverage": 0.895, "n_defined": 1000, "n_fit": 1000, "n_reject": 105, "rejection_mc_se": 0.009694, "rejection_rate": 0.105, "share_undefined": 0.0}, "es_1": {"coverage": 0.886, "n_defined": 1000, "n_fit": 1000, "n_reject": 114, "rejection_mc_se": 0.01005, "rejection_rate": 0.114, "share_undefined": 0.0}, "es_2": {"coverage": 0.913, "n_defined": 1000, "n_fit": 1000, "n_reject": 87, "rejection_mc_se": 0.008912, "rejection_rate": 0.087, "share_undefined": 0.0}, "es_3": {"coverage": 0.781, "n_defined": 1000, "n_fit": 1000, "n_reject": 219, "rejection_mc_se": 0.013078, "rejection_rate": 0.219, "share_undefined": 0.0}, "es_4": {"coverage": 0.803, "n_defined": 1000, "n_fit": 1000, "n_reject": 197, "rejection_mc_se": 0.012577, "rejection_rate": 0.197, "share_undefined": 0.0}, "overall": {"coverage": 0.892, "n_defined": 1000, "n_fit": 1000, "n_reject": 108, "rejection_mc_se": 0.009815, "rejection_rate": 0.108, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 289, "rejection_mc_se": 0.014335, "rejection_rate": 0.289, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 659, "rejection_mc_se": 0.014991, "rejection_rate": 0.659, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.919, "n_defined": 1000, "n_fit": 1000, "n_reject": 81, "rejection_mc_se": 0.008628, "rejection_rate": 0.081, "share_undefined": 0.0}, "es_0": {"coverage": 0.927, "n_defined": 1000, "n_fit": 1000, "n_reject": 73, "rejection_mc_se": 0.008226, "rejection_rate": 0.073, "share_undefined": 0.0}, "es_1": {"coverage": 0.922, "n_defined": 1000, "n_fit": 1000, "n_reject": 78, "rejection_mc_se": 0.00848, "rejection_rate": 0.078, "share_undefined": 0.0}, "es_2": {"coverage": 0.933, "n_defined": 1000, "n_fit": 1000, "n_reject": 67, "rejection_mc_se": 0.007906, "rejection_rate": 0.067, "share_undefined": 0.0}, "es_3": {"coverage": 0.883, "n_defined": 1000, "n_fit": 1000, "n_reject": 117, "rejection_mc_se": 0.010164, "rejection_rate": 0.117, "share_undefined": 0.0}, "es_4": {"coverage": 0.889, "n_defined": 1000, "n_fit": 1000, "n_reject": 111, "rejection_mc_se": 0.009934, "rejection_rate": 0.111, "share_undefined": 0.0}, "overall": {"coverage": 0.935, "n_defined": 1000, "n_fit": 1000, "n_reject": 65, "rejection_mc_se": 0.007796, "rejection_rate": 0.065, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 182, "rejection_mc_se": 0.012201, "rejection_rate": 0.182, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 567, "rejection_mc_se": 0.015669, "rejection_rate": 0.567, "share_undefined": 0.0}}}, "seconds": 144.6, "units_per_cluster": 1}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [], "index": 5, "n_clusters": 16, "n_replications": 1000, "n_treated_per_cohort": 3, "results": {"bootstrap": {"es_-2": {"coverage": 0.898, "n_defined": 1000, "n_fit": 1000, "n_reject": 101, "rejection_mc_se": 0.009529, "rejection_rate": 0.101, "share_undefined": 0.0}, "es_0": {"coverage": 0.885, "n_defined": 1000, "n_fit": 1000, "n_reject": 115, "rejection_mc_se": 0.010088, "rejection_rate": 0.115, "share_undefined": 0.0}, "es_1": {"coverage": 0.894, "n_defined": 1000, "n_fit": 1000, "n_reject": 106, "rejection_mc_se": 0.009735, "rejection_rate": 0.106, "share_undefined": 0.0}, "es_2": {"coverage": 0.888, "n_defined": 1000, "n_fit": 1000, "n_reject": 108, "rejection_mc_se": 0.009815, "rejection_rate": 0.108, "share_undefined": 0.0}, "es_3": {"coverage": 0.825, "n_defined": 1000, "n_fit": 1000, "n_reject": 173, "rejection_mc_se": 0.011961, "rejection_rate": 0.173, "share_undefined": 0.0}, "es_4": {"coverage": 0.82, "n_defined": 1000, "n_fit": 1000, "n_reject": 179, "rejection_mc_se": 0.012123, "rejection_rate": 0.179, "share_undefined": 0.0}, "overall": {"coverage": 0.881, "n_defined": 1000, "n_fit": 1000, "n_reject": 117, "rejection_mc_se": 0.010164, "rejection_rate": 0.117, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 298, "rejection_mc_se": 0.014464, "rejection_rate": 0.298, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 451, "rejection_mc_se": 0.015735, "rejection_rate": 0.451, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.937, "n_defined": 1000, "n_fit": 1000, "n_reject": 63, "rejection_mc_se": 0.007683, "rejection_rate": 0.063, "share_undefined": 0.0}, "es_0": {"coverage": 0.922, "n_defined": 1000, "n_fit": 1000, "n_reject": 78, "rejection_mc_se": 0.00848, "rejection_rate": 0.078, "share_undefined": 0.0}, "es_1": {"coverage": 0.927, "n_defined": 1000, "n_fit": 1000, "n_reject": 73, "rejection_mc_se": 0.008226, "rejection_rate": 0.073, "share_undefined": 0.0}, "es_2": {"coverage": 0.932, "n_defined": 1000, "n_fit": 1000, "n_reject": 68, "rejection_mc_se": 0.007961, "rejection_rate": 0.068, "share_undefined": 0.0}, "es_3": {"coverage": 0.879, "n_defined": 1000, "n_fit": 1000, "n_reject": 121, "rejection_mc_se": 0.010313, "rejection_rate": 0.121, "share_undefined": 0.0}, "es_4": {"coverage": 0.874, "n_defined": 1000, "n_fit": 1000, "n_reject": 126, "rejection_mc_se": 0.010494, "rejection_rate": 0.126, "share_undefined": 0.0}, "overall": {"coverage": 0.928, "n_defined": 1000, "n_fit": 1000, "n_reject": 72, "rejection_mc_se": 0.008174, "rejection_rate": 0.072, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 135, "rejection_mc_se": 0.010806, "rejection_rate": 0.135, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 410, "rejection_mc_se": 0.015553, "rejection_rate": 0.41, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.957, "n_defined": 1000, "n_fit": 1000, "n_reject": 43, "rejection_mc_se": 0.006415, "rejection_rate": 0.043, "share_undefined": 0.0}, "es_0": {"coverage": 0.948, "n_defined": 1000, "n_fit": 1000, "n_reject": 52, "rejection_mc_se": 0.007021, "rejection_rate": 0.052, "share_undefined": 0.0}, "es_1": {"coverage": 0.953, "n_defined": 1000, "n_fit": 1000, "n_reject": 47, "rejection_mc_se": 0.006693, "rejection_rate": 0.047, "share_undefined": 0.0}, "es_2": {"coverage": 0.951, "n_defined": 1000, "n_fit": 1000, "n_reject": 49, "rejection_mc_se": 0.006826, "rejection_rate": 0.049, "share_undefined": 0.0}, "es_3": {"coverage": 0.934, "n_defined": 1000, "n_fit": 1000, "n_reject": 66, "rejection_mc_se": 0.007851, "rejection_rate": 0.066, "share_undefined": 0.0}, "es_4": {"coverage": 0.931, "n_defined": 1000, "n_fit": 1000, "n_reject": 69, "rejection_mc_se": 0.008015, "rejection_rate": 0.069, "share_undefined": 0.0}, "overall": {"coverage": 0.951, "n_defined": 1000, "n_fit": 1000, "n_reject": 49, "rejection_mc_se": 0.006826, "rejection_rate": 0.049, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 64, "rejection_mc_se": 0.00774, "rejection_rate": 0.064, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 318, "rejection_mc_se": 0.014727, "rejection_rate": 0.318, "share_undefined": 0.0}}}, "seconds": 143.8, "units_per_cluster": 1}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [], "index": 6, "n_clusters": 16, "n_replications": 1000, "n_treated_per_cohort": 4, "results": {"bootstrap": {"es_-2": {"coverage": 0.897, "n_defined": 1000, "n_fit": 1000, "n_reject": 102, "rejection_mc_se": 0.009571, "rejection_rate": 0.102, "share_undefined": 0.0}, "es_0": {"coverage": 0.896, "n_defined": 1000, "n_fit": 1000, "n_reject": 102, "rejection_mc_se": 0.009571, "rejection_rate": 0.102, "share_undefined": 0.0}, "es_1": {"coverage": 0.892, "n_defined": 1000, "n_fit": 1000, "n_reject": 105, "rejection_mc_se": 0.009694, "rejection_rate": 0.105, "share_undefined": 0.0}, "es_2": {"coverage": 0.899, "n_defined": 1000, "n_fit": 1000, "n_reject": 101, "rejection_mc_se": 0.009529, "rejection_rate": 0.101, "share_undefined": 0.0}, "es_3": {"coverage": 0.852, "n_defined": 1000, "n_fit": 1000, "n_reject": 147, "rejection_mc_se": 0.011198, "rejection_rate": 0.147, "share_undefined": 0.0}, "es_4": {"coverage": 0.85, "n_defined": 1000, "n_fit": 1000, "n_reject": 143, "rejection_mc_se": 0.01107, "rejection_rate": 0.143, "share_undefined": 0.0}, "overall": {"coverage": 0.891, "n_defined": 1000, "n_fit": 1000, "n_reject": 109, "rejection_mc_se": 0.009855, "rejection_rate": 0.109, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 254, "rejection_mc_se": 0.013765, "rejection_rate": 0.254, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 295, "rejection_mc_se": 0.014421, "rejection_rate": 0.295, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.934, "n_defined": 1000, "n_fit": 1000, "n_reject": 66, "rejection_mc_se": 0.007851, "rejection_rate": 0.066, "share_undefined": 0.0}, "es_0": {"coverage": 0.944, "n_defined": 1000, "n_fit": 1000, "n_reject": 56, "rejection_mc_se": 0.007271, "rejection_rate": 0.056, "share_undefined": 0.0}, "es_1": {"coverage": 0.934, "n_defined": 1000, "n_fit": 1000, "n_reject": 66, "rejection_mc_se": 0.007851, "rejection_rate": 0.066, "share_undefined": 0.0}, "es_2": {"coverage": 0.942, "n_defined": 1000, "n_fit": 1000, "n_reject": 58, "rejection_mc_se": 0.007392, "rejection_rate": 0.058, "share_undefined": 0.0}, "es_3": {"coverage": 0.892, "n_defined": 1000, "n_fit": 1000, "n_reject": 108, "rejection_mc_se": 0.009815, "rejection_rate": 0.108, "share_undefined": 0.0}, "es_4": {"coverage": 0.908, "n_defined": 1000, "n_fit": 1000, "n_reject": 92, "rejection_mc_se": 0.00914, "rejection_rate": 0.092, "share_undefined": 0.0}, "overall": {"coverage": 0.933, "n_defined": 1000, "n_fit": 1000, "n_reject": 67, "rejection_mc_se": 0.007906, "rejection_rate": 0.067, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 88, "rejection_mc_se": 0.008959, "rejection_rate": 0.088, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 270, "rejection_mc_se": 0.014039, "rejection_rate": 0.27, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.952, "n_defined": 1000, "n_fit": 1000, "n_reject": 48, "rejection_mc_se": 0.00676, "rejection_rate": 0.048, "share_undefined": 0.0}, "es_0": {"coverage": 0.958, "n_defined": 1000, "n_fit": 1000, "n_reject": 42, "rejection_mc_se": 0.006343, "rejection_rate": 0.042, "share_undefined": 0.0}, "es_1": {"coverage": 0.953, "n_defined": 1000, "n_fit": 1000, "n_reject": 47, "rejection_mc_se": 0.006693, "rejection_rate": 0.047, "share_undefined": 0.0}, "es_2": {"coverage": 0.957, "n_defined": 1000, "n_fit": 1000, "n_reject": 43, "rejection_mc_se": 0.006415, "rejection_rate": 0.043, "share_undefined": 0.0}, "es_3": {"coverage": 0.929, "n_defined": 1000, "n_fit": 1000, "n_reject": 71, "rejection_mc_se": 0.008122, "rejection_rate": 0.071, "share_undefined": 0.0}, "es_4": {"coverage": 0.945, "n_defined": 1000, "n_fit": 1000, "n_reject": 55, "rejection_mc_se": 0.007209, "rejection_rate": 0.055, "share_undefined": 0.0}, "overall": {"coverage": 0.958, "n_defined": 1000, "n_fit": 1000, "n_reject": 42, "rejection_mc_se": 0.006343, "rejection_rate": 0.042, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 47, "rejection_mc_se": 0.006693, "rejection_rate": 0.047, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 181, "rejection_mc_se": 0.012175, "rejection_rate": 0.181, "share_undefined": 0.0}}}, "seconds": 145.3, "units_per_cluster": 1}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [], "index": 7, "n_clusters": 24, "n_replications": 1000, "n_treated_per_cohort": 1, "results": {"bootstrap": {"es_-2": {"coverage": 0.642, "n_defined": 1000, "n_fit": 1000, "n_reject": 357, "rejection_mc_se": 0.015151, "rejection_rate": 0.357, "share_undefined": 0.0}, "es_0": {"coverage": 0.626, "n_defined": 1000, "n_fit": 1000, "n_reject": 370, "rejection_mc_se": 0.015268, "rejection_rate": 0.37, "share_undefined": 0.0}, "es_1": {"coverage": 0.627, "n_defined": 1000, "n_fit": 1000, "n_reject": 372, "rejection_mc_se": 0.015285, "rejection_rate": 0.372, "share_undefined": 0.0}, "es_2": {"coverage": 0.656, "n_defined": 1000, "n_fit": 1000, "n_reject": 344, "rejection_mc_se": 0.015022, "rejection_rate": 0.344, "share_undefined": 0.0}, "es_3": {"coverage": 0.307, "n_defined": 1000, "n_fit": 1000, "n_reject": 693, "rejection_mc_se": 0.014586, "rejection_rate": 0.693, "share_undefined": 0.0}, "es_4": {"coverage": 0.287, "n_defined": 1000, "n_fit": 1000, "n_reject": 710, "rejection_mc_se": 0.014349, "rejection_rate": 0.71, "share_undefined": 0.0}, "overall": {"coverage": 0.629, "n_defined": 1000, "n_fit": 1000, "n_reject": 369, "rejection_mc_se": 0.015259, "rejection_rate": 0.369, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 938, "rejection_mc_se": 0.007626, "rejection_rate": 0.938, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 977, "rejection_mc_se": 0.00474, "rejection_rate": 0.977, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.696, "n_defined": 1000, "n_fit": 1000, "n_reject": 304, "rejection_mc_se": 0.014546, "rejection_rate": 0.304, "share_undefined": 0.0}, "es_0": {"coverage": 0.679, "n_defined": 1000, "n_fit": 1000, "n_reject": 321, "rejection_mc_se": 0.014763, "rejection_rate": 0.321, "share_undefined": 0.0}, "es_1": {"coverage": 0.682, "n_defined": 1000, "n_fit": 1000, "n_reject": 318, "rejection_mc_se": 0.014727, "rejection_rate": 0.318, "share_undefined": 0.0}, "es_2": {"coverage": 0.713, "n_defined": 1000, "n_fit": 1000, "n_reject": 287, "rejection_mc_se": 0.014305, "rejection_rate": 0.287, "share_undefined": 0.0}, "es_3": {"coverage": 0.333, "n_defined": 1000, "n_fit": 1000, "n_reject": 667, "rejection_mc_se": 0.014903, "rejection_rate": 0.667, "share_undefined": 0.0}, "es_4": {"coverage": 0.327, "n_defined": 1000, "n_fit": 1000, "n_reject": 673, "rejection_mc_se": 0.014835, "rejection_rate": 0.673, "share_undefined": 0.0}, "overall": {"coverage": 0.698, "n_defined": 1000, "n_fit": 1000, "n_reject": 302, "rejection_mc_se": 0.014519, "rejection_rate": 0.302, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 897, "rejection_mc_se": 0.009612, "rejection_rate": 0.897, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 975, "rejection_mc_se": 0.004937, "rejection_rate": 0.975, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.815, "n_defined": 1000, "n_fit": 1000, "n_reject": 185, "rejection_mc_se": 0.012279, "rejection_rate": 0.185, "share_undefined": 0.0}, "es_0": {"coverage": 0.821, "n_defined": 1000, "n_fit": 1000, "n_reject": 179, "rejection_mc_se": 0.012123, "rejection_rate": 0.179, "share_undefined": 0.0}, "es_1": {"coverage": 0.819, "n_defined": 1000, "n_fit": 1000, "n_reject": 181, "rejection_mc_se": 0.012175, "rejection_rate": 0.181, "share_undefined": 0.0}, "es_2": {"coverage": 0.84, "n_defined": 1000, "n_fit": 1000, "n_reject": 160, "rejection_mc_se": 0.011593, "rejection_rate": 0.16, "share_undefined": 0.0}, "es_3": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}, "es_4": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}, "overall": {"coverage": 0.836, "n_defined": 1000, "n_fit": 1000, "n_reject": 164, "rejection_mc_se": 0.011709, "rejection_rate": 0.164, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}}}, "seconds": 215.3, "units_per_cluster": 1}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [{"overall": 0.08, "quantity": "es_3", "rejection_rate": 0.136}, {"overall": 0.08, "quantity": "es_4", "rejection_rate": 0.143}, {"overall": 0.08, "quantity": "pretrend_bonferroni", "rejection_rate": 0.25}], "index": 8, "n_clusters": 24, "n_replications": 1000, "n_treated_per_cohort": 2, "results": {"bootstrap": {"es_-2": {"coverage": 0.837, "n_defined": 1000, "n_fit": 1000, "n_reject": 160, "rejection_mc_se": 0.011593, "rejection_rate": 0.16, "share_undefined": 0.0}, "es_0": {"coverage": 0.836, "n_defined": 1000, "n_fit": 1000, "n_reject": 163, "rejection_mc_se": 0.01168, "rejection_rate": 0.163, "share_undefined": 0.0}, "es_1": {"coverage": 0.841, "n_defined": 1000, "n_fit": 1000, "n_reject": 157, "rejection_mc_se": 0.011504, "rejection_rate": 0.157, "share_undefined": 0.0}, "es_2": {"coverage": 0.842, "n_defined": 1000, "n_fit": 1000, "n_reject": 157, "rejection_mc_se": 0.011504, "rejection_rate": 0.157, "share_undefined": 0.0}, "es_3": {"coverage": 0.708, "n_defined": 1000, "n_fit": 1000, "n_reject": 291, "rejection_mc_se": 0.014364, "rejection_rate": 0.291, "share_undefined": 0.0}, "es_4": {"coverage": 0.713, "n_defined": 1000, "n_fit": 1000, "n_reject": 283, "rejection_mc_se": 0.014245, "rejection_rate": 0.283, "share_undefined": 0.0}, "overall": {"coverage": 0.841, "n_defined": 1000, "n_fit": 1000, "n_reject": 158, "rejection_mc_se": 0.011534, "rejection_rate": 0.158, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 559, "rejection_mc_se": 0.015701, "rejection_rate": 0.559, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 745, "rejection_mc_se": 0.013783, "rejection_rate": 0.745, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.893, "n_defined": 1000, "n_fit": 1000, "n_reject": 107, "rejection_mc_se": 0.009775, "rejection_rate": 0.107, "share_undefined": 0.0}, "es_0": {"coverage": 0.878, "n_defined": 1000, "n_fit": 1000, "n_reject": 122, "rejection_mc_se": 0.01035, "rejection_rate": 0.122, "share_undefined": 0.0}, "es_1": {"coverage": 0.881, "n_defined": 1000, "n_fit": 1000, "n_reject": 119, "rejection_mc_se": 0.010239, "rejection_rate": 0.119, "share_undefined": 0.0}, "es_2": {"coverage": 0.881, "n_defined": 1000, "n_fit": 1000, "n_reject": 119, "rejection_mc_se": 0.010239, "rejection_rate": 0.119, "share_undefined": 0.0}, "es_3": {"coverage": 0.755, "n_defined": 1000, "n_fit": 1000, "n_reject": 245, "rejection_mc_se": 0.013601, "rejection_rate": 0.245, "share_undefined": 0.0}, "es_4": {"coverage": 0.749, "n_defined": 1000, "n_fit": 1000, "n_reject": 251, "rejection_mc_se": 0.013711, "rejection_rate": 0.251, "share_undefined": 0.0}, "overall": {"coverage": 0.873, "n_defined": 1000, "n_fit": 1000, "n_reject": 127, "rejection_mc_se": 0.01053, "rejection_rate": 0.127, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 410, "rejection_mc_se": 0.015553, "rejection_rate": 0.41, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 729, "rejection_mc_se": 0.014056, "rejection_rate": 0.729, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.931, "n_defined": 1000, "n_fit": 1000, "n_reject": 69, "rejection_mc_se": 0.008015, "rejection_rate": 0.069, "share_undefined": 0.0}, "es_0": {"coverage": 0.931, "n_defined": 1000, "n_fit": 1000, "n_reject": 69, "rejection_mc_se": 0.008015, "rejection_rate": 0.069, "share_undefined": 0.0}, "es_1": {"coverage": 0.926, "n_defined": 1000, "n_fit": 1000, "n_reject": 74, "rejection_mc_se": 0.008278, "rejection_rate": 0.074, "share_undefined": 0.0}, "es_2": {"coverage": 0.92, "n_defined": 1000, "n_fit": 1000, "n_reject": 80, "rejection_mc_se": 0.008579, "rejection_rate": 0.08, "share_undefined": 0.0}, "es_3": {"coverage": 0.864, "n_defined": 1000, "n_fit": 1000, "n_reject": 136, "rejection_mc_se": 0.01084, "rejection_rate": 0.136, "share_undefined": 0.0}, "es_4": {"coverage": 0.857, "n_defined": 1000, "n_fit": 1000, "n_reject": 143, "rejection_mc_se": 0.01107, "rejection_rate": 0.143, "share_undefined": 0.0}, "overall": {"coverage": 0.92, "n_defined": 1000, "n_fit": 1000, "n_reject": 80, "rejection_mc_se": 0.008579, "rejection_rate": 0.08, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 250, "rejection_mc_se": 0.013693, "rejection_rate": 0.25, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 678, "rejection_mc_se": 0.014776, "rejection_rate": 0.678, "share_undefined": 0.0}}}, "seconds": 216.9, "units_per_cluster": 1}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [{"overall": 0.057, "quantity": "es_4", "rejection_rate": 0.097}, {"overall": 0.057, "quantity": "pretrend_bonferroni", "rejection_rate": 0.122}], "index": 9, "n_clusters": 24, "n_replications": 1000, "n_treated_per_cohort": 3, "results": {"bootstrap": {"es_-2": {"coverage": 0.881, "n_defined": 1000, "n_fit": 1000, "n_reject": 117, "rejection_mc_se": 0.010164, "rejection_rate": 0.117, "share_undefined": 0.0}, "es_0": {"coverage": 0.882, "n_defined": 1000, "n_fit": 1000, "n_reject": 116, "rejection_mc_se": 0.010126, "rejection_rate": 0.116, "share_undefined": 0.0}, "es_1": {"coverage": 0.885, "n_defined": 1000, "n_fit": 1000, "n_reject": 113, "rejection_mc_se": 0.010012, "rejection_rate": 0.113, "share_undefined": 0.0}, "es_2": {"coverage": 0.881, "n_defined": 1000, "n_fit": 1000, "n_reject": 117, "rejection_mc_se": 0.010164, "rejection_rate": 0.117, "share_undefined": 0.0}, "es_3": {"coverage": 0.803, "n_defined": 1000, "n_fit": 1000, "n_reject": 195, "rejection_mc_se": 0.012529, "rejection_rate": 0.195, "share_undefined": 0.0}, "es_4": {"coverage": 0.797, "n_defined": 1000, "n_fit": 1000, "n_reject": 203, "rejection_mc_se": 0.01272, "rejection_rate": 0.203, "share_undefined": 0.0}, "overall": {"coverage": 0.874, "n_defined": 1000, "n_fit": 1000, "n_reject": 125, "rejection_mc_se": 0.010458, "rejection_rate": 0.125, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 356, "rejection_mc_se": 0.015141, "rejection_rate": 0.356, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 471, "rejection_mc_se": 0.015785, "rejection_rate": 0.471, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.92, "n_defined": 1000, "n_fit": 1000, "n_reject": 80, "rejection_mc_se": 0.008579, "rejection_rate": 0.08, "share_undefined": 0.0}, "es_0": {"coverage": 0.921, "n_defined": 1000, "n_fit": 1000, "n_reject": 79, "rejection_mc_se": 0.00853, "rejection_rate": 0.079, "share_undefined": 0.0}, "es_1": {"coverage": 0.929, "n_defined": 1000, "n_fit": 1000, "n_reject": 71, "rejection_mc_se": 0.008122, "rejection_rate": 0.071, "share_undefined": 0.0}, "es_2": {"coverage": 0.92, "n_defined": 1000, "n_fit": 1000, "n_reject": 80, "rejection_mc_se": 0.008579, "rejection_rate": 0.08, "share_undefined": 0.0}, "es_3": {"coverage": 0.848, "n_defined": 1000, "n_fit": 1000, "n_reject": 152, "rejection_mc_se": 0.011353, "rejection_rate": 0.152, "share_undefined": 0.0}, "es_4": {"coverage": 0.834, "n_defined": 1000, "n_fit": 1000, "n_reject": 166, "rejection_mc_se": 0.011766, "rejection_rate": 0.166, "share_undefined": 0.0}, "overall": {"coverage": 0.907, "n_defined": 1000, "n_fit": 1000, "n_reject": 93, "rejection_mc_se": 0.009184, "rejection_rate": 0.093, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 206, "rejection_mc_se": 0.012789, "rejection_rate": 0.206, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 457, "rejection_mc_se": 0.015753, "rejection_rate": 0.457, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.944, "n_defined": 1000, "n_fit": 1000, "n_reject": 56, "rejection_mc_se": 0.007271, "rejection_rate": 0.056, "share_undefined": 0.0}, "es_0": {"coverage": 0.945, "n_defined": 1000, "n_fit": 1000, "n_reject": 55, "rejection_mc_se": 0.007209, "rejection_rate": 0.055, "share_undefined": 0.0}, "es_1": {"coverage": 0.945, "n_defined": 1000, "n_fit": 1000, "n_reject": 55, "rejection_mc_se": 0.007209, "rejection_rate": 0.055, "share_undefined": 0.0}, "es_2": {"coverage": 0.947, "n_defined": 1000, "n_fit": 1000, "n_reject": 53, "rejection_mc_se": 0.007085, "rejection_rate": 0.053, "share_undefined": 0.0}, "es_3": {"coverage": 0.917, "n_defined": 1000, "n_fit": 1000, "n_reject": 83, "rejection_mc_se": 0.008724, "rejection_rate": 0.083, "share_undefined": 0.0}, "es_4": {"coverage": 0.903, "n_defined": 1000, "n_fit": 1000, "n_reject": 97, "rejection_mc_se": 0.009359, "rejection_rate": 0.097, "share_undefined": 0.0}, "overall": {"coverage": 0.943, "n_defined": 1000, "n_fit": 1000, "n_reject": 57, "rejection_mc_se": 0.007332, "rejection_rate": 0.057, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 122, "rejection_mc_se": 0.01035, "rejection_rate": 0.122, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 358, "rejection_mc_se": 0.01516, "rejection_rate": 0.358, "share_undefined": 0.0}}}, "seconds": 219.9, "units_per_cluster": 1}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [], "index": 10, "n_clusters": 24, "n_replications": 1000, "n_treated_per_cohort": 4, "results": {"bootstrap": {"es_-2": {"coverage": 0.901, "n_defined": 1000, "n_fit": 1000, "n_reject": 98, "rejection_mc_se": 0.009402, "rejection_rate": 0.098, "share_undefined": 0.0}, "es_0": {"coverage": 0.896, "n_defined": 1000, "n_fit": 1000, "n_reject": 102, "rejection_mc_se": 0.009571, "rejection_rate": 0.102, "share_undefined": 0.0}, "es_1": {"coverage": 0.895, "n_defined": 1000, "n_fit": 1000, "n_reject": 104, "rejection_mc_se": 0.009653, "rejection_rate": 0.104, "share_undefined": 0.0}, "es_2": {"coverage": 0.89, "n_defined": 1000, "n_fit": 1000, "n_reject": 105, "rejection_mc_se": 0.009694, "rejection_rate": 0.105, "share_undefined": 0.0}, "es_3": {"coverage": 0.827, "n_defined": 1000, "n_fit": 1000, "n_reject": 172, "rejection_mc_se": 0.011934, "rejection_rate": 0.172, "share_undefined": 0.0}, "es_4": {"coverage": 0.842, "n_defined": 1000, "n_fit": 1000, "n_reject": 158, "rejection_mc_se": 0.011534, "rejection_rate": 0.158, "share_undefined": 0.0}, "overall": {"coverage": 0.877, "n_defined": 1000, "n_fit": 1000, "n_reject": 121, "rejection_mc_se": 0.010313, "rejection_rate": 0.121, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 263, "rejection_mc_se": 0.013922, "rejection_rate": 0.263, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 373, "rejection_mc_se": 0.015293, "rejection_rate": 0.373, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.93, "n_defined": 1000, "n_fit": 1000, "n_reject": 70, "rejection_mc_se": 0.008068, "rejection_rate": 0.07, "share_undefined": 0.0}, "es_0": {"coverage": 0.928, "n_defined": 1000, "n_fit": 1000, "n_reject": 72, "rejection_mc_se": 0.008174, "rejection_rate": 0.072, "share_undefined": 0.0}, "es_1": {"coverage": 0.92, "n_defined": 1000, "n_fit": 1000, "n_reject": 80, "rejection_mc_se": 0.008579, "rejection_rate": 0.08, "share_undefined": 0.0}, "es_2": {"coverage": 0.927, "n_defined": 1000, "n_fit": 1000, "n_reject": 73, "rejection_mc_se": 0.008226, "rejection_rate": 0.073, "share_undefined": 0.0}, "es_3": {"coverage": 0.88, "n_defined": 1000, "n_fit": 1000, "n_reject": 120, "rejection_mc_se": 0.010276, "rejection_rate": 0.12, "share_undefined": 0.0}, "es_4": {"coverage": 0.884, "n_defined": 1000, "n_fit": 1000, "n_reject": 116, "rejection_mc_se": 0.010126, "rejection_rate": 0.116, "share_undefined": 0.0}, "overall": {"coverage": 0.913, "n_defined": 1000, "n_fit": 1000, "n_reject": 87, "rejection_mc_se": 0.008912, "rejection_rate": 0.087, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 132, "rejection_mc_se": 0.010704, "rejection_rate": 0.132, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 340, "rejection_mc_se": 0.01498, "rejection_rate": 0.34, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.942, "n_defined": 1000, "n_fit": 1000, "n_reject": 58, "rejection_mc_se": 0.007392, "rejection_rate": 0.058, "share_undefined": 0.0}, "es_0": {"coverage": 0.944, "n_defined": 1000, "n_fit": 1000, "n_reject": 56, "rejection_mc_se": 0.007271, "rejection_rate": 0.056, "share_undefined": 0.0}, "es_1": {"coverage": 0.932, "n_defined": 1000, "n_fit": 1000, "n_reject": 68, "rejection_mc_se": 0.007961, "rejection_rate": 0.068, "share_undefined": 0.0}, "es_2": {"coverage": 0.945, "n_defined": 1000, "n_fit": 1000, "n_reject": 55, "rejection_mc_se": 0.007209, "rejection_rate": 0.055, "share_undefined": 0.0}, "es_3": {"coverage": 0.915, "n_defined": 1000, "n_fit": 1000, "n_reject": 85, "rejection_mc_se": 0.008819, "rejection_rate": 0.085, "share_undefined": 0.0}, "es_4": {"coverage": 0.93, "n_defined": 1000, "n_fit": 1000, "n_reject": 70, "rejection_mc_se": 0.008068, "rejection_rate": 0.07, "share_undefined": 0.0}, "overall": {"coverage": 0.933, "n_defined": 1000, "n_fit": 1000, "n_reject": 67, "rejection_mc_se": 0.007906, "rejection_rate": 0.067, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 85, "rejection_mc_se": 0.008819, "rejection_rate": 0.085, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 250, "rejection_mc_se": 0.013693, "rejection_rate": 0.25, "share_undefined": 0.0}}}, "seconds": 219.2, "units_per_cluster": 1}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [], "index": 11, "n_clusters": 24, "n_replications": 1000, "n_treated_per_cohort": 6, "results": {"bootstrap": {"es_-2": {"coverage": 0.922, "n_defined": 1000, "n_fit": 1000, "n_reject": 76, "rejection_mc_se": 0.00838, "rejection_rate": 0.076, "share_undefined": 0.0}, "es_0": {"coverage": 0.934, "n_defined": 1000, "n_fit": 1000, "n_reject": 65, "rejection_mc_se": 0.007796, "rejection_rate": 0.065, "share_undefined": 0.0}, "es_1": {"coverage": 0.928, "n_defined": 1000, "n_fit": 1000, "n_reject": 66, "rejection_mc_se": 0.007851, "rejection_rate": 0.066, "share_undefined": 0.0}, "es_2": {"coverage": 0.923, "n_defined": 1000, "n_fit": 1000, "n_reject": 75, "rejection_mc_se": 0.008329, "rejection_rate": 0.075, "share_undefined": 0.0}, "es_3": {"coverage": 0.903, "n_defined": 1000, "n_fit": 1000, "n_reject": 95, "rejection_mc_se": 0.009272, "rejection_rate": 0.095, "share_undefined": 0.0}, "es_4": {"coverage": 0.912, "n_defined": 1000, "n_fit": 1000, "n_reject": 85, "rejection_mc_se": 0.008819, "rejection_rate": 0.085, "share_undefined": 0.0}, "overall": {"coverage": 0.929, "n_defined": 1000, "n_fit": 1000, "n_reject": 69, "rejection_mc_se": 0.008015, "rejection_rate": 0.069, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 139, "rejection_mc_se": 0.01094, "rejection_rate": 0.139, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 201, "rejection_mc_se": 0.012673, "rejection_rate": 0.201, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.94, "n_defined": 1000, "n_fit": 1000, "n_reject": 60, "rejection_mc_se": 0.00751, "rejection_rate": 0.06, "share_undefined": 0.0}, "es_0": {"coverage": 0.959, "n_defined": 1000, "n_fit": 1000, "n_reject": 41, "rejection_mc_se": 0.00627, "rejection_rate": 0.041, "share_undefined": 0.0}, "es_1": {"coverage": 0.958, "n_defined": 1000, "n_fit": 1000, "n_reject": 42, "rejection_mc_se": 0.006343, "rejection_rate": 0.042, "share_undefined": 0.0}, "es_2": {"coverage": 0.956, "n_defined": 1000, "n_fit": 1000, "n_reject": 44, "rejection_mc_se": 0.006486, "rejection_rate": 0.044, "share_undefined": 0.0}, "es_3": {"coverage": 0.928, "n_defined": 1000, "n_fit": 1000, "n_reject": 72, "rejection_mc_se": 0.008174, "rejection_rate": 0.072, "share_undefined": 0.0}, "es_4": {"coverage": 0.94, "n_defined": 1000, "n_fit": 1000, "n_reject": 60, "rejection_mc_se": 0.00751, "rejection_rate": 0.06, "share_undefined": 0.0}, "overall": {"coverage": 0.957, "n_defined": 1000, "n_fit": 1000, "n_reject": 43, "rejection_mc_se": 0.006415, "rejection_rate": 0.043, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 53, "rejection_mc_se": 0.007085, "rejection_rate": 0.053, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 182, "rejection_mc_se": 0.012201, "rejection_rate": 0.182, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.953, "n_defined": 1000, "n_fit": 1000, "n_reject": 47, "rejection_mc_se": 0.006693, "rejection_rate": 0.047, "share_undefined": 0.0}, "es_0": {"coverage": 0.966, "n_defined": 1000, "n_fit": 1000, "n_reject": 34, "rejection_mc_se": 0.005731, "rejection_rate": 0.034, "share_undefined": 0.0}, "es_1": {"coverage": 0.96, "n_defined": 1000, "n_fit": 1000, "n_reject": 40, "rejection_mc_se": 0.006197, "rejection_rate": 0.04, "share_undefined": 0.0}, "es_2": {"coverage": 0.964, "n_defined": 1000, "n_fit": 1000, "n_reject": 36, "rejection_mc_se": 0.005891, "rejection_rate": 0.036, "share_undefined": 0.0}, "es_3": {"coverage": 0.958, "n_defined": 1000, "n_fit": 1000, "n_reject": 42, "rejection_mc_se": 0.006343, "rejection_rate": 0.042, "share_undefined": 0.0}, "es_4": {"coverage": 0.96, "n_defined": 1000, "n_fit": 1000, "n_reject": 40, "rejection_mc_se": 0.006197, "rejection_rate": 0.04, "share_undefined": 0.0}, "overall": {"coverage": 0.97, "n_defined": 1000, "n_fit": 1000, "n_reject": 30, "rejection_mc_se": 0.005394, "rejection_rate": 0.03, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 40, "rejection_mc_se": 0.006197, "rejection_rate": 0.04, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 134, "rejection_mc_se": 0.010772, "rejection_rate": 0.134, "share_undefined": 0.0}}}, "seconds": 217.7, "units_per_cluster": 1}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [], "index": 12, "n_clusters": 24, "n_replications": 1000, "n_treated_per_cohort": 8, "results": {"bootstrap": {"es_-2": {"coverage": 0.922, "n_defined": 1000, "n_fit": 1000, "n_reject": 77, "rejection_mc_se": 0.00843, "rejection_rate": 0.077, "share_undefined": 0.0}, "es_0": {"coverage": 0.929, "n_defined": 1000, "n_fit": 1000, "n_reject": 70, "rejection_mc_se": 0.008068, "rejection_rate": 0.07, "share_undefined": 0.0}, "es_1": {"coverage": 0.935, "n_defined": 1000, "n_fit": 1000, "n_reject": 64, "rejection_mc_se": 0.00774, "rejection_rate": 0.064, "share_undefined": 0.0}, "es_2": {"coverage": 0.923, "n_defined": 1000, "n_fit": 1000, "n_reject": 76, "rejection_mc_se": 0.00838, "rejection_rate": 0.076, "share_undefined": 0.0}, "es_3": {"coverage": 0.903, "n_defined": 1000, "n_fit": 1000, "n_reject": 92, "rejection_mc_se": 0.00914, "rejection_rate": 0.092, "share_undefined": 0.0}, "es_4": {"coverage": 0.912, "n_defined": 1000, "n_fit": 1000, "n_reject": 87, "rejection_mc_se": 0.008912, "rejection_rate": 0.087, "share_undefined": 0.0}, "overall": {"coverage": 0.92, "n_defined": 1000, "n_fit": 1000, "n_reject": 79, "rejection_mc_se": 0.00853, "rejection_rate": 0.079, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 162, "rejection_mc_se": 0.011651, "rejection_rate": 0.162, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 184, "rejection_mc_se": 0.012253, "rejection_rate": 0.184, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.945, "n_defined": 1000, "n_fit": 1000, "n_reject": 55, "rejection_mc_se": 0.007209, "rejection_rate": 0.055, "share_undefined": 0.0}, "es_0": {"coverage": 0.954, "n_defined": 1000, "n_fit": 1000, "n_reject": 46, "rejection_mc_se": 0.006624, "rejection_rate": 0.046, "share_undefined": 0.0}, "es_1": {"coverage": 0.956, "n_defined": 1000, "n_fit": 1000, "n_reject": 44, "rejection_mc_se": 0.006486, "rejection_rate": 0.044, "share_undefined": 0.0}, "es_2": {"coverage": 0.947, "n_defined": 1000, "n_fit": 1000, "n_reject": 53, "rejection_mc_se": 0.007085, "rejection_rate": 0.053, "share_undefined": 0.0}, "es_3": {"coverage": 0.934, "n_defined": 1000, "n_fit": 1000, "n_reject": 66, "rejection_mc_se": 0.007851, "rejection_rate": 0.066, "share_undefined": 0.0}, "es_4": {"coverage": 0.941, "n_defined": 1000, "n_fit": 1000, "n_reject": 59, "rejection_mc_se": 0.007451, "rejection_rate": 0.059, "share_undefined": 0.0}, "overall": {"coverage": 0.947, "n_defined": 1000, "n_fit": 1000, "n_reject": 53, "rejection_mc_se": 0.007085, "rejection_rate": 0.053, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 65, "rejection_mc_se": 0.007796, "rejection_rate": 0.065, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 152, "rejection_mc_se": 0.011353, "rejection_rate": 0.152, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.953, "n_defined": 1000, "n_fit": 1000, "n_reject": 47, "rejection_mc_se": 0.006693, "rejection_rate": 0.047, "share_undefined": 0.0}, "es_0": {"coverage": 0.963, "n_defined": 1000, "n_fit": 1000, "n_reject": 37, "rejection_mc_se": 0.005969, "rejection_rate": 0.037, "share_undefined": 0.0}, "es_1": {"coverage": 0.964, "n_defined": 1000, "n_fit": 1000, "n_reject": 36, "rejection_mc_se": 0.005891, "rejection_rate": 0.036, "share_undefined": 0.0}, "es_2": {"coverage": 0.962, "n_defined": 1000, "n_fit": 1000, "n_reject": 38, "rejection_mc_se": 0.006046, "rejection_rate": 0.038, "share_undefined": 0.0}, "es_3": {"coverage": 0.96, "n_defined": 1000, "n_fit": 1000, "n_reject": 40, "rejection_mc_se": 0.006197, "rejection_rate": 0.04, "share_undefined": 0.0}, "es_4": {"coverage": 0.953, "n_defined": 1000, "n_fit": 1000, "n_reject": 47, "rejection_mc_se": 0.006693, "rejection_rate": 0.047, "share_undefined": 0.0}, "overall": {"coverage": 0.958, "n_defined": 1000, "n_fit": 1000, "n_reject": 42, "rejection_mc_se": 0.006343, "rejection_rate": 0.042, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 40, "rejection_mc_se": 0.006197, "rejection_rate": 0.04, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 113, "rejection_mc_se": 0.010012, "rejection_rate": 0.113, "share_undefined": 0.0}}}, "seconds": 249.9, "units_per_cluster": 1}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [], "index": 13, "n_clusters": 32, "n_replications": 1000, "n_treated_per_cohort": 1, "results": {"bootstrap": {"es_-2": {"coverage": 0.621, "n_defined": 1000, "n_fit": 1000, "n_reject": 379, "rejection_mc_se": 0.015341, "rejection_rate": 0.379, "share_undefined": 0.0}, "es_0": {"coverage": 0.596, "n_defined": 1000, "n_fit": 1000, "n_reject": 402, "rejection_mc_se": 0.015505, "rejection_rate": 0.402, "share_undefined": 0.0}, "es_1": {"coverage": 0.612, "n_defined": 1000, "n_fit": 1000, "n_reject": 386, "rejection_mc_se": 0.015395, "rejection_rate": 0.386, "share_undefined": 0.0}, "es_2": {"coverage": 0.621, "n_defined": 1000, "n_fit": 1000, "n_reject": 377, "rejection_mc_se": 0.015326, "rejection_rate": 0.377, "share_undefined": 0.0}, "es_3": {"coverage": 0.264, "n_defined": 1000, "n_fit": 1000, "n_reject": 736, "rejection_mc_se": 0.013939, "rejection_rate": 0.736, "share_undefined": 0.0}, "es_4": {"coverage": 0.273, "n_defined": 1000, "n_fit": 1000, "n_reject": 727, "rejection_mc_se": 0.014088, "rejection_rate": 0.727, "share_undefined": 0.0}, "overall": {"coverage": 0.614, "n_defined": 1000, "n_fit": 1000, "n_reject": 382, "rejection_mc_se": 0.015365, "rejection_rate": 0.382, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 956, "rejection_mc_se": 0.006486, "rejection_rate": 0.956, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 984, "rejection_mc_se": 0.003968, "rejection_rate": 0.984, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.679, "n_defined": 1000, "n_fit": 1000, "n_reject": 321, "rejection_mc_se": 0.014763, "rejection_rate": 0.321, "share_undefined": 0.0}, "es_0": {"coverage": 0.654, "n_defined": 1000, "n_fit": 1000, "n_reject": 346, "rejection_mc_se": 0.015043, "rejection_rate": 0.346, "share_undefined": 0.0}, "es_1": {"coverage": 0.661, "n_defined": 1000, "n_fit": 1000, "n_reject": 339, "rejection_mc_se": 0.014969, "rejection_rate": 0.339, "share_undefined": 0.0}, "es_2": {"coverage": 0.684, "n_defined": 1000, "n_fit": 1000, "n_reject": 316, "rejection_mc_se": 0.014702, "rejection_rate": 0.316, "share_undefined": 0.0}, "es_3": {"coverage": 0.285, "n_defined": 1000, "n_fit": 1000, "n_reject": 715, "rejection_mc_se": 0.014275, "rejection_rate": 0.715, "share_undefined": 0.0}, "es_4": {"coverage": 0.289, "n_defined": 1000, "n_fit": 1000, "n_reject": 711, "rejection_mc_se": 0.014335, "rejection_rate": 0.711, "share_undefined": 0.0}, "overall": {"coverage": 0.661, "n_defined": 1000, "n_fit": 1000, "n_reject": 339, "rejection_mc_se": 0.014969, "rejection_rate": 0.339, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 930, "rejection_mc_se": 0.008068, "rejection_rate": 0.93, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 982, "rejection_mc_se": 0.004204, "rejection_rate": 0.982, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.815, "n_defined": 1000, "n_fit": 1000, "n_reject": 185, "rejection_mc_se": 0.012279, "rejection_rate": 0.185, "share_undefined": 0.0}, "es_0": {"coverage": 0.811, "n_defined": 1000, "n_fit": 1000, "n_reject": 189, "rejection_mc_se": 0.012381, "rejection_rate": 0.189, "share_undefined": 0.0}, "es_1": {"coverage": 0.796, "n_defined": 1000, "n_fit": 1000, "n_reject": 204, "rejection_mc_se": 0.012743, "rejection_rate": 0.204, "share_undefined": 0.0}, "es_2": {"coverage": 0.81, "n_defined": 1000, "n_fit": 1000, "n_reject": 190, "rejection_mc_se": 0.012406, "rejection_rate": 0.19, "share_undefined": 0.0}, "es_3": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}, "es_4": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}, "overall": {"coverage": 0.818, "n_defined": 1000, "n_fit": 1000, "n_reject": 182, "rejection_mc_se": 0.012201, "rejection_rate": 0.182, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}}}, "seconds": 306.5, "units_per_cluster": 1}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [{"overall": 0.095, "quantity": "es_3", "rejection_rate": 0.147}, {"overall": 0.095, "quantity": "es_4", "rejection_rate": 0.141}, {"overall": 0.095, "quantity": "pretrend_bonferroni", "rejection_rate": 0.261}], "index": 14, "n_clusters": 32, "n_replications": 1000, "n_treated_per_cohort": 2, "results": {"bootstrap": {"es_-2": {"coverage": 0.821, "n_defined": 1000, "n_fit": 1000, "n_reject": 179, "rejection_mc_se": 0.012123, "rejection_rate": 0.179, "share_undefined": 0.0}, "es_0": {"coverage": 0.798, "n_defined": 1000, "n_fit": 1000, "n_reject": 201, "rejection_mc_se": 0.012673, "rejection_rate": 0.201, "share_undefined": 0.0}, "es_1": {"coverage": 0.799, "n_defined": 1000, "n_fit": 1000, "n_reject": 200, "rejection_mc_se": 0.012649, "rejection_rate": 0.2, "share_undefined": 0.0}, "es_2": {"coverage": 0.827, "n_defined": 1000, "n_fit": 1000, "n_reject": 171, "rejection_mc_se": 0.011906, "rejection_rate": 0.171, "share_undefined": 0.0}, "es_3": {"coverage": 0.673, "n_defined": 1000, "n_fit": 1000, "n_reject": 325, "rejection_mc_se": 0.014811, "rejection_rate": 0.325, "share_undefined": 0.0}, "es_4": {"coverage": 0.7, "n_defined": 1000, "n_fit": 1000, "n_reject": 297, "rejection_mc_se": 0.01445, "rejection_rate": 0.297, "share_undefined": 0.0}, "overall": {"coverage": 0.806, "n_defined": 1000, "n_fit": 1000, "n_reject": 192, "rejection_mc_se": 0.012455, "rejection_rate": 0.192, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 604, "rejection_mc_se": 0.015466, "rejection_rate": 0.604, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 791, "rejection_mc_se": 0.012858, "rejection_rate": 0.791, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.867, "n_defined": 1000, "n_fit": 1000, "n_reject": 133, "rejection_mc_se": 0.010738, "rejection_rate": 0.133, "share_undefined": 0.0}, "es_0": {"coverage": 0.841, "n_defined": 1000, "n_fit": 1000, "n_reject": 159, "rejection_mc_se": 0.011564, "rejection_rate": 0.159, "share_undefined": 0.0}, "es_1": {"coverage": 0.842, "n_defined": 1000, "n_fit": 1000, "n_reject": 158, "rejection_mc_se": 0.011534, "rejection_rate": 0.158, "share_undefined": 0.0}, "es_2": {"coverage": 0.863, "n_defined": 1000, "n_fit": 1000, "n_reject": 137, "rejection_mc_se": 0.010873, "rejection_rate": 0.137, "share_undefined": 0.0}, "es_3": {"coverage": 0.734, "n_defined": 1000, "n_fit": 1000, "n_reject": 266, "rejection_mc_se": 0.013973, "rejection_rate": 0.266, "share_undefined": 0.0}, "es_4": {"coverage": 0.745, "n_defined": 1000, "n_fit": 1000, "n_reject": 255, "rejection_mc_se": 0.013783, "rejection_rate": 0.255, "share_undefined": 0.0}, "overall": {"coverage": 0.849, "n_defined": 1000, "n_fit": 1000, "n_reject": 151, "rejection_mc_se": 0.011322, "rejection_rate": 0.151, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 445, "rejection_mc_se": 0.015715, "rejection_rate": 0.445, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 780, "rejection_mc_se": 0.0131, "rejection_rate": 0.78, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.914, "n_defined": 1000, "n_fit": 1000, "n_reject": 86, "rejection_mc_se": 0.008866, "rejection_rate": 0.086, "share_undefined": 0.0}, "es_0": {"coverage": 0.915, "n_defined": 1000, "n_fit": 1000, "n_reject": 85, "rejection_mc_se": 0.008819, "rejection_rate": 0.085, "share_undefined": 0.0}, "es_1": {"coverage": 0.895, "n_defined": 1000, "n_fit": 1000, "n_reject": 105, "rejection_mc_se": 0.009694, "rejection_rate": 0.105, "share_undefined": 0.0}, "es_2": {"coverage": 0.914, "n_defined": 1000, "n_fit": 1000, "n_reject": 86, "rejection_mc_se": 0.008866, "rejection_rate": 0.086, "share_undefined": 0.0}, "es_3": {"coverage": 0.853, "n_defined": 1000, "n_fit": 1000, "n_reject": 147, "rejection_mc_se": 0.011198, "rejection_rate": 0.147, "share_undefined": 0.0}, "es_4": {"coverage": 0.859, "n_defined": 1000, "n_fit": 1000, "n_reject": 141, "rejection_mc_se": 0.011005, "rejection_rate": 0.141, "share_undefined": 0.0}, "overall": {"coverage": 0.905, "n_defined": 1000, "n_fit": 1000, "n_reject": 95, "rejection_mc_se": 0.009272, "rejection_rate": 0.095, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 261, "rejection_mc_se": 0.013888, "rejection_rate": 0.261, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 699, "rejection_mc_se": 0.014505, "rejection_rate": 0.699, "share_undefined": 0.0}}}, "seconds": 311.9, "units_per_cluster": 1}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [{"overall": 0.074, "quantity": "es_3", "rejection_rate": 0.106}, {"overall": 0.074, "quantity": "es_4", "rejection_rate": 0.121}, {"overall": 0.074, "quantity": "pretrend_bonferroni", "rejection_rate": 0.145}], "index": 15, "n_clusters": 32, "n_replications": 1000, "n_treated_per_cohort": 3, "results": {"bootstrap": {"es_-2": {"coverage": 0.873, "n_defined": 1000, "n_fit": 1000, "n_reject": 125, "rejection_mc_se": 0.010458, "rejection_rate": 0.125, "share_undefined": 0.0}, "es_0": {"coverage": 0.871, "n_defined": 1000, "n_fit": 1000, "n_reject": 129, "rejection_mc_se": 0.0106, "rejection_rate": 0.129, "share_undefined": 0.0}, "es_1": {"coverage": 0.855, "n_defined": 1000, "n_fit": 1000, "n_reject": 142, "rejection_mc_se": 0.011038, "rejection_rate": 0.142, "share_undefined": 0.0}, "es_2": {"coverage": 0.876, "n_defined": 1000, "n_fit": 1000, "n_reject": 123, "rejection_mc_se": 0.010386, "rejection_rate": 0.123, "share_undefined": 0.0}, "es_3": {"coverage": 0.782, "n_defined": 1000, "n_fit": 1000, "n_reject": 218, "rejection_mc_se": 0.013057, "rejection_rate": 0.218, "share_undefined": 0.0}, "es_4": {"coverage": 0.775, "n_defined": 1000, "n_fit": 1000, "n_reject": 224, "rejection_mc_se": 0.013184, "rejection_rate": 0.224, "share_undefined": 0.0}, "overall": {"coverage": 0.868, "n_defined": 1000, "n_fit": 1000, "n_reject": 129, "rejection_mc_se": 0.0106, "rejection_rate": 0.129, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 398, "rejection_mc_se": 0.015479, "rejection_rate": 0.398, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 539, "rejection_mc_se": 0.015763, "rejection_rate": 0.539, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.901, "n_defined": 1000, "n_fit": 1000, "n_reject": 99, "rejection_mc_se": 0.009445, "rejection_rate": 0.099, "share_undefined": 0.0}, "es_0": {"coverage": 0.899, "n_defined": 1000, "n_fit": 1000, "n_reject": 101, "rejection_mc_se": 0.009529, "rejection_rate": 0.101, "share_undefined": 0.0}, "es_1": {"coverage": 0.892, "n_defined": 1000, "n_fit": 1000, "n_reject": 108, "rejection_mc_se": 0.009815, "rejection_rate": 0.108, "share_undefined": 0.0}, "es_2": {"coverage": 0.903, "n_defined": 1000, "n_fit": 1000, "n_reject": 97, "rejection_mc_se": 0.009359, "rejection_rate": 0.097, "share_undefined": 0.0}, "es_3": {"coverage": 0.823, "n_defined": 1000, "n_fit": 1000, "n_reject": 177, "rejection_mc_se": 0.012069, "rejection_rate": 0.177, "share_undefined": 0.0}, "es_4": {"coverage": 0.809, "n_defined": 1000, "n_fit": 1000, "n_reject": 191, "rejection_mc_se": 0.012431, "rejection_rate": 0.191, "share_undefined": 0.0}, "overall": {"coverage": 0.895, "n_defined": 1000, "n_fit": 1000, "n_reject": 105, "rejection_mc_se": 0.009694, "rejection_rate": 0.105, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 251, "rejection_mc_se": 0.013711, "rejection_rate": 0.251, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 519, "rejection_mc_se": 0.0158, "rejection_rate": 0.519, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.934, "n_defined": 1000, "n_fit": 1000, "n_reject": 66, "rejection_mc_se": 0.007851, "rejection_rate": 0.066, "share_undefined": 0.0}, "es_0": {"coverage": 0.929, "n_defined": 1000, "n_fit": 1000, "n_reject": 71, "rejection_mc_se": 0.008122, "rejection_rate": 0.071, "share_undefined": 0.0}, "es_1": {"coverage": 0.929, "n_defined": 1000, "n_fit": 1000, "n_reject": 71, "rejection_mc_se": 0.008122, "rejection_rate": 0.071, "share_undefined": 0.0}, "es_2": {"coverage": 0.94, "n_defined": 1000, "n_fit": 1000, "n_reject": 60, "rejection_mc_se": 0.00751, "rejection_rate": 0.06, "share_undefined": 0.0}, "es_3": {"coverage": 0.894, "n_defined": 1000, "n_fit": 1000, "n_reject": 106, "rejection_mc_se": 0.009735, "rejection_rate": 0.106, "share_undefined": 0.0}, "es_4": {"coverage": 0.879, "n_defined": 1000, "n_fit": 1000, "n_reject": 121, "rejection_mc_se": 0.010313, "rejection_rate": 0.121, "share_undefined": 0.0}, "overall": {"coverage": 0.926, "n_defined": 1000, "n_fit": 1000, "n_reject": 74, "rejection_mc_se": 0.008278, "rejection_rate": 0.074, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 145, "rejection_mc_se": 0.011134, "rejection_rate": 0.145, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 408, "rejection_mc_se": 0.015541, "rejection_rate": 0.408, "share_undefined": 0.0}}}, "seconds": 308.3, "units_per_cluster": 1}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [{"overall": 0.054, "quantity": "es_4", "rejection_rate": 0.087}, {"overall": 0.054, "quantity": "pretrend_bonferroni", "rejection_rate": 0.092}], "index": 16, "n_clusters": 32, "n_replications": 1000, "n_treated_per_cohort": 4, "results": {"bootstrap": {"es_-2": {"coverage": 0.898, "n_defined": 1000, "n_fit": 1000, "n_reject": 99, "rejection_mc_se": 0.009445, "rejection_rate": 0.099, "share_undefined": 0.0}, "es_0": {"coverage": 0.908, "n_defined": 1000, "n_fit": 1000, "n_reject": 92, "rejection_mc_se": 0.00914, "rejection_rate": 0.092, "share_undefined": 0.0}, "es_1": {"coverage": 0.905, "n_defined": 1000, "n_fit": 1000, "n_reject": 94, "rejection_mc_se": 0.009228, "rejection_rate": 0.094, "share_undefined": 0.0}, "es_2": {"coverage": 0.911, "n_defined": 1000, "n_fit": 1000, "n_reject": 87, "rejection_mc_se": 0.008912, "rejection_rate": 0.087, "share_undefined": 0.0}, "es_3": {"coverage": 0.835, "n_defined": 1000, "n_fit": 1000, "n_reject": 162, "rejection_mc_se": 0.011651, "rejection_rate": 0.162, "share_undefined": 0.0}, "es_4": {"coverage": 0.827, "n_defined": 1000, "n_fit": 1000, "n_reject": 171, "rejection_mc_se": 0.011906, "rejection_rate": 0.171, "share_undefined": 0.0}, "overall": {"coverage": 0.899, "n_defined": 1000, "n_fit": 1000, "n_reject": 98, "rejection_mc_se": 0.009402, "rejection_rate": 0.098, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 260, "rejection_mc_se": 0.013871, "rejection_rate": 0.26, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 373, "rejection_mc_se": 0.015293, "rejection_rate": 0.373, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.92, "n_defined": 1000, "n_fit": 1000, "n_reject": 80, "rejection_mc_se": 0.008579, "rejection_rate": 0.08, "share_undefined": 0.0}, "es_0": {"coverage": 0.929, "n_defined": 1000, "n_fit": 1000, "n_reject": 71, "rejection_mc_se": 0.008122, "rejection_rate": 0.071, "share_undefined": 0.0}, "es_1": {"coverage": 0.924, "n_defined": 1000, "n_fit": 1000, "n_reject": 76, "rejection_mc_se": 0.00838, "rejection_rate": 0.076, "share_undefined": 0.0}, "es_2": {"coverage": 0.937, "n_defined": 1000, "n_fit": 1000, "n_reject": 63, "rejection_mc_se": 0.007683, "rejection_rate": 0.063, "share_undefined": 0.0}, "es_3": {"coverage": 0.869, "n_defined": 1000, "n_fit": 1000, "n_reject": 131, "rejection_mc_se": 0.01067, "rejection_rate": 0.131, "share_undefined": 0.0}, "es_4": {"coverage": 0.858, "n_defined": 1000, "n_fit": 1000, "n_reject": 142, "rejection_mc_se": 0.011038, "rejection_rate": 0.142, "share_undefined": 0.0}, "overall": {"coverage": 0.924, "n_defined": 1000, "n_fit": 1000, "n_reject": 76, "rejection_mc_se": 0.00838, "rejection_rate": 0.076, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 154, "rejection_mc_se": 0.011414, "rejection_rate": 0.154, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 350, "rejection_mc_se": 0.015083, "rejection_rate": 0.35, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.94, "n_defined": 1000, "n_fit": 1000, "n_reject": 60, "rejection_mc_se": 0.00751, "rejection_rate": 0.06, "share_undefined": 0.0}, "es_0": {"coverage": 0.953, "n_defined": 1000, "n_fit": 1000, "n_reject": 47, "rejection_mc_se": 0.006693, "rejection_rate": 0.047, "share_undefined": 0.0}, "es_1": {"coverage": 0.939, "n_defined": 1000, "n_fit": 1000, "n_reject": 61, "rejection_mc_se": 0.007568, "rejection_rate": 0.061, "share_undefined": 0.0}, "es_2": {"coverage": 0.957, "n_defined": 1000, "n_fit": 1000, "n_reject": 43, "rejection_mc_se": 0.006415, "rejection_rate": 0.043, "share_undefined": 0.0}, "es_3": {"coverage": 0.918, "n_defined": 1000, "n_fit": 1000, "n_reject": 82, "rejection_mc_se": 0.008676, "rejection_rate": 0.082, "share_undefined": 0.0}, "es_4": {"coverage": 0.913, "n_defined": 1000, "n_fit": 1000, "n_reject": 87, "rejection_mc_se": 0.008912, "rejection_rate": 0.087, "share_undefined": 0.0}, "overall": {"coverage": 0.946, "n_defined": 1000, "n_fit": 1000, "n_reject": 54, "rejection_mc_se": 0.007147, "rejection_rate": 0.054, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 92, "rejection_mc_se": 0.00914, "rejection_rate": 0.092, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 274, "rejection_mc_se": 0.014104, "rejection_rate": 0.274, "share_undefined": 0.0}}}, "seconds": 306.2, "units_per_cluster": 1}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [], "index": 17, "n_clusters": 32, "n_replications": 1000, "n_treated_per_cohort": 6, "results": {"bootstrap": {"es_-2": {"coverage": 0.915, "n_defined": 1000, "n_fit": 1000, "n_reject": 82, "rejection_mc_se": 0.008676, "rejection_rate": 0.082, "share_undefined": 0.0}, "es_0": {"coverage": 0.925, "n_defined": 1000, "n_fit": 1000, "n_reject": 73, "rejection_mc_se": 0.008226, "rejection_rate": 0.073, "share_undefined": 0.0}, "es_1": {"coverage": 0.917, "n_defined": 1000, "n_fit": 1000, "n_reject": 81, "rejection_mc_se": 0.008628, "rejection_rate": 0.081, "share_undefined": 0.0}, "es_2": {"coverage": 0.916, "n_defined": 1000, "n_fit": 1000, "n_reject": 82, "rejection_mc_se": 0.008676, "rejection_rate": 0.082, "share_undefined": 0.0}, "es_3": {"coverage": 0.892, "n_defined": 1000, "n_fit": 1000, "n_reject": 107, "rejection_mc_se": 0.009775, "rejection_rate": 0.107, "share_undefined": 0.0}, "es_4": {"coverage": 0.872, "n_defined": 1000, "n_fit": 1000, "n_reject": 125, "rejection_mc_se": 0.010458, "rejection_rate": 0.125, "share_undefined": 0.0}, "overall": {"coverage": 0.918, "n_defined": 1000, "n_fit": 1000, "n_reject": 80, "rejection_mc_se": 0.008579, "rejection_rate": 0.08, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 189, "rejection_mc_se": 0.012381, "rejection_rate": 0.189, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 234, "rejection_mc_se": 0.013388, "rejection_rate": 0.234, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.932, "n_defined": 1000, "n_fit": 1000, "n_reject": 68, "rejection_mc_se": 0.007961, "rejection_rate": 0.068, "share_undefined": 0.0}, "es_0": {"coverage": 0.949, "n_defined": 1000, "n_fit": 1000, "n_reject": 51, "rejection_mc_se": 0.006957, "rejection_rate": 0.051, "share_undefined": 0.0}, "es_1": {"coverage": 0.935, "n_defined": 1000, "n_fit": 1000, "n_reject": 65, "rejection_mc_se": 0.007796, "rejection_rate": 0.065, "share_undefined": 0.0}, "es_2": {"coverage": 0.946, "n_defined": 1000, "n_fit": 1000, "n_reject": 54, "rejection_mc_se": 0.007147, "rejection_rate": 0.054, "share_undefined": 0.0}, "es_3": {"coverage": 0.921, "n_defined": 1000, "n_fit": 1000, "n_reject": 79, "rejection_mc_se": 0.00853, "rejection_rate": 0.079, "share_undefined": 0.0}, "es_4": {"coverage": 0.9, "n_defined": 1000, "n_fit": 1000, "n_reject": 100, "rejection_mc_se": 0.009487, "rejection_rate": 0.1, "share_undefined": 0.0}, "overall": {"coverage": 0.942, "n_defined": 1000, "n_fit": 1000, "n_reject": 58, "rejection_mc_se": 0.007392, "rejection_rate": 0.058, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 100, "rejection_mc_se": 0.009487, "rejection_rate": 0.1, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 225, "rejection_mc_se": 0.013205, "rejection_rate": 0.225, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.942, "n_defined": 1000, "n_fit": 1000, "n_reject": 58, "rejection_mc_se": 0.007392, "rejection_rate": 0.058, "share_undefined": 0.0}, "es_0": {"coverage": 0.961, "n_defined": 1000, "n_fit": 1000, "n_reject": 39, "rejection_mc_se": 0.006122, "rejection_rate": 0.039, "share_undefined": 0.0}, "es_1": {"coverage": 0.947, "n_defined": 1000, "n_fit": 1000, "n_reject": 53, "rejection_mc_se": 0.007085, "rejection_rate": 0.053, "share_undefined": 0.0}, "es_2": {"coverage": 0.958, "n_defined": 1000, "n_fit": 1000, "n_reject": 42, "rejection_mc_se": 0.006343, "rejection_rate": 0.042, "share_undefined": 0.0}, "es_3": {"coverage": 0.94, "n_defined": 1000, "n_fit": 1000, "n_reject": 60, "rejection_mc_se": 0.00751, "rejection_rate": 0.06, "share_undefined": 0.0}, "es_4": {"coverage": 0.926, "n_defined": 1000, "n_fit": 1000, "n_reject": 74, "rejection_mc_se": 0.008278, "rejection_rate": 0.074, "share_undefined": 0.0}, "overall": {"coverage": 0.952, "n_defined": 1000, "n_fit": 1000, "n_reject": 48, "rejection_mc_se": 0.00676, "rejection_rate": 0.048, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 66, "rejection_mc_se": 0.007851, "rejection_rate": 0.066, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 172, "rejection_mc_se": 0.011934, "rejection_rate": 0.172, "share_undefined": 0.0}}}, "seconds": 305.9, "units_per_cluster": 1}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [], "index": 18, "n_clusters": 32, "n_replications": 1000, "n_treated_per_cohort": 8, "results": {"bootstrap": {"es_-2": {"coverage": 0.93, "n_defined": 1000, "n_fit": 1000, "n_reject": 66, "rejection_mc_se": 0.007851, "rejection_rate": 0.066, "share_undefined": 0.0}, "es_0": {"coverage": 0.935, "n_defined": 1000, "n_fit": 1000, "n_reject": 62, "rejection_mc_se": 0.007626, "rejection_rate": 0.062, "share_undefined": 0.0}, "es_1": {"coverage": 0.927, "n_defined": 1000, "n_fit": 1000, "n_reject": 72, "rejection_mc_se": 0.008174, "rejection_rate": 0.072, "share_undefined": 0.0}, "es_2": {"coverage": 0.922, "n_defined": 1000, "n_fit": 1000, "n_reject": 77, "rejection_mc_se": 0.00843, "rejection_rate": 0.077, "share_undefined": 0.0}, "es_3": {"coverage": 0.914, "n_defined": 1000, "n_fit": 1000, "n_reject": 84, "rejection_mc_se": 0.008772, "rejection_rate": 0.084, "share_undefined": 0.0}, "es_4": {"coverage": 0.917, "n_defined": 1000, "n_fit": 1000, "n_reject": 81, "rejection_mc_se": 0.008628, "rejection_rate": 0.081, "share_undefined": 0.0}, "overall": {"coverage": 0.929, "n_defined": 1000, "n_fit": 1000, "n_reject": 70, "rejection_mc_se": 0.008068, "rejection_rate": 0.07, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 125, "rejection_mc_se": 0.010458, "rejection_rate": 0.125, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 158, "rejection_mc_se": 0.011534, "rejection_rate": 0.158, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.948, "n_defined": 1000, "n_fit": 1000, "n_reject": 52, "rejection_mc_se": 0.007021, "rejection_rate": 0.052, "share_undefined": 0.0}, "es_0": {"coverage": 0.952, "n_defined": 1000, "n_fit": 1000, "n_reject": 48, "rejection_mc_se": 0.00676, "rejection_rate": 0.048, "share_undefined": 0.0}, "es_1": {"coverage": 0.945, "n_defined": 1000, "n_fit": 1000, "n_reject": 55, "rejection_mc_se": 0.007209, "rejection_rate": 0.055, "share_undefined": 0.0}, "es_2": {"coverage": 0.948, "n_defined": 1000, "n_fit": 1000, "n_reject": 52, "rejection_mc_se": 0.007021, "rejection_rate": 0.052, "share_undefined": 0.0}, "es_3": {"coverage": 0.938, "n_defined": 1000, "n_fit": 1000, "n_reject": 62, "rejection_mc_se": 0.007626, "rejection_rate": 0.062, "share_undefined": 0.0}, "es_4": {"coverage": 0.936, "n_defined": 1000, "n_fit": 1000, "n_reject": 64, "rejection_mc_se": 0.00774, "rejection_rate": 0.064, "share_undefined": 0.0}, "overall": {"coverage": 0.953, "n_defined": 1000, "n_fit": 1000, "n_reject": 47, "rejection_mc_se": 0.006693, "rejection_rate": 0.047, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 61, "rejection_mc_se": 0.007568, "rejection_rate": 0.061, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 142, "rejection_mc_se": 0.011038, "rejection_rate": 0.142, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.956, "n_defined": 1000, "n_fit": 1000, "n_reject": 44, "rejection_mc_se": 0.006486, "rejection_rate": 0.044, "share_undefined": 0.0}, "es_0": {"coverage": 0.957, "n_defined": 1000, "n_fit": 1000, "n_reject": 43, "rejection_mc_se": 0.006415, "rejection_rate": 0.043, "share_undefined": 0.0}, "es_1": {"coverage": 0.953, "n_defined": 1000, "n_fit": 1000, "n_reject": 47, "rejection_mc_se": 0.006693, "rejection_rate": 0.047, "share_undefined": 0.0}, "es_2": {"coverage": 0.952, "n_defined": 1000, "n_fit": 1000, "n_reject": 48, "rejection_mc_se": 0.00676, "rejection_rate": 0.048, "share_undefined": 0.0}, "es_3": {"coverage": 0.954, "n_defined": 1000, "n_fit": 1000, "n_reject": 46, "rejection_mc_se": 0.006624, "rejection_rate": 0.046, "share_undefined": 0.0}, "es_4": {"coverage": 0.951, "n_defined": 1000, "n_fit": 1000, "n_reject": 49, "rejection_mc_se": 0.006826, "rejection_rate": 0.049, "share_undefined": 0.0}, "overall": {"coverage": 0.955, "n_defined": 1000, "n_fit": 1000, "n_reject": 45, "rejection_mc_se": 0.006556, "rejection_rate": 0.045, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 45, "rejection_mc_se": 0.006556, "rejection_rate": 0.045, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 117, "rejection_mc_se": 0.010164, "rejection_rate": 0.117, "share_undefined": 0.0}}}, "seconds": 307.8, "units_per_cluster": 1}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [], "index": 19, "n_clusters": 32, "n_replications": 1000, "n_treated_per_cohort": 10, "results": {"bootstrap": {"es_-2": {"coverage": 0.93, "n_defined": 1000, "n_fit": 1000, "n_reject": 66, "rejection_mc_se": 0.007851, "rejection_rate": 0.066, "share_undefined": 0.0}, "es_0": {"coverage": 0.916, "n_defined": 1000, "n_fit": 1000, "n_reject": 82, "rejection_mc_se": 0.008676, "rejection_rate": 0.082, "share_undefined": 0.0}, "es_1": {"coverage": 0.934, "n_defined": 1000, "n_fit": 1000, "n_reject": 64, "rejection_mc_se": 0.00774, "rejection_rate": 0.064, "share_undefined": 0.0}, "es_2": {"coverage": 0.927, "n_defined": 1000, "n_fit": 1000, "n_reject": 70, "rejection_mc_se": 0.008068, "rejection_rate": 0.07, "share_undefined": 0.0}, "es_3": {"coverage": 0.918, "n_defined": 1000, "n_fit": 1000, "n_reject": 81, "rejection_mc_se": 0.008628, "rejection_rate": 0.081, "share_undefined": 0.0}, "es_4": {"coverage": 0.908, "n_defined": 1000, "n_fit": 1000, "n_reject": 91, "rejection_mc_se": 0.009095, "rejection_rate": 0.091, "share_undefined": 0.0}, "overall": {"coverage": 0.918, "n_defined": 1000, "n_fit": 1000, "n_reject": 81, "rejection_mc_se": 0.008628, "rejection_rate": 0.081, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 130, "rejection_mc_se": 0.010635, "rejection_rate": 0.13, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 137, "rejection_mc_se": 0.010873, "rejection_rate": 0.137, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.946, "n_defined": 1000, "n_fit": 1000, "n_reject": 54, "rejection_mc_se": 0.007147, "rejection_rate": 0.054, "share_undefined": 0.0}, "es_0": {"coverage": 0.939, "n_defined": 1000, "n_fit": 1000, "n_reject": 61, "rejection_mc_se": 0.007568, "rejection_rate": 0.061, "share_undefined": 0.0}, "es_1": {"coverage": 0.95, "n_defined": 1000, "n_fit": 1000, "n_reject": 50, "rejection_mc_se": 0.006892, "rejection_rate": 0.05, "share_undefined": 0.0}, "es_2": {"coverage": 0.951, "n_defined": 1000, "n_fit": 1000, "n_reject": 49, "rejection_mc_se": 0.006826, "rejection_rate": 0.049, "share_undefined": 0.0}, "es_3": {"coverage": 0.93, "n_defined": 1000, "n_fit": 1000, "n_reject": 70, "rejection_mc_se": 0.008068, "rejection_rate": 0.07, "share_undefined": 0.0}, "es_4": {"coverage": 0.93, "n_defined": 1000, "n_fit": 1000, "n_reject": 70, "rejection_mc_se": 0.008068, "rejection_rate": 0.07, "share_undefined": 0.0}, "overall": {"coverage": 0.947, "n_defined": 1000, "n_fit": 1000, "n_reject": 53, "rejection_mc_se": 0.007085, "rejection_rate": 0.053, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 72, "rejection_mc_se": 0.008174, "rejection_rate": 0.072, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 128, "rejection_mc_se": 0.010565, "rejection_rate": 0.128, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.951, "n_defined": 1000, "n_fit": 1000, "n_reject": 49, "rejection_mc_se": 0.006826, "rejection_rate": 0.049, "share_undefined": 0.0}, "es_0": {"coverage": 0.944, "n_defined": 1000, "n_fit": 1000, "n_reject": 56, "rejection_mc_se": 0.007271, "rejection_rate": 0.056, "share_undefined": 0.0}, "es_1": {"coverage": 0.956, "n_defined": 1000, "n_fit": 1000, "n_reject": 44, "rejection_mc_se": 0.006486, "rejection_rate": 0.044, "share_undefined": 0.0}, "es_2": {"coverage": 0.963, "n_defined": 1000, "n_fit": 1000, "n_reject": 37, "rejection_mc_se": 0.005969, "rejection_rate": 0.037, "share_undefined": 0.0}, "es_3": {"coverage": 0.947, "n_defined": 1000, "n_fit": 1000, "n_reject": 53, "rejection_mc_se": 0.007085, "rejection_rate": 0.053, "share_undefined": 0.0}, "es_4": {"coverage": 0.945, "n_defined": 1000, "n_fit": 1000, "n_reject": 55, "rejection_mc_se": 0.007209, "rejection_rate": 0.055, "share_undefined": 0.0}, "overall": {"coverage": 0.958, "n_defined": 1000, "n_fit": 1000, "n_reject": 42, "rejection_mc_se": 0.006343, "rejection_rate": 0.042, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 53, "rejection_mc_se": 0.007085, "rejection_rate": 0.053, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 90, "rejection_mc_se": 0.00905, "rejection_rate": 0.09, "share_undefined": 0.0}}}, "seconds": 289.9, "units_per_cluster": 1}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [], "index": 20, "n_clusters": 32, "n_replications": 1000, "n_treated_per_cohort": 12, "results": {"bootstrap": {"es_-2": {"coverage": 0.929, "n_defined": 1000, "n_fit": 1000, "n_reject": 66, "rejection_mc_se": 0.007851, "rejection_rate": 0.066, "share_undefined": 0.0}, "es_0": {"coverage": 0.927, "n_defined": 1000, "n_fit": 1000, "n_reject": 71, "rejection_mc_se": 0.008122, "rejection_rate": 0.071, "share_undefined": 0.0}, "es_1": {"coverage": 0.913, "n_defined": 1000, "n_fit": 1000, "n_reject": 83, "rejection_mc_se": 0.008724, "rejection_rate": 0.083, "share_undefined": 0.0}, "es_2": {"coverage": 0.914, "n_defined": 1000, "n_fit": 1000, "n_reject": 86, "rejection_mc_se": 0.008866, "rejection_rate": 0.086, "share_undefined": 0.0}, "es_3": {"coverage": 0.891, "n_defined": 1000, "n_fit": 1000, "n_reject": 107, "rejection_mc_se": 0.009775, "rejection_rate": 0.107, "share_undefined": 0.0}, "es_4": {"coverage": 0.914, "n_defined": 1000, "n_fit": 1000, "n_reject": 86, "rejection_mc_se": 0.008866, "rejection_rate": 0.086, "share_undefined": 0.0}, "overall": {"coverage": 0.9, "n_defined": 1000, "n_fit": 1000, "n_reject": 97, "rejection_mc_se": 0.009359, "rejection_rate": 0.097, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 127, "rejection_mc_se": 0.01053, "rejection_rate": 0.127, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 173, "rejection_mc_se": 0.011961, "rejection_rate": 0.173, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.948, "n_defined": 1000, "n_fit": 1000, "n_reject": 52, "rejection_mc_se": 0.007021, "rejection_rate": 0.052, "share_undefined": 0.0}, "es_0": {"coverage": 0.953, "n_defined": 1000, "n_fit": 1000, "n_reject": 47, "rejection_mc_se": 0.006693, "rejection_rate": 0.047, "share_undefined": 0.0}, "es_1": {"coverage": 0.936, "n_defined": 1000, "n_fit": 1000, "n_reject": 64, "rejection_mc_se": 0.00774, "rejection_rate": 0.064, "share_undefined": 0.0}, "es_2": {"coverage": 0.934, "n_defined": 1000, "n_fit": 1000, "n_reject": 66, "rejection_mc_se": 0.007851, "rejection_rate": 0.066, "share_undefined": 0.0}, "es_3": {"coverage": 0.92, "n_defined": 1000, "n_fit": 1000, "n_reject": 80, "rejection_mc_se": 0.008579, "rejection_rate": 0.08, "share_undefined": 0.0}, "es_4": {"coverage": 0.927, "n_defined": 1000, "n_fit": 1000, "n_reject": 73, "rejection_mc_se": 0.008226, "rejection_rate": 0.073, "share_undefined": 0.0}, "overall": {"coverage": 0.926, "n_defined": 1000, "n_fit": 1000, "n_reject": 74, "rejection_mc_se": 0.008278, "rejection_rate": 0.074, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 67, "rejection_mc_se": 0.007906, "rejection_rate": 0.067, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 156, "rejection_mc_se": 0.011474, "rejection_rate": 0.156, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.96, "n_defined": 1000, "n_fit": 1000, "n_reject": 40, "rejection_mc_se": 0.006197, "rejection_rate": 0.04, "share_undefined": 0.0}, "es_0": {"coverage": 0.96, "n_defined": 1000, "n_fit": 1000, "n_reject": 40, "rejection_mc_se": 0.006197, "rejection_rate": 0.04, "share_undefined": 0.0}, "es_1": {"coverage": 0.953, "n_defined": 1000, "n_fit": 1000, "n_reject": 47, "rejection_mc_se": 0.006693, "rejection_rate": 0.047, "share_undefined": 0.0}, "es_2": {"coverage": 0.946, "n_defined": 1000, "n_fit": 1000, "n_reject": 54, "rejection_mc_se": 0.007147, "rejection_rate": 0.054, "share_undefined": 0.0}, "es_3": {"coverage": 0.942, "n_defined": 1000, "n_fit": 1000, "n_reject": 58, "rejection_mc_se": 0.007392, "rejection_rate": 0.058, "share_undefined": 0.0}, "es_4": {"coverage": 0.942, "n_defined": 1000, "n_fit": 1000, "n_reject": 58, "rejection_mc_se": 0.007392, "rejection_rate": 0.058, "share_undefined": 0.0}, "overall": {"coverage": 0.945, "n_defined": 1000, "n_fit": 1000, "n_reject": 55, "rejection_mc_se": 0.007209, "rejection_rate": 0.055, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 35, "rejection_mc_se": 0.005812, "rejection_rate": 0.035, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 114, "rejection_mc_se": 0.01005, "rejection_rate": 0.114, "share_undefined": 0.0}}}, "seconds": 288.9, "units_per_cluster": 1}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [{"overall": 0.082, "quantity": "es_1", "rejection_rate": 0.113}], "index": 21, "n_clusters": 8, "n_replications": 1000, "n_treated_per_cohort": 1, "results": {"bootstrap": {"es_-2": {"coverage": 0.719, "n_defined": 1000, "n_fit": 1000, "n_reject": 280, "rejection_mc_se": 0.014199, "rejection_rate": 0.28, "share_undefined": 0.0}, "es_0": {"coverage": 0.726, "n_defined": 1000, "n_fit": 1000, "n_reject": 273, "rejection_mc_se": 0.014088, "rejection_rate": 0.273, "share_undefined": 0.0}, "es_1": {"coverage": 0.722, "n_defined": 1000, "n_fit": 1000, "n_reject": 278, "rejection_mc_se": 0.014167, "rejection_rate": 0.278, "share_undefined": 0.0}, "es_2": {"coverage": 0.699, "n_defined": 1000, "n_fit": 1000, "n_reject": 299, "rejection_mc_se": 0.014478, "rejection_rate": 0.299, "share_undefined": 0.0}, "es_3": {"coverage": 0.438, "n_defined": 1000, "n_fit": 1000, "n_reject": 560, "rejection_mc_se": 0.015697, "rejection_rate": 0.56, "share_undefined": 0.0}, "es_4": {"coverage": 0.418, "n_defined": 1000, "n_fit": 1000, "n_reject": 580, "rejection_mc_se": 0.015608, "rejection_rate": 0.58, "share_undefined": 0.0}, "overall": {"coverage": 0.712, "n_defined": 1000, "n_fit": 1000, "n_reject": 286, "rejection_mc_se": 0.01429, "rejection_rate": 0.286, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 855, "rejection_mc_se": 0.011134, "rejection_rate": 0.855, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 926, "rejection_mc_se": 0.008278, "rejection_rate": 0.926, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.814, "n_defined": 1000, "n_fit": 1000, "n_reject": 186, "rejection_mc_se": 0.012305, "rejection_rate": 0.186, "share_undefined": 0.0}, "es_0": {"coverage": 0.823, "n_defined": 1000, "n_fit": 1000, "n_reject": 177, "rejection_mc_se": 0.012069, "rejection_rate": 0.177, "share_undefined": 0.0}, "es_1": {"coverage": 0.815, "n_defined": 1000, "n_fit": 1000, "n_reject": 185, "rejection_mc_se": 0.012279, "rejection_rate": 0.185, "share_undefined": 0.0}, "es_2": {"coverage": 0.82, "n_defined": 1000, "n_fit": 1000, "n_reject": 180, "rejection_mc_se": 0.012149, "rejection_rate": 0.18, "share_undefined": 0.0}, "es_3": {"coverage": 0.577, "n_defined": 1000, "n_fit": 1000, "n_reject": 423, "rejection_mc_se": 0.015623, "rejection_rate": 0.423, "share_undefined": 0.0}, "es_4": {"coverage": 0.539, "n_defined": 1000, "n_fit": 1000, "n_reject": 461, "rejection_mc_se": 0.015763, "rejection_rate": 0.461, "share_undefined": 0.0}, "overall": {"coverage": 0.829, "n_defined": 1000, "n_fit": 1000, "n_reject": 171, "rejection_mc_se": 0.011906, "rejection_rate": 0.171, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 563, "rejection_mc_se": 0.015685, "rejection_rate": 0.563, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 915, "rejection_mc_se": 0.008819, "rejection_rate": 0.915, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.892, "n_defined": 1000, "n_fit": 1000, "n_reject": 108, "rejection_mc_se": 0.009815, "rejection_rate": 0.108, "share_undefined": 0.0}, "es_0": {"coverage": 0.898, "n_defined": 1000, "n_fit": 1000, "n_reject": 102, "rejection_mc_se": 0.009571, "rejection_rate": 0.102, "share_undefined": 0.0}, "es_1": {"coverage": 0.887, "n_defined": 1000, "n_fit": 1000, "n_reject": 113, "rejection_mc_se": 0.010012, "rejection_rate": 0.113, "share_undefined": 0.0}, "es_2": {"coverage": 0.888, "n_defined": 1000, "n_fit": 1000, "n_reject": 112, "rejection_mc_se": 0.009973, "rejection_rate": 0.112, "share_undefined": 0.0}, "es_3": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}, "es_4": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}, "overall": {"coverage": 0.918, "n_defined": 1000, "n_fit": 1000, "n_reject": 82, "rejection_mc_se": 0.008676, "rejection_rate": 0.082, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}}}, "seconds": 108.6, "units_per_cluster": 5}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [{"overall": 0.031, "quantity": "es_3", "rejection_rate": 0.072}, {"overall": 0.031, "quantity": "es_4", "rejection_rate": 0.065}, {"overall": 0.031, "quantity": "pretrend_bonferroni", "rejection_rate": 0.096}], "index": 22, "n_clusters": 8, "n_replications": 1000, "n_treated_per_cohort": 2, "results": {"bootstrap": {"es_-2": {"coverage": 0.852, "n_defined": 1000, "n_fit": 1000, "n_reject": 148, "rejection_mc_se": 0.011229, "rejection_rate": 0.148, "share_undefined": 0.0}, "es_0": {"coverage": 0.87, "n_defined": 1000, "n_fit": 1000, "n_reject": 128, "rejection_mc_se": 0.010565, "rejection_rate": 0.128, "share_undefined": 0.0}, "es_1": {"coverage": 0.865, "n_defined": 1000, "n_fit": 1000, "n_reject": 133, "rejection_mc_se": 0.010738, "rejection_rate": 0.133, "share_undefined": 0.0}, "es_2": {"coverage": 0.862, "n_defined": 1000, "n_fit": 1000, "n_reject": 138, "rejection_mc_se": 0.010907, "rejection_rate": 0.138, "share_undefined": 0.0}, "es_3": {"coverage": 0.747, "n_defined": 1000, "n_fit": 1000, "n_reject": 252, "rejection_mc_se": 0.013729, "rejection_rate": 0.252, "share_undefined": 0.0}, "es_4": {"coverage": 0.766, "n_defined": 1000, "n_fit": 1000, "n_reject": 233, "rejection_mc_se": 0.013368, "rejection_rate": 0.233, "share_undefined": 0.0}, "overall": {"coverage": 0.863, "n_defined": 1000, "n_fit": 1000, "n_reject": 136, "rejection_mc_se": 0.01084, "rejection_rate": 0.136, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 475, "rejection_mc_se": 0.015792, "rejection_rate": 0.475, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 665, "rejection_mc_se": 0.014926, "rejection_rate": 0.665, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.933, "n_defined": 1000, "n_fit": 1000, "n_reject": 67, "rejection_mc_se": 0.007906, "rejection_rate": 0.067, "share_undefined": 0.0}, "es_0": {"coverage": 0.94, "n_defined": 1000, "n_fit": 1000, "n_reject": 60, "rejection_mc_se": 0.00751, "rejection_rate": 0.06, "share_undefined": 0.0}, "es_1": {"coverage": 0.944, "n_defined": 1000, "n_fit": 1000, "n_reject": 56, "rejection_mc_se": 0.007271, "rejection_rate": 0.056, "share_undefined": 0.0}, "es_2": {"coverage": 0.946, "n_defined": 1000, "n_fit": 1000, "n_reject": 54, "rejection_mc_se": 0.007147, "rejection_rate": 0.054, "share_undefined": 0.0}, "es_3": {"coverage": 0.859, "n_defined": 1000, "n_fit": 1000, "n_reject": 141, "rejection_mc_se": 0.011005, "rejection_rate": 0.141, "share_undefined": 0.0}, "es_4": {"coverage": 0.865, "n_defined": 1000, "n_fit": 1000, "n_reject": 135, "rejection_mc_se": 0.010806, "rejection_rate": 0.135, "share_undefined": 0.0}, "overall": {"coverage": 0.946, "n_defined": 1000, "n_fit": 1000, "n_reject": 54, "rejection_mc_se": 0.007147, "rejection_rate": 0.054, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 173, "rejection_mc_se": 0.011961, "rejection_rate": 0.173, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 622, "rejection_mc_se": 0.015333, "rejection_rate": 0.622, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.959, "n_defined": 1000, "n_fit": 1000, "n_reject": 41, "rejection_mc_se": 0.00627, "rejection_rate": 0.041, "share_undefined": 0.0}, "es_0": {"coverage": 0.962, "n_defined": 1000, "n_fit": 1000, "n_reject": 38, "rejection_mc_se": 0.006046, "rejection_rate": 0.038, "share_undefined": 0.0}, "es_1": {"coverage": 0.964, "n_defined": 1000, "n_fit": 1000, "n_reject": 36, "rejection_mc_se": 0.005891, "rejection_rate": 0.036, "share_undefined": 0.0}, "es_2": {"coverage": 0.971, "n_defined": 1000, "n_fit": 1000, "n_reject": 29, "rejection_mc_se": 0.005307, "rejection_rate": 0.029, "share_undefined": 0.0}, "es_3": {"coverage": 0.928, "n_defined": 1000, "n_fit": 1000, "n_reject": 72, "rejection_mc_se": 0.008174, "rejection_rate": 0.072, "share_undefined": 0.0}, "es_4": {"coverage": 0.935, "n_defined": 1000, "n_fit": 1000, "n_reject": 65, "rejection_mc_se": 0.007796, "rejection_rate": 0.065, "share_undefined": 0.0}, "overall": {"coverage": 0.969, "n_defined": 1000, "n_fit": 1000, "n_reject": 31, "rejection_mc_se": 0.005481, "rejection_rate": 0.031, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 96, "rejection_mc_se": 0.009316, "rejection_rate": 0.096, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 489, "rejection_mc_se": 0.015808, "rejection_rate": 0.489, "share_undefined": 0.0}}}, "seconds": 112.6, "units_per_cluster": 5}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [], "index": 23, "n_clusters": 8, "n_replications": 1000, "n_treated_per_cohort": 3, "results": {"bootstrap": {"es_-2": {"coverage": 0.825, "n_defined": 1000, "n_fit": 1000, "n_reject": 172, "rejection_mc_se": 0.011934, "rejection_rate": 0.172, "share_undefined": 0.0}, "es_0": {"coverage": 0.825, "n_defined": 1000, "n_fit": 1000, "n_reject": 172, "rejection_mc_se": 0.011934, "rejection_rate": 0.172, "share_undefined": 0.0}, "es_1": {"coverage": 0.85, "n_defined": 1000, "n_fit": 1000, "n_reject": 148, "rejection_mc_se": 0.011229, "rejection_rate": 0.148, "share_undefined": 0.0}, "es_2": {"coverage": 0.818, "n_defined": 1000, "n_fit": 1000, "n_reject": 179, "rejection_mc_se": 0.012123, "rejection_rate": 0.179, "share_undefined": 0.0}, "es_3": {"coverage": 0.721, "n_defined": 1000, "n_fit": 1000, "n_reject": 276, "rejection_mc_se": 0.014136, "rejection_rate": 0.276, "share_undefined": 0.0}, "es_4": {"coverage": 0.737, "n_defined": 1000, "n_fit": 1000, "n_reject": 262, "rejection_mc_se": 0.013905, "rejection_rate": 0.262, "share_undefined": 0.0}, "overall": {"coverage": 0.792, "n_defined": 1000, "n_fit": 1000, "n_reject": 204, "rejection_mc_se": 0.012743, "rejection_rate": 0.204, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 529, "rejection_mc_se": 0.015785, "rejection_rate": 0.529, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 708, "rejection_mc_se": 0.014378, "rejection_rate": 0.708, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.917, "n_defined": 1000, "n_fit": 1000, "n_reject": 83, "rejection_mc_se": 0.008724, "rejection_rate": 0.083, "share_undefined": 0.0}, "es_0": {"coverage": 0.924, "n_defined": 1000, "n_fit": 1000, "n_reject": 76, "rejection_mc_se": 0.00838, "rejection_rate": 0.076, "share_undefined": 0.0}, "es_1": {"coverage": 0.934, "n_defined": 1000, "n_fit": 1000, "n_reject": 66, "rejection_mc_se": 0.007851, "rejection_rate": 0.066, "share_undefined": 0.0}, "es_2": {"coverage": 0.908, "n_defined": 1000, "n_fit": 1000, "n_reject": 92, "rejection_mc_se": 0.00914, "rejection_rate": 0.092, "share_undefined": 0.0}, "es_3": {"coverage": 0.845, "n_defined": 1000, "n_fit": 1000, "n_reject": 155, "rejection_mc_se": 0.011444, "rejection_rate": 0.155, "share_undefined": 0.0}, "es_4": {"coverage": 0.833, "n_defined": 1000, "n_fit": 1000, "n_reject": 167, "rejection_mc_se": 0.011795, "rejection_rate": 0.167, "share_undefined": 0.0}, "overall": {"coverage": 0.901, "n_defined": 1000, "n_fit": 1000, "n_reject": 99, "rejection_mc_se": 0.009445, "rejection_rate": 0.099, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 172, "rejection_mc_se": 0.011934, "rejection_rate": 0.172, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 666, "rejection_mc_se": 0.014915, "rejection_rate": 0.666, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.958, "n_defined": 1000, "n_fit": 1000, "n_reject": 42, "rejection_mc_se": 0.006343, "rejection_rate": 0.042, "share_undefined": 0.0}, "es_0": {"coverage": 0.955, "n_defined": 1000, "n_fit": 1000, "n_reject": 45, "rejection_mc_se": 0.006556, "rejection_rate": 0.045, "share_undefined": 0.0}, "es_1": {"coverage": 0.965, "n_defined": 1000, "n_fit": 1000, "n_reject": 35, "rejection_mc_se": 0.005812, "rejection_rate": 0.035, "share_undefined": 0.0}, "es_2": {"coverage": 0.952, "n_defined": 1000, "n_fit": 1000, "n_reject": 48, "rejection_mc_se": 0.00676, "rejection_rate": 0.048, "share_undefined": 0.0}, "es_3": {"coverage": 0.935, "n_defined": 1000, "n_fit": 1000, "n_reject": 65, "rejection_mc_se": 0.007796, "rejection_rate": 0.065, "share_undefined": 0.0}, "es_4": {"coverage": 0.932, "n_defined": 1000, "n_fit": 1000, "n_reject": 68, "rejection_mc_se": 0.007961, "rejection_rate": 0.068, "share_undefined": 0.0}, "overall": {"coverage": 0.947, "n_defined": 1000, "n_fit": 1000, "n_reject": 53, "rejection_mc_se": 0.007085, "rejection_rate": 0.053, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 74, "rejection_mc_se": 0.008278, "rejection_rate": 0.074, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 569, "rejection_mc_se": 0.01566, "rejection_rate": 0.569, "share_undefined": 0.0}}}, "seconds": 112.8, "units_per_cluster": 5}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [{"overall": 0.124, "quantity": "es_0", "rejection_rate": 0.16}], "index": 24, "n_clusters": 16, "n_replications": 1000, "n_treated_per_cohort": 1, "results": {"bootstrap": {"es_-2": {"coverage": 0.679, "n_defined": 1000, "n_fit": 1000, "n_reject": 318, "rejection_mc_se": 0.014727, "rejection_rate": 0.318, "share_undefined": 0.0}, "es_0": {"coverage": 0.652, "n_defined": 1000, "n_fit": 1000, "n_reject": 348, "rejection_mc_se": 0.015063, "rejection_rate": 0.348, "share_undefined": 0.0}, "es_1": {"coverage": 0.655, "n_defined": 1000, "n_fit": 1000, "n_reject": 343, "rejection_mc_se": 0.015012, "rejection_rate": 0.343, "share_undefined": 0.0}, "es_2": {"coverage": 0.67, "n_defined": 1000, "n_fit": 1000, "n_reject": 328, "rejection_mc_se": 0.014846, "rejection_rate": 0.328, "share_undefined": 0.0}, "es_3": {"coverage": 0.343, "n_defined": 1000, "n_fit": 1000, "n_reject": 654, "rejection_mc_se": 0.015043, "rejection_rate": 0.654, "share_undefined": 0.0}, "es_4": {"coverage": 0.354, "n_defined": 1000, "n_fit": 1000, "n_reject": 645, "rejection_mc_se": 0.015132, "rejection_rate": 0.645, "share_undefined": 0.0}, "overall": {"coverage": 0.665, "n_defined": 1000, "n_fit": 1000, "n_reject": 334, "rejection_mc_se": 0.014915, "rejection_rate": 0.334, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 906, "rejection_mc_se": 0.009228, "rejection_rate": 0.906, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 944, "rejection_mc_se": 0.007271, "rejection_rate": 0.944, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.753, "n_defined": 1000, "n_fit": 1000, "n_reject": 247, "rejection_mc_se": 0.013638, "rejection_rate": 0.247, "share_undefined": 0.0}, "es_0": {"coverage": 0.738, "n_defined": 1000, "n_fit": 1000, "n_reject": 262, "rejection_mc_se": 0.013905, "rejection_rate": 0.262, "share_undefined": 0.0}, "es_1": {"coverage": 0.72, "n_defined": 1000, "n_fit": 1000, "n_reject": 280, "rejection_mc_se": 0.014199, "rejection_rate": 0.28, "share_undefined": 0.0}, "es_2": {"coverage": 0.738, "n_defined": 1000, "n_fit": 1000, "n_reject": 262, "rejection_mc_se": 0.013905, "rejection_rate": 0.262, "share_undefined": 0.0}, "es_3": {"coverage": 0.399, "n_defined": 1000, "n_fit": 1000, "n_reject": 601, "rejection_mc_se": 0.015485, "rejection_rate": 0.601, "share_undefined": 0.0}, "es_4": {"coverage": 0.406, "n_defined": 1000, "n_fit": 1000, "n_reject": 594, "rejection_mc_se": 0.015529, "rejection_rate": 0.594, "share_undefined": 0.0}, "overall": {"coverage": 0.744, "n_defined": 1000, "n_fit": 1000, "n_reject": 256, "rejection_mc_se": 0.013801, "rejection_rate": 0.256, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 805, "rejection_mc_se": 0.012529, "rejection_rate": 0.805, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 940, "rejection_mc_se": 0.00751, "rejection_rate": 0.94, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.856, "n_defined": 1000, "n_fit": 1000, "n_reject": 144, "rejection_mc_se": 0.011102, "rejection_rate": 0.144, "share_undefined": 0.0}, "es_0": {"coverage": 0.84, "n_defined": 1000, "n_fit": 1000, "n_reject": 160, "rejection_mc_se": 0.011593, "rejection_rate": 0.16, "share_undefined": 0.0}, "es_1": {"coverage": 0.851, "n_defined": 1000, "n_fit": 1000, "n_reject": 149, "rejection_mc_se": 0.011261, "rejection_rate": 0.149, "share_undefined": 0.0}, "es_2": {"coverage": 0.86, "n_defined": 1000, "n_fit": 1000, "n_reject": 140, "rejection_mc_se": 0.010973, "rejection_rate": 0.14, "share_undefined": 0.0}, "es_3": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}, "es_4": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}, "overall": {"coverage": 0.876, "n_defined": 1000, "n_fit": 1000, "n_reject": 124, "rejection_mc_se": 0.010422, "rejection_rate": 0.124, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}}}, "seconds": 161.1, "units_per_cluster": 5}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [{"overall": 0.08, "quantity": "es_3", "rejection_rate": 0.132}, {"overall": 0.08, "quantity": "es_4", "rejection_rate": 0.129}, {"overall": 0.08, "quantity": "pretrend_bonferroni", "rejection_rate": 0.176}], "index": 25, "n_clusters": 16, "n_replications": 1000, "n_treated_per_cohort": 2, "results": {"bootstrap": {"es_-2": {"coverage": 0.83, "n_defined": 1000, "n_fit": 1000, "n_reject": 170, "rejection_mc_se": 0.011879, "rejection_rate": 0.17, "share_undefined": 0.0}, "es_0": {"coverage": 0.831, "n_defined": 1000, "n_fit": 1000, "n_reject": 168, "rejection_mc_se": 0.011823, "rejection_rate": 0.168, "share_undefined": 0.0}, "es_1": {"coverage": 0.823, "n_defined": 1000, "n_fit": 1000, "n_reject": 177, "rejection_mc_se": 0.012069, "rejection_rate": 0.177, "share_undefined": 0.0}, "es_2": {"coverage": 0.835, "n_defined": 1000, "n_fit": 1000, "n_reject": 163, "rejection_mc_se": 0.01168, "rejection_rate": 0.163, "share_undefined": 0.0}, "es_3": {"coverage": 0.716, "n_defined": 1000, "n_fit": 1000, "n_reject": 283, "rejection_mc_se": 0.014245, "rejection_rate": 0.283, "share_undefined": 0.0}, "es_4": {"coverage": 0.727, "n_defined": 1000, "n_fit": 1000, "n_reject": 270, "rejection_mc_se": 0.014039, "rejection_rate": 0.27, "share_undefined": 0.0}, "overall": {"coverage": 0.82, "n_defined": 1000, "n_fit": 1000, "n_reject": 175, "rejection_mc_se": 0.012016, "rejection_rate": 0.175, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 504, "rejection_mc_se": 0.015811, "rejection_rate": 0.504, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 708, "rejection_mc_se": 0.014378, "rejection_rate": 0.708, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.887, "n_defined": 1000, "n_fit": 1000, "n_reject": 113, "rejection_mc_se": 0.010012, "rejection_rate": 0.113, "share_undefined": 0.0}, "es_0": {"coverage": 0.88, "n_defined": 1000, "n_fit": 1000, "n_reject": 120, "rejection_mc_se": 0.010276, "rejection_rate": 0.12, "share_undefined": 0.0}, "es_1": {"coverage": 0.886, "n_defined": 1000, "n_fit": 1000, "n_reject": 114, "rejection_mc_se": 0.01005, "rejection_rate": 0.114, "share_undefined": 0.0}, "es_2": {"coverage": 0.891, "n_defined": 1000, "n_fit": 1000, "n_reject": 109, "rejection_mc_se": 0.009855, "rejection_rate": 0.109, "share_undefined": 0.0}, "es_3": {"coverage": 0.771, "n_defined": 1000, "n_fit": 1000, "n_reject": 229, "rejection_mc_se": 0.013288, "rejection_rate": 0.229, "share_undefined": 0.0}, "es_4": {"coverage": 0.784, "n_defined": 1000, "n_fit": 1000, "n_reject": 216, "rejection_mc_se": 0.013013, "rejection_rate": 0.216, "share_undefined": 0.0}, "overall": {"coverage": 0.882, "n_defined": 1000, "n_fit": 1000, "n_reject": 118, "rejection_mc_se": 0.010202, "rejection_rate": 0.118, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 294, "rejection_mc_se": 0.014407, "rejection_rate": 0.294, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 694, "rejection_mc_se": 0.014573, "rejection_rate": 0.694, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.934, "n_defined": 1000, "n_fit": 1000, "n_reject": 66, "rejection_mc_se": 0.007851, "rejection_rate": 0.066, "share_undefined": 0.0}, "es_0": {"coverage": 0.923, "n_defined": 1000, "n_fit": 1000, "n_reject": 77, "rejection_mc_se": 0.00843, "rejection_rate": 0.077, "share_undefined": 0.0}, "es_1": {"coverage": 0.923, "n_defined": 1000, "n_fit": 1000, "n_reject": 77, "rejection_mc_se": 0.00843, "rejection_rate": 0.077, "share_undefined": 0.0}, "es_2": {"coverage": 0.93, "n_defined": 1000, "n_fit": 1000, "n_reject": 70, "rejection_mc_se": 0.008068, "rejection_rate": 0.07, "share_undefined": 0.0}, "es_3": {"coverage": 0.868, "n_defined": 1000, "n_fit": 1000, "n_reject": 132, "rejection_mc_se": 0.010704, "rejection_rate": 0.132, "share_undefined": 0.0}, "es_4": {"coverage": 0.871, "n_defined": 1000, "n_fit": 1000, "n_reject": 129, "rejection_mc_se": 0.0106, "rejection_rate": 0.129, "share_undefined": 0.0}, "overall": {"coverage": 0.92, "n_defined": 1000, "n_fit": 1000, "n_reject": 80, "rejection_mc_se": 0.008579, "rejection_rate": 0.08, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 176, "rejection_mc_se": 0.012043, "rejection_rate": 0.176, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 603, "rejection_mc_se": 0.015472, "rejection_rate": 0.603, "share_undefined": 0.0}}}, "seconds": 165.0, "units_per_cluster": 5}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [], "index": 26, "n_clusters": 16, "n_replications": 1000, "n_treated_per_cohort": 3, "results": {"bootstrap": {"es_-2": {"coverage": 0.897, "n_defined": 1000, "n_fit": 1000, "n_reject": 100, "rejection_mc_se": 0.009487, "rejection_rate": 0.1, "share_undefined": 0.0}, "es_0": {"coverage": 0.87, "n_defined": 1000, "n_fit": 1000, "n_reject": 128, "rejection_mc_se": 0.010565, "rejection_rate": 0.128, "share_undefined": 0.0}, "es_1": {"coverage": 0.891, "n_defined": 1000, "n_fit": 1000, "n_reject": 107, "rejection_mc_se": 0.009775, "rejection_rate": 0.107, "share_undefined": 0.0}, "es_2": {"coverage": 0.88, "n_defined": 1000, "n_fit": 1000, "n_reject": 119, "rejection_mc_se": 0.010239, "rejection_rate": 0.119, "share_undefined": 0.0}, "es_3": {"coverage": 0.825, "n_defined": 1000, "n_fit": 1000, "n_reject": 172, "rejection_mc_se": 0.011934, "rejection_rate": 0.172, "share_undefined": 0.0}, "es_4": {"coverage": 0.803, "n_defined": 1000, "n_fit": 1000, "n_reject": 194, "rejection_mc_se": 0.012505, "rejection_rate": 0.194, "share_undefined": 0.0}, "overall": {"coverage": 0.877, "n_defined": 1000, "n_fit": 1000, "n_reject": 123, "rejection_mc_se": 0.010386, "rejection_rate": 0.123, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 305, "rejection_mc_se": 0.014559, "rejection_rate": 0.305, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 450, "rejection_mc_se": 0.015732, "rejection_rate": 0.45, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.938, "n_defined": 1000, "n_fit": 1000, "n_reject": 62, "rejection_mc_se": 0.007626, "rejection_rate": 0.062, "share_undefined": 0.0}, "es_0": {"coverage": 0.93, "n_defined": 1000, "n_fit": 1000, "n_reject": 70, "rejection_mc_se": 0.008068, "rejection_rate": 0.07, "share_undefined": 0.0}, "es_1": {"coverage": 0.927, "n_defined": 1000, "n_fit": 1000, "n_reject": 73, "rejection_mc_se": 0.008226, "rejection_rate": 0.073, "share_undefined": 0.0}, "es_2": {"coverage": 0.929, "n_defined": 1000, "n_fit": 1000, "n_reject": 71, "rejection_mc_se": 0.008122, "rejection_rate": 0.071, "share_undefined": 0.0}, "es_3": {"coverage": 0.874, "n_defined": 1000, "n_fit": 1000, "n_reject": 126, "rejection_mc_se": 0.010494, "rejection_rate": 0.126, "share_undefined": 0.0}, "es_4": {"coverage": 0.862, "n_defined": 1000, "n_fit": 1000, "n_reject": 138, "rejection_mc_se": 0.010907, "rejection_rate": 0.138, "share_undefined": 0.0}, "overall": {"coverage": 0.92, "n_defined": 1000, "n_fit": 1000, "n_reject": 80, "rejection_mc_se": 0.008579, "rejection_rate": 0.08, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 143, "rejection_mc_se": 0.01107, "rejection_rate": 0.143, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 413, "rejection_mc_se": 0.01557, "rejection_rate": 0.413, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.955, "n_defined": 1000, "n_fit": 1000, "n_reject": 45, "rejection_mc_se": 0.006556, "rejection_rate": 0.045, "share_undefined": 0.0}, "es_0": {"coverage": 0.94, "n_defined": 1000, "n_fit": 1000, "n_reject": 60, "rejection_mc_se": 0.00751, "rejection_rate": 0.06, "share_undefined": 0.0}, "es_1": {"coverage": 0.941, "n_defined": 1000, "n_fit": 1000, "n_reject": 59, "rejection_mc_se": 0.007451, "rejection_rate": 0.059, "share_undefined": 0.0}, "es_2": {"coverage": 0.952, "n_defined": 1000, "n_fit": 1000, "n_reject": 48, "rejection_mc_se": 0.00676, "rejection_rate": 0.048, "share_undefined": 0.0}, "es_3": {"coverage": 0.93, "n_defined": 1000, "n_fit": 1000, "n_reject": 70, "rejection_mc_se": 0.008068, "rejection_rate": 0.07, "share_undefined": 0.0}, "es_4": {"coverage": 0.914, "n_defined": 1000, "n_fit": 1000, "n_reject": 86, "rejection_mc_se": 0.008866, "rejection_rate": 0.086, "share_undefined": 0.0}, "overall": {"coverage": 0.944, "n_defined": 1000, "n_fit": 1000, "n_reject": 56, "rejection_mc_se": 0.007271, "rejection_rate": 0.056, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 83, "rejection_mc_se": 0.008724, "rejection_rate": 0.083, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 303, "rejection_mc_se": 0.014532, "rejection_rate": 0.303, "share_undefined": 0.0}}}, "seconds": 164.7, "units_per_cluster": 5}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [], "index": 27, "n_clusters": 16, "n_replications": 1000, "n_treated_per_cohort": 4, "results": {"bootstrap": {"es_-2": {"coverage": 0.888, "n_defined": 1000, "n_fit": 1000, "n_reject": 111, "rejection_mc_se": 0.009934, "rejection_rate": 0.111, "share_undefined": 0.0}, "es_0": {"coverage": 0.92, "n_defined": 1000, "n_fit": 1000, "n_reject": 78, "rejection_mc_se": 0.00848, "rejection_rate": 0.078, "share_undefined": 0.0}, "es_1": {"coverage": 0.921, "n_defined": 1000, "n_fit": 1000, "n_reject": 78, "rejection_mc_se": 0.00848, "rejection_rate": 0.078, "share_undefined": 0.0}, "es_2": {"coverage": 0.906, "n_defined": 1000, "n_fit": 1000, "n_reject": 92, "rejection_mc_se": 0.00914, "rejection_rate": 0.092, "share_undefined": 0.0}, "es_3": {"coverage": 0.87, "n_defined": 1000, "n_fit": 1000, "n_reject": 128, "rejection_mc_se": 0.010565, "rejection_rate": 0.128, "share_undefined": 0.0}, "es_4": {"coverage": 0.889, "n_defined": 1000, "n_fit": 1000, "n_reject": 108, "rejection_mc_se": 0.009815, "rejection_rate": 0.108, "share_undefined": 0.0}, "overall": {"coverage": 0.907, "n_defined": 1000, "n_fit": 1000, "n_reject": 91, "rejection_mc_se": 0.009095, "rejection_rate": 0.091, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 240, "rejection_mc_se": 0.013506, "rejection_rate": 0.24, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 318, "rejection_mc_se": 0.014727, "rejection_rate": 0.318, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.941, "n_defined": 1000, "n_fit": 1000, "n_reject": 59, "rejection_mc_se": 0.007451, "rejection_rate": 0.059, "share_undefined": 0.0}, "es_0": {"coverage": 0.955, "n_defined": 1000, "n_fit": 1000, "n_reject": 45, "rejection_mc_se": 0.006556, "rejection_rate": 0.045, "share_undefined": 0.0}, "es_1": {"coverage": 0.945, "n_defined": 1000, "n_fit": 1000, "n_reject": 55, "rejection_mc_se": 0.007209, "rejection_rate": 0.055, "share_undefined": 0.0}, "es_2": {"coverage": 0.94, "n_defined": 1000, "n_fit": 1000, "n_reject": 60, "rejection_mc_se": 0.00751, "rejection_rate": 0.06, "share_undefined": 0.0}, "es_3": {"coverage": 0.915, "n_defined": 1000, "n_fit": 1000, "n_reject": 85, "rejection_mc_se": 0.008819, "rejection_rate": 0.085, "share_undefined": 0.0}, "es_4": {"coverage": 0.932, "n_defined": 1000, "n_fit": 1000, "n_reject": 68, "rejection_mc_se": 0.007961, "rejection_rate": 0.068, "share_undefined": 0.0}, "overall": {"coverage": 0.945, "n_defined": 1000, "n_fit": 1000, "n_reject": 55, "rejection_mc_se": 0.007209, "rejection_rate": 0.055, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 102, "rejection_mc_se": 0.009571, "rejection_rate": 0.102, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 290, "rejection_mc_se": 0.014349, "rejection_rate": 0.29, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.949, "n_defined": 1000, "n_fit": 1000, "n_reject": 51, "rejection_mc_se": 0.006957, "rejection_rate": 0.051, "share_undefined": 0.0}, "es_0": {"coverage": 0.969, "n_defined": 1000, "n_fit": 1000, "n_reject": 31, "rejection_mc_se": 0.005481, "rejection_rate": 0.031, "share_undefined": 0.0}, "es_1": {"coverage": 0.956, "n_defined": 1000, "n_fit": 1000, "n_reject": 44, "rejection_mc_se": 0.006486, "rejection_rate": 0.044, "share_undefined": 0.0}, "es_2": {"coverage": 0.955, "n_defined": 1000, "n_fit": 1000, "n_reject": 45, "rejection_mc_se": 0.006556, "rejection_rate": 0.045, "share_undefined": 0.0}, "es_3": {"coverage": 0.944, "n_defined": 1000, "n_fit": 1000, "n_reject": 56, "rejection_mc_se": 0.007271, "rejection_rate": 0.056, "share_undefined": 0.0}, "es_4": {"coverage": 0.958, "n_defined": 1000, "n_fit": 1000, "n_reject": 42, "rejection_mc_se": 0.006343, "rejection_rate": 0.042, "share_undefined": 0.0}, "overall": {"coverage": 0.96, "n_defined": 1000, "n_fit": 1000, "n_reject": 40, "rejection_mc_se": 0.006197, "rejection_rate": 0.04, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 56, "rejection_mc_se": 0.007271, "rejection_rate": 0.056, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 211, "rejection_mc_se": 0.012903, "rejection_rate": 0.211, "share_undefined": 0.0}}}, "seconds": 166.1, "units_per_cluster": 5}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [{"overall": 0.163, "quantity": "es_-2", "rejection_rate": 0.194}], "index": 28, "n_clusters": 24, "n_replications": 1000, "n_treated_per_cohort": 1, "results": {"bootstrap": {"es_-2": {"coverage": 0.608, "n_defined": 1000, "n_fit": 1000, "n_reject": 392, "rejection_mc_se": 0.015438, "rejection_rate": 0.392, "share_undefined": 0.0}, "es_0": {"coverage": 0.638, "n_defined": 1000, "n_fit": 1000, "n_reject": 359, "rejection_mc_se": 0.01517, "rejection_rate": 0.359, "share_undefined": 0.0}, "es_1": {"coverage": 0.634, "n_defined": 1000, "n_fit": 1000, "n_reject": 363, "rejection_mc_se": 0.015206, "rejection_rate": 0.363, "share_undefined": 0.0}, "es_2": {"coverage": 0.67, "n_defined": 1000, "n_fit": 1000, "n_reject": 329, "rejection_mc_se": 0.014858, "rejection_rate": 0.329, "share_undefined": 0.0}, "es_3": {"coverage": 0.319, "n_defined": 1000, "n_fit": 1000, "n_reject": 679, "rejection_mc_se": 0.014763, "rejection_rate": 0.679, "share_undefined": 0.0}, "es_4": {"coverage": 0.298, "n_defined": 1000, "n_fit": 1000, "n_reject": 699, "rejection_mc_se": 0.014505, "rejection_rate": 0.699, "share_undefined": 0.0}, "overall": {"coverage": 0.627, "n_defined": 1000, "n_fit": 1000, "n_reject": 370, "rejection_mc_se": 0.015268, "rejection_rate": 0.37, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 949, "rejection_mc_se": 0.006957, "rejection_rate": 0.949, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 975, "rejection_mc_se": 0.004937, "rejection_rate": 0.975, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.657, "n_defined": 1000, "n_fit": 1000, "n_reject": 343, "rejection_mc_se": 0.015012, "rejection_rate": 0.343, "share_undefined": 0.0}, "es_0": {"coverage": 0.702, "n_defined": 1000, "n_fit": 1000, "n_reject": 298, "rejection_mc_se": 0.014464, "rejection_rate": 0.298, "share_undefined": 0.0}, "es_1": {"coverage": 0.695, "n_defined": 1000, "n_fit": 1000, "n_reject": 305, "rejection_mc_se": 0.014559, "rejection_rate": 0.305, "share_undefined": 0.0}, "es_2": {"coverage": 0.712, "n_defined": 1000, "n_fit": 1000, "n_reject": 288, "rejection_mc_se": 0.01432, "rejection_rate": 0.288, "share_undefined": 0.0}, "es_3": {"coverage": 0.346, "n_defined": 1000, "n_fit": 1000, "n_reject": 654, "rejection_mc_se": 0.015043, "rejection_rate": 0.654, "share_undefined": 0.0}, "es_4": {"coverage": 0.325, "n_defined": 1000, "n_fit": 1000, "n_reject": 675, "rejection_mc_se": 0.014811, "rejection_rate": 0.675, "share_undefined": 0.0}, "overall": {"coverage": 0.688, "n_defined": 1000, "n_fit": 1000, "n_reject": 312, "rejection_mc_se": 0.014651, "rejection_rate": 0.312, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 891, "rejection_mc_se": 0.009855, "rejection_rate": 0.891, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 973, "rejection_mc_se": 0.005126, "rejection_rate": 0.973, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.806, "n_defined": 1000, "n_fit": 1000, "n_reject": 194, "rejection_mc_se": 0.012505, "rejection_rate": 0.194, "share_undefined": 0.0}, "es_0": {"coverage": 0.83, "n_defined": 1000, "n_fit": 1000, "n_reject": 170, "rejection_mc_se": 0.011879, "rejection_rate": 0.17, "share_undefined": 0.0}, "es_1": {"coverage": 0.826, "n_defined": 1000, "n_fit": 1000, "n_reject": 174, "rejection_mc_se": 0.011988, "rejection_rate": 0.174, "share_undefined": 0.0}, "es_2": {"coverage": 0.829, "n_defined": 1000, "n_fit": 1000, "n_reject": 171, "rejection_mc_se": 0.011906, "rejection_rate": 0.171, "share_undefined": 0.0}, "es_3": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}, "es_4": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}, "overall": {"coverage": 0.837, "n_defined": 1000, "n_fit": 1000, "n_reject": 163, "rejection_mc_se": 0.01168, "rejection_rate": 0.163, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}}}, "seconds": 222.5, "units_per_cluster": 5}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [{"overall": 0.073, "quantity": "es_3", "rejection_rate": 0.152}, {"overall": 0.073, "quantity": "es_4", "rejection_rate": 0.144}, {"overall": 0.073, "quantity": "pretrend_bonferroni", "rejection_rate": 0.238}], "index": 29, "n_clusters": 24, "n_replications": 1000, "n_treated_per_cohort": 2, "results": {"bootstrap": {"es_-2": {"coverage": 0.836, "n_defined": 1000, "n_fit": 1000, "n_reject": 163, "rejection_mc_se": 0.01168, "rejection_rate": 0.163, "share_undefined": 0.0}, "es_0": {"coverage": 0.83, "n_defined": 1000, "n_fit": 1000, "n_reject": 167, "rejection_mc_se": 0.011795, "rejection_rate": 0.167, "share_undefined": 0.0}, "es_1": {"coverage": 0.831, "n_defined": 1000, "n_fit": 1000, "n_reject": 169, "rejection_mc_se": 0.011851, "rejection_rate": 0.169, "share_undefined": 0.0}, "es_2": {"coverage": 0.826, "n_defined": 1000, "n_fit": 1000, "n_reject": 173, "rejection_mc_se": 0.011961, "rejection_rate": 0.173, "share_undefined": 0.0}, "es_3": {"coverage": 0.687, "n_defined": 1000, "n_fit": 1000, "n_reject": 310, "rejection_mc_se": 0.014625, "rejection_rate": 0.31, "share_undefined": 0.0}, "es_4": {"coverage": 0.684, "n_defined": 1000, "n_fit": 1000, "n_reject": 312, "rejection_mc_se": 0.014651, "rejection_rate": 0.312, "share_undefined": 0.0}, "overall": {"coverage": 0.824, "n_defined": 1000, "n_fit": 1000, "n_reject": 174, "rejection_mc_se": 0.011988, "rejection_rate": 0.174, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 549, "rejection_mc_se": 0.015735, "rejection_rate": 0.549, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 752, "rejection_mc_se": 0.013656, "rejection_rate": 0.752, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.874, "n_defined": 1000, "n_fit": 1000, "n_reject": 126, "rejection_mc_se": 0.010494, "rejection_rate": 0.126, "share_undefined": 0.0}, "es_0": {"coverage": 0.882, "n_defined": 1000, "n_fit": 1000, "n_reject": 118, "rejection_mc_se": 0.010202, "rejection_rate": 0.118, "share_undefined": 0.0}, "es_1": {"coverage": 0.87, "n_defined": 1000, "n_fit": 1000, "n_reject": 130, "rejection_mc_se": 0.010635, "rejection_rate": 0.13, "share_undefined": 0.0}, "es_2": {"coverage": 0.875, "n_defined": 1000, "n_fit": 1000, "n_reject": 125, "rejection_mc_se": 0.010458, "rejection_rate": 0.125, "share_undefined": 0.0}, "es_3": {"coverage": 0.741, "n_defined": 1000, "n_fit": 1000, "n_reject": 259, "rejection_mc_se": 0.013853, "rejection_rate": 0.259, "share_undefined": 0.0}, "es_4": {"coverage": 0.738, "n_defined": 1000, "n_fit": 1000, "n_reject": 262, "rejection_mc_se": 0.013905, "rejection_rate": 0.262, "share_undefined": 0.0}, "overall": {"coverage": 0.874, "n_defined": 1000, "n_fit": 1000, "n_reject": 126, "rejection_mc_se": 0.010494, "rejection_rate": 0.126, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 400, "rejection_mc_se": 0.015492, "rejection_rate": 0.4, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 744, "rejection_mc_se": 0.013801, "rejection_rate": 0.744, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.923, "n_defined": 1000, "n_fit": 1000, "n_reject": 77, "rejection_mc_se": 0.00843, "rejection_rate": 0.077, "share_undefined": 0.0}, "es_0": {"coverage": 0.926, "n_defined": 1000, "n_fit": 1000, "n_reject": 74, "rejection_mc_se": 0.008278, "rejection_rate": 0.074, "share_undefined": 0.0}, "es_1": {"coverage": 0.922, "n_defined": 1000, "n_fit": 1000, "n_reject": 78, "rejection_mc_se": 0.00848, "rejection_rate": 0.078, "share_undefined": 0.0}, "es_2": {"coverage": 0.929, "n_defined": 1000, "n_fit": 1000, "n_reject": 71, "rejection_mc_se": 0.008122, "rejection_rate": 0.071, "share_undefined": 0.0}, "es_3": {"coverage": 0.848, "n_defined": 1000, "n_fit": 1000, "n_reject": 152, "rejection_mc_se": 0.011353, "rejection_rate": 0.152, "share_undefined": 0.0}, "es_4": {"coverage": 0.856, "n_defined": 1000, "n_fit": 1000, "n_reject": 144, "rejection_mc_se": 0.011102, "rejection_rate": 0.144, "share_undefined": 0.0}, "overall": {"coverage": 0.927, "n_defined": 1000, "n_fit": 1000, "n_reject": 73, "rejection_mc_se": 0.008226, "rejection_rate": 0.073, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 238, "rejection_mc_se": 0.013467, "rejection_rate": 0.238, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 673, "rejection_mc_se": 0.014835, "rejection_rate": 0.673, "share_undefined": 0.0}}}, "seconds": 229.1, "units_per_cluster": 5}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [{"overall": 0.066, "quantity": "es_3", "rejection_rate": 0.099}, {"overall": 0.066, "quantity": "pretrend_bonferroni", "rejection_rate": 0.131}], "index": 30, "n_clusters": 24, "n_replications": 1000, "n_treated_per_cohort": 3, "results": {"bootstrap": {"es_-2": {"coverage": 0.881, "n_defined": 1000, "n_fit": 1000, "n_reject": 117, "rejection_mc_se": 0.010164, "rejection_rate": 0.117, "share_undefined": 0.0}, "es_0": {"coverage": 0.881, "n_defined": 1000, "n_fit": 1000, "n_reject": 119, "rejection_mc_se": 0.010239, "rejection_rate": 0.119, "share_undefined": 0.0}, "es_1": {"coverage": 0.876, "n_defined": 1000, "n_fit": 1000, "n_reject": 120, "rejection_mc_se": 0.010276, "rejection_rate": 0.12, "share_undefined": 0.0}, "es_2": {"coverage": 0.866, "n_defined": 1000, "n_fit": 1000, "n_reject": 134, "rejection_mc_se": 0.010772, "rejection_rate": 0.134, "share_undefined": 0.0}, "es_3": {"coverage": 0.801, "n_defined": 1000, "n_fit": 1000, "n_reject": 198, "rejection_mc_se": 0.012601, "rejection_rate": 0.198, "share_undefined": 0.0}, "es_4": {"coverage": 0.798, "n_defined": 1000, "n_fit": 1000, "n_reject": 198, "rejection_mc_se": 0.012601, "rejection_rate": 0.198, "share_undefined": 0.0}, "overall": {"coverage": 0.878, "n_defined": 1000, "n_fit": 1000, "n_reject": 121, "rejection_mc_se": 0.010313, "rejection_rate": 0.121, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 344, "rejection_mc_se": 0.015022, "rejection_rate": 0.344, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 479, "rejection_mc_se": 0.015797, "rejection_rate": 0.479, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.914, "n_defined": 1000, "n_fit": 1000, "n_reject": 86, "rejection_mc_se": 0.008866, "rejection_rate": 0.086, "share_undefined": 0.0}, "es_0": {"coverage": 0.908, "n_defined": 1000, "n_fit": 1000, "n_reject": 92, "rejection_mc_se": 0.00914, "rejection_rate": 0.092, "share_undefined": 0.0}, "es_1": {"coverage": 0.911, "n_defined": 1000, "n_fit": 1000, "n_reject": 89, "rejection_mc_se": 0.009004, "rejection_rate": 0.089, "share_undefined": 0.0}, "es_2": {"coverage": 0.902, "n_defined": 1000, "n_fit": 1000, "n_reject": 98, "rejection_mc_se": 0.009402, "rejection_rate": 0.098, "share_undefined": 0.0}, "es_3": {"coverage": 0.839, "n_defined": 1000, "n_fit": 1000, "n_reject": 161, "rejection_mc_se": 0.011622, "rejection_rate": 0.161, "share_undefined": 0.0}, "es_4": {"coverage": 0.842, "n_defined": 1000, "n_fit": 1000, "n_reject": 158, "rejection_mc_se": 0.011534, "rejection_rate": 0.158, "share_undefined": 0.0}, "overall": {"coverage": 0.91, "n_defined": 1000, "n_fit": 1000, "n_reject": 90, "rejection_mc_se": 0.00905, "rejection_rate": 0.09, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 212, "rejection_mc_se": 0.012925, "rejection_rate": 0.212, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 458, "rejection_mc_se": 0.015756, "rejection_rate": 0.458, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.934, "n_defined": 1000, "n_fit": 1000, "n_reject": 66, "rejection_mc_se": 0.007851, "rejection_rate": 0.066, "share_undefined": 0.0}, "es_0": {"coverage": 0.937, "n_defined": 1000, "n_fit": 1000, "n_reject": 63, "rejection_mc_se": 0.007683, "rejection_rate": 0.063, "share_undefined": 0.0}, "es_1": {"coverage": 0.938, "n_defined": 1000, "n_fit": 1000, "n_reject": 62, "rejection_mc_se": 0.007626, "rejection_rate": 0.062, "share_undefined": 0.0}, "es_2": {"coverage": 0.926, "n_defined": 1000, "n_fit": 1000, "n_reject": 74, "rejection_mc_se": 0.008278, "rejection_rate": 0.074, "share_undefined": 0.0}, "es_3": {"coverage": 0.901, "n_defined": 1000, "n_fit": 1000, "n_reject": 99, "rejection_mc_se": 0.009445, "rejection_rate": 0.099, "share_undefined": 0.0}, "es_4": {"coverage": 0.909, "n_defined": 1000, "n_fit": 1000, "n_reject": 91, "rejection_mc_se": 0.009095, "rejection_rate": 0.091, "share_undefined": 0.0}, "overall": {"coverage": 0.934, "n_defined": 1000, "n_fit": 1000, "n_reject": 66, "rejection_mc_se": 0.007851, "rejection_rate": 0.066, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 131, "rejection_mc_se": 0.01067, "rejection_rate": 0.131, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 374, "rejection_mc_se": 0.015301, "rejection_rate": 0.374, "share_undefined": 0.0}}}, "seconds": 228.4, "units_per_cluster": 5}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [{"overall": 0.048, "quantity": "pretrend_bonferroni", "rejection_rate": 0.115}], "index": 31, "n_clusters": 24, "n_replications": 1000, "n_treated_per_cohort": 4, "results": {"bootstrap": {"es_-2": {"coverage": 0.896, "n_defined": 1000, "n_fit": 1000, "n_reject": 102, "rejection_mc_se": 0.009571, "rejection_rate": 0.102, "share_undefined": 0.0}, "es_0": {"coverage": 0.905, "n_defined": 1000, "n_fit": 1000, "n_reject": 93, "rejection_mc_se": 0.009184, "rejection_rate": 0.093, "share_undefined": 0.0}, "es_1": {"coverage": 0.896, "n_defined": 1000, "n_fit": 1000, "n_reject": 102, "rejection_mc_se": 0.009571, "rejection_rate": 0.102, "share_undefined": 0.0}, "es_2": {"coverage": 0.905, "n_defined": 1000, "n_fit": 1000, "n_reject": 92, "rejection_mc_se": 0.00914, "rejection_rate": 0.092, "share_undefined": 0.0}, "es_3": {"coverage": 0.85, "n_defined": 1000, "n_fit": 1000, "n_reject": 149, "rejection_mc_se": 0.011261, "rejection_rate": 0.149, "share_undefined": 0.0}, "es_4": {"coverage": 0.858, "n_defined": 1000, "n_fit": 1000, "n_reject": 140, "rejection_mc_se": 0.010973, "rejection_rate": 0.14, "share_undefined": 0.0}, "overall": {"coverage": 0.902, "n_defined": 1000, "n_fit": 1000, "n_reject": 96, "rejection_mc_se": 0.009316, "rejection_rate": 0.096, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 275, "rejection_mc_se": 0.01412, "rejection_rate": 0.275, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 350, "rejection_mc_se": 0.015083, "rejection_rate": 0.35, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.93, "n_defined": 1000, "n_fit": 1000, "n_reject": 70, "rejection_mc_se": 0.008068, "rejection_rate": 0.07, "share_undefined": 0.0}, "es_0": {"coverage": 0.933, "n_defined": 1000, "n_fit": 1000, "n_reject": 67, "rejection_mc_se": 0.007906, "rejection_rate": 0.067, "share_undefined": 0.0}, "es_1": {"coverage": 0.93, "n_defined": 1000, "n_fit": 1000, "n_reject": 70, "rejection_mc_se": 0.008068, "rejection_rate": 0.07, "share_undefined": 0.0}, "es_2": {"coverage": 0.935, "n_defined": 1000, "n_fit": 1000, "n_reject": 65, "rejection_mc_se": 0.007796, "rejection_rate": 0.065, "share_undefined": 0.0}, "es_3": {"coverage": 0.889, "n_defined": 1000, "n_fit": 1000, "n_reject": 111, "rejection_mc_se": 0.009934, "rejection_rate": 0.111, "share_undefined": 0.0}, "es_4": {"coverage": 0.888, "n_defined": 1000, "n_fit": 1000, "n_reject": 112, "rejection_mc_se": 0.009973, "rejection_rate": 0.112, "share_undefined": 0.0}, "overall": {"coverage": 0.934, "n_defined": 1000, "n_fit": 1000, "n_reject": 66, "rejection_mc_se": 0.007851, "rejection_rate": 0.066, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 159, "rejection_mc_se": 0.011564, "rejection_rate": 0.159, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 339, "rejection_mc_se": 0.014969, "rejection_rate": 0.339, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.947, "n_defined": 1000, "n_fit": 1000, "n_reject": 53, "rejection_mc_se": 0.007085, "rejection_rate": 0.053, "share_undefined": 0.0}, "es_0": {"coverage": 0.952, "n_defined": 1000, "n_fit": 1000, "n_reject": 48, "rejection_mc_se": 0.00676, "rejection_rate": 0.048, "share_undefined": 0.0}, "es_1": {"coverage": 0.948, "n_defined": 1000, "n_fit": 1000, "n_reject": 52, "rejection_mc_se": 0.007021, "rejection_rate": 0.052, "share_undefined": 0.0}, "es_2": {"coverage": 0.947, "n_defined": 1000, "n_fit": 1000, "n_reject": 53, "rejection_mc_se": 0.007085, "rejection_rate": 0.053, "share_undefined": 0.0}, "es_3": {"coverage": 0.927, "n_defined": 1000, "n_fit": 1000, "n_reject": 73, "rejection_mc_se": 0.008226, "rejection_rate": 0.073, "share_undefined": 0.0}, "es_4": {"coverage": 0.929, "n_defined": 1000, "n_fit": 1000, "n_reject": 71, "rejection_mc_se": 0.008122, "rejection_rate": 0.071, "share_undefined": 0.0}, "overall": {"coverage": 0.952, "n_defined": 1000, "n_fit": 1000, "n_reject": 48, "rejection_mc_se": 0.00676, "rejection_rate": 0.048, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 115, "rejection_mc_se": 0.010088, "rejection_rate": 0.115, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 258, "rejection_mc_se": 0.013836, "rejection_rate": 0.258, "share_undefined": 0.0}}}, "seconds": 226.7, "units_per_cluster": 5}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [], "index": 32, "n_clusters": 24, "n_replications": 1000, "n_treated_per_cohort": 6, "results": {"bootstrap": {"es_-2": {"coverage": 0.921, "n_defined": 1000, "n_fit": 1000, "n_reject": 76, "rejection_mc_se": 0.00838, "rejection_rate": 0.076, "share_undefined": 0.0}, "es_0": {"coverage": 0.925, "n_defined": 1000, "n_fit": 1000, "n_reject": 73, "rejection_mc_se": 0.008226, "rejection_rate": 0.073, "share_undefined": 0.0}, "es_1": {"coverage": 0.922, "n_defined": 1000, "n_fit": 1000, "n_reject": 77, "rejection_mc_se": 0.00843, "rejection_rate": 0.077, "share_undefined": 0.0}, "es_2": {"coverage": 0.928, "n_defined": 1000, "n_fit": 1000, "n_reject": 72, "rejection_mc_se": 0.008174, "rejection_rate": 0.072, "share_undefined": 0.0}, "es_3": {"coverage": 0.897, "n_defined": 1000, "n_fit": 1000, "n_reject": 101, "rejection_mc_se": 0.009529, "rejection_rate": 0.101, "share_undefined": 0.0}, "es_4": {"coverage": 0.892, "n_defined": 1000, "n_fit": 1000, "n_reject": 108, "rejection_mc_se": 0.009815, "rejection_rate": 0.108, "share_undefined": 0.0}, "overall": {"coverage": 0.927, "n_defined": 1000, "n_fit": 1000, "n_reject": 68, "rejection_mc_se": 0.007961, "rejection_rate": 0.068, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 170, "rejection_mc_se": 0.011879, "rejection_rate": 0.17, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 211, "rejection_mc_se": 0.012903, "rejection_rate": 0.211, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.943, "n_defined": 1000, "n_fit": 1000, "n_reject": 57, "rejection_mc_se": 0.007332, "rejection_rate": 0.057, "share_undefined": 0.0}, "es_0": {"coverage": 0.948, "n_defined": 1000, "n_fit": 1000, "n_reject": 52, "rejection_mc_se": 0.007021, "rejection_rate": 0.052, "share_undefined": 0.0}, "es_1": {"coverage": 0.954, "n_defined": 1000, "n_fit": 1000, "n_reject": 46, "rejection_mc_se": 0.006624, "rejection_rate": 0.046, "share_undefined": 0.0}, "es_2": {"coverage": 0.948, "n_defined": 1000, "n_fit": 1000, "n_reject": 52, "rejection_mc_se": 0.007021, "rejection_rate": 0.052, "share_undefined": 0.0}, "es_3": {"coverage": 0.934, "n_defined": 1000, "n_fit": 1000, "n_reject": 66, "rejection_mc_se": 0.007851, "rejection_rate": 0.066, "share_undefined": 0.0}, "es_4": {"coverage": 0.927, "n_defined": 1000, "n_fit": 1000, "n_reject": 73, "rejection_mc_se": 0.008226, "rejection_rate": 0.073, "share_undefined": 0.0}, "overall": {"coverage": 0.949, "n_defined": 1000, "n_fit": 1000, "n_reject": 51, "rejection_mc_se": 0.006957, "rejection_rate": 0.051, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 81, "rejection_mc_se": 0.008628, "rejection_rate": 0.081, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 188, "rejection_mc_se": 0.012355, "rejection_rate": 0.188, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.951, "n_defined": 1000, "n_fit": 1000, "n_reject": 49, "rejection_mc_se": 0.006826, "rejection_rate": 0.049, "share_undefined": 0.0}, "es_0": {"coverage": 0.956, "n_defined": 1000, "n_fit": 1000, "n_reject": 44, "rejection_mc_se": 0.006486, "rejection_rate": 0.044, "share_undefined": 0.0}, "es_1": {"coverage": 0.962, "n_defined": 1000, "n_fit": 1000, "n_reject": 38, "rejection_mc_se": 0.006046, "rejection_rate": 0.038, "share_undefined": 0.0}, "es_2": {"coverage": 0.956, "n_defined": 1000, "n_fit": 1000, "n_reject": 44, "rejection_mc_se": 0.006486, "rejection_rate": 0.044, "share_undefined": 0.0}, "es_3": {"coverage": 0.952, "n_defined": 1000, "n_fit": 1000, "n_reject": 48, "rejection_mc_se": 0.00676, "rejection_rate": 0.048, "share_undefined": 0.0}, "es_4": {"coverage": 0.95, "n_defined": 1000, "n_fit": 1000, "n_reject": 50, "rejection_mc_se": 0.006892, "rejection_rate": 0.05, "share_undefined": 0.0}, "overall": {"coverage": 0.959, "n_defined": 1000, "n_fit": 1000, "n_reject": 41, "rejection_mc_se": 0.00627, "rejection_rate": 0.041, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 42, "rejection_mc_se": 0.006343, "rejection_rate": 0.042, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 149, "rejection_mc_se": 0.011261, "rejection_rate": 0.149, "share_undefined": 0.0}}}, "seconds": 227.1, "units_per_cluster": 5}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [], "index": 33, "n_clusters": 24, "n_replications": 1000, "n_treated_per_cohort": 8, "results": {"bootstrap": {"es_-2": {"coverage": 0.923, "n_defined": 1000, "n_fit": 1000, "n_reject": 76, "rejection_mc_se": 0.00838, "rejection_rate": 0.076, "share_undefined": 0.0}, "es_0": {"coverage": 0.909, "n_defined": 1000, "n_fit": 1000, "n_reject": 91, "rejection_mc_se": 0.009095, "rejection_rate": 0.091, "share_undefined": 0.0}, "es_1": {"coverage": 0.924, "n_defined": 1000, "n_fit": 1000, "n_reject": 75, "rejection_mc_se": 0.008329, "rejection_rate": 0.075, "share_undefined": 0.0}, "es_2": {"coverage": 0.919, "n_defined": 1000, "n_fit": 1000, "n_reject": 81, "rejection_mc_se": 0.008628, "rejection_rate": 0.081, "share_undefined": 0.0}, "es_3": {"coverage": 0.89, "n_defined": 1000, "n_fit": 1000, "n_reject": 108, "rejection_mc_se": 0.009815, "rejection_rate": 0.108, "share_undefined": 0.0}, "es_4": {"coverage": 0.877, "n_defined": 1000, "n_fit": 1000, "n_reject": 118, "rejection_mc_se": 0.010202, "rejection_rate": 0.118, "share_undefined": 0.0}, "overall": {"coverage": 0.911, "n_defined": 1000, "n_fit": 1000, "n_reject": 88, "rejection_mc_se": 0.008959, "rejection_rate": 0.088, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 166, "rejection_mc_se": 0.011766, "rejection_rate": 0.166, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 193, "rejection_mc_se": 0.01248, "rejection_rate": 0.193, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.952, "n_defined": 1000, "n_fit": 1000, "n_reject": 48, "rejection_mc_se": 0.00676, "rejection_rate": 0.048, "share_undefined": 0.0}, "es_0": {"coverage": 0.938, "n_defined": 1000, "n_fit": 1000, "n_reject": 62, "rejection_mc_se": 0.007626, "rejection_rate": 0.062, "share_undefined": 0.0}, "es_1": {"coverage": 0.945, "n_defined": 1000, "n_fit": 1000, "n_reject": 55, "rejection_mc_se": 0.007209, "rejection_rate": 0.055, "share_undefined": 0.0}, "es_2": {"coverage": 0.94, "n_defined": 1000, "n_fit": 1000, "n_reject": 60, "rejection_mc_se": 0.00751, "rejection_rate": 0.06, "share_undefined": 0.0}, "es_3": {"coverage": 0.924, "n_defined": 1000, "n_fit": 1000, "n_reject": 76, "rejection_mc_se": 0.00838, "rejection_rate": 0.076, "share_undefined": 0.0}, "es_4": {"coverage": 0.921, "n_defined": 1000, "n_fit": 1000, "n_reject": 79, "rejection_mc_se": 0.00853, "rejection_rate": 0.079, "share_undefined": 0.0}, "overall": {"coverage": 0.94, "n_defined": 1000, "n_fit": 1000, "n_reject": 60, "rejection_mc_se": 0.00751, "rejection_rate": 0.06, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 77, "rejection_mc_se": 0.00843, "rejection_rate": 0.077, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 170, "rejection_mc_se": 0.011879, "rejection_rate": 0.17, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.958, "n_defined": 1000, "n_fit": 1000, "n_reject": 42, "rejection_mc_se": 0.006343, "rejection_rate": 0.042, "share_undefined": 0.0}, "es_0": {"coverage": 0.955, "n_defined": 1000, "n_fit": 1000, "n_reject": 45, "rejection_mc_se": 0.006556, "rejection_rate": 0.045, "share_undefined": 0.0}, "es_1": {"coverage": 0.956, "n_defined": 1000, "n_fit": 1000, "n_reject": 44, "rejection_mc_se": 0.006486, "rejection_rate": 0.044, "share_undefined": 0.0}, "es_2": {"coverage": 0.948, "n_defined": 1000, "n_fit": 1000, "n_reject": 52, "rejection_mc_se": 0.007021, "rejection_rate": 0.052, "share_undefined": 0.0}, "es_3": {"coverage": 0.946, "n_defined": 1000, "n_fit": 1000, "n_reject": 54, "rejection_mc_se": 0.007147, "rejection_rate": 0.054, "share_undefined": 0.0}, "es_4": {"coverage": 0.944, "n_defined": 1000, "n_fit": 1000, "n_reject": 56, "rejection_mc_se": 0.007271, "rejection_rate": 0.056, "share_undefined": 0.0}, "overall": {"coverage": 0.948, "n_defined": 1000, "n_fit": 1000, "n_reject": 52, "rejection_mc_se": 0.007021, "rejection_rate": 0.052, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 58, "rejection_mc_se": 0.007392, "rejection_rate": 0.058, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 133, "rejection_mc_se": 0.010738, "rejection_rate": 0.133, "share_undefined": 0.0}}}, "seconds": 226.7, "units_per_cluster": 5}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [], "index": 34, "n_clusters": 32, "n_replications": 1000, "n_treated_per_cohort": 1, "results": {"bootstrap": {"es_-2": {"coverage": 0.616, "n_defined": 1000, "n_fit": 1000, "n_reject": 383, "rejection_mc_se": 0.015372, "rejection_rate": 0.383, "share_undefined": 0.0}, "es_0": {"coverage": 0.604, "n_defined": 1000, "n_fit": 1000, "n_reject": 392, "rejection_mc_se": 0.015438, "rejection_rate": 0.392, "share_undefined": 0.0}, "es_1": {"coverage": 0.576, "n_defined": 1000, "n_fit": 1000, "n_reject": 424, "rejection_mc_se": 0.015628, "rejection_rate": 0.424, "share_undefined": 0.0}, "es_2": {"coverage": 0.625, "n_defined": 1000, "n_fit": 1000, "n_reject": 373, "rejection_mc_se": 0.015293, "rejection_rate": 0.373, "share_undefined": 0.0}, "es_3": {"coverage": 0.277, "n_defined": 1000, "n_fit": 1000, "n_reject": 720, "rejection_mc_se": 0.014199, "rejection_rate": 0.72, "share_undefined": 0.0}, "es_4": {"coverage": 0.252, "n_defined": 1000, "n_fit": 1000, "n_reject": 744, "rejection_mc_se": 0.013801, "rejection_rate": 0.744, "share_undefined": 0.0}, "overall": {"coverage": 0.608, "n_defined": 1000, "n_fit": 1000, "n_reject": 389, "rejection_mc_se": 0.015417, "rejection_rate": 0.389, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 947, "rejection_mc_se": 0.007085, "rejection_rate": 0.947, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 978, "rejection_mc_se": 0.004639, "rejection_rate": 0.978, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.671, "n_defined": 1000, "n_fit": 1000, "n_reject": 329, "rejection_mc_se": 0.014858, "rejection_rate": 0.329, "share_undefined": 0.0}, "es_0": {"coverage": 0.672, "n_defined": 1000, "n_fit": 1000, "n_reject": 328, "rejection_mc_se": 0.014846, "rejection_rate": 0.328, "share_undefined": 0.0}, "es_1": {"coverage": 0.639, "n_defined": 1000, "n_fit": 1000, "n_reject": 361, "rejection_mc_se": 0.015188, "rejection_rate": 0.361, "share_undefined": 0.0}, "es_2": {"coverage": 0.67, "n_defined": 1000, "n_fit": 1000, "n_reject": 330, "rejection_mc_se": 0.014869, "rejection_rate": 0.33, "share_undefined": 0.0}, "es_3": {"coverage": 0.293, "n_defined": 1000, "n_fit": 1000, "n_reject": 707, "rejection_mc_se": 0.014393, "rejection_rate": 0.707, "share_undefined": 0.0}, "es_4": {"coverage": 0.277, "n_defined": 1000, "n_fit": 1000, "n_reject": 723, "rejection_mc_se": 0.014152, "rejection_rate": 0.723, "share_undefined": 0.0}, "overall": {"coverage": 0.653, "n_defined": 1000, "n_fit": 1000, "n_reject": 347, "rejection_mc_se": 0.015053, "rejection_rate": 0.347, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 905, "rejection_mc_se": 0.009272, "rejection_rate": 0.905, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 977, "rejection_mc_se": 0.00474, "rejection_rate": 0.977, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.82, "n_defined": 1000, "n_fit": 1000, "n_reject": 180, "rejection_mc_se": 0.012149, "rejection_rate": 0.18, "share_undefined": 0.0}, "es_0": {"coverage": 0.818, "n_defined": 1000, "n_fit": 1000, "n_reject": 182, "rejection_mc_se": 0.012201, "rejection_rate": 0.182, "share_undefined": 0.0}, "es_1": {"coverage": 0.798, "n_defined": 1000, "n_fit": 1000, "n_reject": 202, "rejection_mc_se": 0.012696, "rejection_rate": 0.202, "share_undefined": 0.0}, "es_2": {"coverage": 0.818, "n_defined": 1000, "n_fit": 1000, "n_reject": 182, "rejection_mc_se": 0.012201, "rejection_rate": 0.182, "share_undefined": 0.0}, "es_3": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}, "es_4": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}, "overall": {"coverage": 0.824, "n_defined": 1000, "n_fit": 1000, "n_reject": 176, "rejection_mc_se": 0.012043, "rejection_rate": 0.176, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 0, "n_fit": 1000, "n_reject": 0, "rejection_mc_se": NaN, "rejection_rate": NaN, "share_undefined": 1.0}}}, "seconds": 261.5, "units_per_cluster": 5}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [{"overall": 0.092, "quantity": "es_3", "rejection_rate": 0.177}, {"overall": 0.092, "quantity": "es_4", "rejection_rate": 0.166}, {"overall": 0.092, "quantity": "pretrend_bonferroni", "rejection_rate": 0.291}], "index": 35, "n_clusters": 32, "n_replications": 1000, "n_treated_per_cohort": 2, "results": {"bootstrap": {"es_-2": {"coverage": 0.826, "n_defined": 1000, "n_fit": 1000, "n_reject": 174, "rejection_mc_se": 0.011988, "rejection_rate": 0.174, "share_undefined": 0.0}, "es_0": {"coverage": 0.79, "n_defined": 1000, "n_fit": 1000, "n_reject": 207, "rejection_mc_se": 0.012812, "rejection_rate": 0.207, "share_undefined": 0.0}, "es_1": {"coverage": 0.804, "n_defined": 1000, "n_fit": 1000, "n_reject": 195, "rejection_mc_se": 0.012529, "rejection_rate": 0.195, "share_undefined": 0.0}, "es_2": {"coverage": 0.839, "n_defined": 1000, "n_fit": 1000, "n_reject": 158, "rejection_mc_se": 0.011534, "rejection_rate": 0.158, "share_undefined": 0.0}, "es_3": {"coverage": 0.657, "n_defined": 1000, "n_fit": 1000, "n_reject": 340, "rejection_mc_se": 0.01498, "rejection_rate": 0.34, "share_undefined": 0.0}, "es_4": {"coverage": 0.668, "n_defined": 1000, "n_fit": 1000, "n_reject": 331, "rejection_mc_se": 0.014881, "rejection_rate": 0.331, "share_undefined": 0.0}, "overall": {"coverage": 0.81, "n_defined": 1000, "n_fit": 1000, "n_reject": 188, "rejection_mc_se": 0.012355, "rejection_rate": 0.188, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 585, "rejection_mc_se": 0.015581, "rejection_rate": 0.585, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 782, "rejection_mc_se": 0.013057, "rejection_rate": 0.782, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.865, "n_defined": 1000, "n_fit": 1000, "n_reject": 135, "rejection_mc_se": 0.010806, "rejection_rate": 0.135, "share_undefined": 0.0}, "es_0": {"coverage": 0.845, "n_defined": 1000, "n_fit": 1000, "n_reject": 155, "rejection_mc_se": 0.011444, "rejection_rate": 0.155, "share_undefined": 0.0}, "es_1": {"coverage": 0.848, "n_defined": 1000, "n_fit": 1000, "n_reject": 152, "rejection_mc_se": 0.011353, "rejection_rate": 0.152, "share_undefined": 0.0}, "es_2": {"coverage": 0.864, "n_defined": 1000, "n_fit": 1000, "n_reject": 136, "rejection_mc_se": 0.01084, "rejection_rate": 0.136, "share_undefined": 0.0}, "es_3": {"coverage": 0.706, "n_defined": 1000, "n_fit": 1000, "n_reject": 294, "rejection_mc_se": 0.014407, "rejection_rate": 0.294, "share_undefined": 0.0}, "es_4": {"coverage": 0.717, "n_defined": 1000, "n_fit": 1000, "n_reject": 283, "rejection_mc_se": 0.014245, "rejection_rate": 0.283, "share_undefined": 0.0}, "overall": {"coverage": 0.856, "n_defined": 1000, "n_fit": 1000, "n_reject": 144, "rejection_mc_se": 0.011102, "rejection_rate": 0.144, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 458, "rejection_mc_se": 0.015756, "rejection_rate": 0.458, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 772, "rejection_mc_se": 0.013267, "rejection_rate": 0.772, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.919, "n_defined": 1000, "n_fit": 1000, "n_reject": 81, "rejection_mc_se": 0.008628, "rejection_rate": 0.081, "share_undefined": 0.0}, "es_0": {"coverage": 0.905, "n_defined": 1000, "n_fit": 1000, "n_reject": 95, "rejection_mc_se": 0.009272, "rejection_rate": 0.095, "share_undefined": 0.0}, "es_1": {"coverage": 0.904, "n_defined": 1000, "n_fit": 1000, "n_reject": 96, "rejection_mc_se": 0.009316, "rejection_rate": 0.096, "share_undefined": 0.0}, "es_2": {"coverage": 0.92, "n_defined": 1000, "n_fit": 1000, "n_reject": 80, "rejection_mc_se": 0.008579, "rejection_rate": 0.08, "share_undefined": 0.0}, "es_3": {"coverage": 0.823, "n_defined": 1000, "n_fit": 1000, "n_reject": 177, "rejection_mc_se": 0.012069, "rejection_rate": 0.177, "share_undefined": 0.0}, "es_4": {"coverage": 0.834, "n_defined": 1000, "n_fit": 1000, "n_reject": 166, "rejection_mc_se": 0.011766, "rejection_rate": 0.166, "share_undefined": 0.0}, "overall": {"coverage": 0.908, "n_defined": 1000, "n_fit": 1000, "n_reject": 92, "rejection_mc_se": 0.00914, "rejection_rate": 0.092, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 291, "rejection_mc_se": 0.014364, "rejection_rate": 0.291, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 711, "rejection_mc_se": 0.014335, "rejection_rate": 0.711, "share_undefined": 0.0}}}, "seconds": 264.7, "units_per_cluster": 5}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [{"overall": 0.077, "quantity": "pretrend_bonferroni", "rejection_rate": 0.142}], "index": 36, "n_clusters": 32, "n_replications": 1000, "n_treated_per_cohort": 3, "results": {"bootstrap": {"es_-2": {"coverage": 0.877, "n_defined": 1000, "n_fit": 1000, "n_reject": 121, "rejection_mc_se": 0.010313, "rejection_rate": 0.121, "share_undefined": 0.0}, "es_0": {"coverage": 0.87, "n_defined": 1000, "n_fit": 1000, "n_reject": 127, "rejection_mc_se": 0.01053, "rejection_rate": 0.127, "share_undefined": 0.0}, "es_1": {"coverage": 0.861, "n_defined": 1000, "n_fit": 1000, "n_reject": 139, "rejection_mc_se": 0.01094, "rejection_rate": 0.139, "share_undefined": 0.0}, "es_2": {"coverage": 0.873, "n_defined": 1000, "n_fit": 1000, "n_reject": 125, "rejection_mc_se": 0.010458, "rejection_rate": 0.125, "share_undefined": 0.0}, "es_3": {"coverage": 0.788, "n_defined": 1000, "n_fit": 1000, "n_reject": 207, "rejection_mc_se": 0.012812, "rejection_rate": 0.207, "share_undefined": 0.0}, "es_4": {"coverage": 0.783, "n_defined": 1000, "n_fit": 1000, "n_reject": 212, "rejection_mc_se": 0.012925, "rejection_rate": 0.212, "share_undefined": 0.0}, "overall": {"coverage": 0.863, "n_defined": 1000, "n_fit": 1000, "n_reject": 135, "rejection_mc_se": 0.010806, "rejection_rate": 0.135, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 379, "rejection_mc_se": 0.015341, "rejection_rate": 0.379, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 494, "rejection_mc_se": 0.01581, "rejection_rate": 0.494, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.907, "n_defined": 1000, "n_fit": 1000, "n_reject": 93, "rejection_mc_se": 0.009184, "rejection_rate": 0.093, "share_undefined": 0.0}, "es_0": {"coverage": 0.9, "n_defined": 1000, "n_fit": 1000, "n_reject": 100, "rejection_mc_se": 0.009487, "rejection_rate": 0.1, "share_undefined": 0.0}, "es_1": {"coverage": 0.899, "n_defined": 1000, "n_fit": 1000, "n_reject": 101, "rejection_mc_se": 0.009529, "rejection_rate": 0.101, "share_undefined": 0.0}, "es_2": {"coverage": 0.905, "n_defined": 1000, "n_fit": 1000, "n_reject": 95, "rejection_mc_se": 0.009272, "rejection_rate": 0.095, "share_undefined": 0.0}, "es_3": {"coverage": 0.833, "n_defined": 1000, "n_fit": 1000, "n_reject": 167, "rejection_mc_se": 0.011795, "rejection_rate": 0.167, "share_undefined": 0.0}, "es_4": {"coverage": 0.83, "n_defined": 1000, "n_fit": 1000, "n_reject": 170, "rejection_mc_se": 0.011879, "rejection_rate": 0.17, "share_undefined": 0.0}, "overall": {"coverage": 0.892, "n_defined": 1000, "n_fit": 1000, "n_reject": 108, "rejection_mc_se": 0.009815, "rejection_rate": 0.108, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 241, "rejection_mc_se": 0.013525, "rejection_rate": 0.241, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 481, "rejection_mc_se": 0.0158, "rejection_rate": 0.481, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.939, "n_defined": 1000, "n_fit": 1000, "n_reject": 61, "rejection_mc_se": 0.007568, "rejection_rate": 0.061, "share_undefined": 0.0}, "es_0": {"coverage": 0.926, "n_defined": 1000, "n_fit": 1000, "n_reject": 74, "rejection_mc_se": 0.008278, "rejection_rate": 0.074, "share_undefined": 0.0}, "es_1": {"coverage": 0.924, "n_defined": 1000, "n_fit": 1000, "n_reject": 76, "rejection_mc_se": 0.00838, "rejection_rate": 0.076, "share_undefined": 0.0}, "es_2": {"coverage": 0.932, "n_defined": 1000, "n_fit": 1000, "n_reject": 68, "rejection_mc_se": 0.007961, "rejection_rate": 0.068, "share_undefined": 0.0}, "es_3": {"coverage": 0.91, "n_defined": 1000, "n_fit": 1000, "n_reject": 90, "rejection_mc_se": 0.00905, "rejection_rate": 0.09, "share_undefined": 0.0}, "es_4": {"coverage": 0.896, "n_defined": 1000, "n_fit": 1000, "n_reject": 104, "rejection_mc_se": 0.009653, "rejection_rate": 0.104, "share_undefined": 0.0}, "overall": {"coverage": 0.923, "n_defined": 1000, "n_fit": 1000, "n_reject": 77, "rejection_mc_se": 0.00843, "rejection_rate": 0.077, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 142, "rejection_mc_se": 0.011038, "rejection_rate": 0.142, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 399, "rejection_mc_se": 0.015485, "rejection_rate": 0.399, "share_undefined": 0.0}}}, "seconds": 263.5, "units_per_cluster": 5}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [{"overall": 0.065, "quantity": "pretrend_bonferroni", "rejection_rate": 0.101}], "index": 37, "n_clusters": 32, "n_replications": 1000, "n_treated_per_cohort": 4, "results": {"bootstrap": {"es_-2": {"coverage": 0.906, "n_defined": 1000, "n_fit": 1000, "n_reject": 94, "rejection_mc_se": 0.009228, "rejection_rate": 0.094, "share_undefined": 0.0}, "es_0": {"coverage": 0.883, "n_defined": 1000, "n_fit": 1000, "n_reject": 117, "rejection_mc_se": 0.010164, "rejection_rate": 0.117, "share_undefined": 0.0}, "es_1": {"coverage": 0.88, "n_defined": 1000, "n_fit": 1000, "n_reject": 118, "rejection_mc_se": 0.010202, "rejection_rate": 0.118, "share_undefined": 0.0}, "es_2": {"coverage": 0.902, "n_defined": 1000, "n_fit": 1000, "n_reject": 98, "rejection_mc_se": 0.009402, "rejection_rate": 0.098, "share_undefined": 0.0}, "es_3": {"coverage": 0.824, "n_defined": 1000, "n_fit": 1000, "n_reject": 173, "rejection_mc_se": 0.011961, "rejection_rate": 0.173, "share_undefined": 0.0}, "es_4": {"coverage": 0.838, "n_defined": 1000, "n_fit": 1000, "n_reject": 159, "rejection_mc_se": 0.011564, "rejection_rate": 0.159, "share_undefined": 0.0}, "overall": {"coverage": 0.884, "n_defined": 1000, "n_fit": 1000, "n_reject": 113, "rejection_mc_se": 0.010012, "rejection_rate": 0.113, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 271, "rejection_mc_se": 0.014056, "rejection_rate": 0.271, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 372, "rejection_mc_se": 0.015285, "rejection_rate": 0.372, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.93, "n_defined": 1000, "n_fit": 1000, "n_reject": 70, "rejection_mc_se": 0.008068, "rejection_rate": 0.07, "share_undefined": 0.0}, "es_0": {"coverage": 0.909, "n_defined": 1000, "n_fit": 1000, "n_reject": 91, "rejection_mc_se": 0.009095, "rejection_rate": 0.091, "share_undefined": 0.0}, "es_1": {"coverage": 0.908, "n_defined": 1000, "n_fit": 1000, "n_reject": 92, "rejection_mc_se": 0.00914, "rejection_rate": 0.092, "share_undefined": 0.0}, "es_2": {"coverage": 0.919, "n_defined": 1000, "n_fit": 1000, "n_reject": 81, "rejection_mc_se": 0.008628, "rejection_rate": 0.081, "share_undefined": 0.0}, "es_3": {"coverage": 0.856, "n_defined": 1000, "n_fit": 1000, "n_reject": 144, "rejection_mc_se": 0.011102, "rejection_rate": 0.144, "share_undefined": 0.0}, "es_4": {"coverage": 0.873, "n_defined": 1000, "n_fit": 1000, "n_reject": 127, "rejection_mc_se": 0.01053, "rejection_rate": 0.127, "share_undefined": 0.0}, "overall": {"coverage": 0.913, "n_defined": 1000, "n_fit": 1000, "n_reject": 87, "rejection_mc_se": 0.008912, "rejection_rate": 0.087, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 159, "rejection_mc_se": 0.011564, "rejection_rate": 0.159, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 366, "rejection_mc_se": 0.015233, "rejection_rate": 0.366, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.95, "n_defined": 1000, "n_fit": 1000, "n_reject": 50, "rejection_mc_se": 0.006892, "rejection_rate": 0.05, "share_undefined": 0.0}, "es_0": {"coverage": 0.933, "n_defined": 1000, "n_fit": 1000, "n_reject": 67, "rejection_mc_se": 0.007906, "rejection_rate": 0.067, "share_undefined": 0.0}, "es_1": {"coverage": 0.932, "n_defined": 1000, "n_fit": 1000, "n_reject": 68, "rejection_mc_se": 0.007961, "rejection_rate": 0.068, "share_undefined": 0.0}, "es_2": {"coverage": 0.943, "n_defined": 1000, "n_fit": 1000, "n_reject": 57, "rejection_mc_se": 0.007332, "rejection_rate": 0.057, "share_undefined": 0.0}, "es_3": {"coverage": 0.911, "n_defined": 1000, "n_fit": 1000, "n_reject": 89, "rejection_mc_se": 0.009004, "rejection_rate": 0.089, "share_undefined": 0.0}, "es_4": {"coverage": 0.919, "n_defined": 1000, "n_fit": 1000, "n_reject": 81, "rejection_mc_se": 0.008628, "rejection_rate": 0.081, "share_undefined": 0.0}, "overall": {"coverage": 0.935, "n_defined": 1000, "n_fit": 1000, "n_reject": 65, "rejection_mc_se": 0.007796, "rejection_rate": 0.065, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 101, "rejection_mc_se": 0.009529, "rejection_rate": 0.101, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 287, "rejection_mc_se": 0.014305, "rejection_rate": 0.287, "share_undefined": 0.0}}}, "seconds": 262.8, "units_per_cluster": 5}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [], "index": 38, "n_clusters": 32, "n_replications": 1000, "n_treated_per_cohort": 6, "results": {"bootstrap": {"es_-2": {"coverage": 0.918, "n_defined": 1000, "n_fit": 1000, "n_reject": 81, "rejection_mc_se": 0.008628, "rejection_rate": 0.081, "share_undefined": 0.0}, "es_0": {"coverage": 0.898, "n_defined": 1000, "n_fit": 1000, "n_reject": 99, "rejection_mc_se": 0.009445, "rejection_rate": 0.099, "share_undefined": 0.0}, "es_1": {"coverage": 0.913, "n_defined": 1000, "n_fit": 1000, "n_reject": 81, "rejection_mc_se": 0.008628, "rejection_rate": 0.081, "share_undefined": 0.0}, "es_2": {"coverage": 0.918, "n_defined": 1000, "n_fit": 1000, "n_reject": 82, "rejection_mc_se": 0.008676, "rejection_rate": 0.082, "share_undefined": 0.0}, "es_3": {"coverage": 0.875, "n_defined": 1000, "n_fit": 1000, "n_reject": 121, "rejection_mc_se": 0.010313, "rejection_rate": 0.121, "share_undefined": 0.0}, "es_4": {"coverage": 0.888, "n_defined": 1000, "n_fit": 1000, "n_reject": 111, "rejection_mc_se": 0.009934, "rejection_rate": 0.111, "share_undefined": 0.0}, "overall": {"coverage": 0.906, "n_defined": 1000, "n_fit": 1000, "n_reject": 93, "rejection_mc_se": 0.009184, "rejection_rate": 0.093, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 174, "rejection_mc_se": 0.011988, "rejection_rate": 0.174, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 221, "rejection_mc_se": 0.013121, "rejection_rate": 0.221, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.933, "n_defined": 1000, "n_fit": 1000, "n_reject": 67, "rejection_mc_se": 0.007906, "rejection_rate": 0.067, "share_undefined": 0.0}, "es_0": {"coverage": 0.924, "n_defined": 1000, "n_fit": 1000, "n_reject": 76, "rejection_mc_se": 0.00838, "rejection_rate": 0.076, "share_undefined": 0.0}, "es_1": {"coverage": 0.938, "n_defined": 1000, "n_fit": 1000, "n_reject": 62, "rejection_mc_se": 0.007626, "rejection_rate": 0.062, "share_undefined": 0.0}, "es_2": {"coverage": 0.937, "n_defined": 1000, "n_fit": 1000, "n_reject": 63, "rejection_mc_se": 0.007683, "rejection_rate": 0.063, "share_undefined": 0.0}, "es_3": {"coverage": 0.901, "n_defined": 1000, "n_fit": 1000, "n_reject": 99, "rejection_mc_se": 0.009445, "rejection_rate": 0.099, "share_undefined": 0.0}, "es_4": {"coverage": 0.91, "n_defined": 1000, "n_fit": 1000, "n_reject": 90, "rejection_mc_se": 0.00905, "rejection_rate": 0.09, "share_undefined": 0.0}, "overall": {"coverage": 0.936, "n_defined": 1000, "n_fit": 1000, "n_reject": 64, "rejection_mc_se": 0.00774, "rejection_rate": 0.064, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 90, "rejection_mc_se": 0.00905, "rejection_rate": 0.09, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 208, "rejection_mc_se": 0.012835, "rejection_rate": 0.208, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.945, "n_defined": 1000, "n_fit": 1000, "n_reject": 55, "rejection_mc_se": 0.007209, "rejection_rate": 0.055, "share_undefined": 0.0}, "es_0": {"coverage": 0.937, "n_defined": 1000, "n_fit": 1000, "n_reject": 63, "rejection_mc_se": 0.007683, "rejection_rate": 0.063, "share_undefined": 0.0}, "es_1": {"coverage": 0.951, "n_defined": 1000, "n_fit": 1000, "n_reject": 49, "rejection_mc_se": 0.006826, "rejection_rate": 0.049, "share_undefined": 0.0}, "es_2": {"coverage": 0.946, "n_defined": 1000, "n_fit": 1000, "n_reject": 54, "rejection_mc_se": 0.007147, "rejection_rate": 0.054, "share_undefined": 0.0}, "es_3": {"coverage": 0.932, "n_defined": 1000, "n_fit": 1000, "n_reject": 68, "rejection_mc_se": 0.007961, "rejection_rate": 0.068, "share_undefined": 0.0}, "es_4": {"coverage": 0.94, "n_defined": 1000, "n_fit": 1000, "n_reject": 60, "rejection_mc_se": 0.00751, "rejection_rate": 0.06, "share_undefined": 0.0}, "overall": {"coverage": 0.948, "n_defined": 1000, "n_fit": 1000, "n_reject": 52, "rejection_mc_se": 0.007021, "rejection_rate": 0.052, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 65, "rejection_mc_se": 0.007796, "rejection_rate": 0.065, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 165, "rejection_mc_se": 0.011738, "rejection_rate": 0.165, "share_undefined": 0.0}}}, "seconds": 259.6, "units_per_cluster": 5}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [], "index": 39, "n_clusters": 32, "n_replications": 1000, "n_treated_per_cohort": 8, "results": {"bootstrap": {"es_-2": {"coverage": 0.921, "n_defined": 1000, "n_fit": 1000, "n_reject": 78, "rejection_mc_se": 0.00848, "rejection_rate": 0.078, "share_undefined": 0.0}, "es_0": {"coverage": 0.945, "n_defined": 1000, "n_fit": 1000, "n_reject": 55, "rejection_mc_se": 0.007209, "rejection_rate": 0.055, "share_undefined": 0.0}, "es_1": {"coverage": 0.929, "n_defined": 1000, "n_fit": 1000, "n_reject": 66, "rejection_mc_se": 0.007851, "rejection_rate": 0.066, "share_undefined": 0.0}, "es_2": {"coverage": 0.925, "n_defined": 1000, "n_fit": 1000, "n_reject": 74, "rejection_mc_se": 0.008278, "rejection_rate": 0.074, "share_undefined": 0.0}, "es_3": {"coverage": 0.911, "n_defined": 1000, "n_fit": 1000, "n_reject": 88, "rejection_mc_se": 0.008959, "rejection_rate": 0.088, "share_undefined": 0.0}, "es_4": {"coverage": 0.91, "n_defined": 1000, "n_fit": 1000, "n_reject": 87, "rejection_mc_se": 0.008912, "rejection_rate": 0.087, "share_undefined": 0.0}, "overall": {"coverage": 0.923, "n_defined": 1000, "n_fit": 1000, "n_reject": 76, "rejection_mc_se": 0.00838, "rejection_rate": 0.076, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 127, "rejection_mc_se": 0.01053, "rejection_rate": 0.127, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 168, "rejection_mc_se": 0.011823, "rejection_rate": 0.168, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.946, "n_defined": 1000, "n_fit": 1000, "n_reject": 54, "rejection_mc_se": 0.007147, "rejection_rate": 0.054, "share_undefined": 0.0}, "es_0": {"coverage": 0.959, "n_defined": 1000, "n_fit": 1000, "n_reject": 41, "rejection_mc_se": 0.00627, "rejection_rate": 0.041, "share_undefined": 0.0}, "es_1": {"coverage": 0.955, "n_defined": 1000, "n_fit": 1000, "n_reject": 45, "rejection_mc_se": 0.006556, "rejection_rate": 0.045, "share_undefined": 0.0}, "es_2": {"coverage": 0.943, "n_defined": 1000, "n_fit": 1000, "n_reject": 57, "rejection_mc_se": 0.007332, "rejection_rate": 0.057, "share_undefined": 0.0}, "es_3": {"coverage": 0.933, "n_defined": 1000, "n_fit": 1000, "n_reject": 67, "rejection_mc_se": 0.007906, "rejection_rate": 0.067, "share_undefined": 0.0}, "es_4": {"coverage": 0.934, "n_defined": 1000, "n_fit": 1000, "n_reject": 66, "rejection_mc_se": 0.007851, "rejection_rate": 0.066, "share_undefined": 0.0}, "overall": {"coverage": 0.943, "n_defined": 1000, "n_fit": 1000, "n_reject": 57, "rejection_mc_se": 0.007332, "rejection_rate": 0.057, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 71, "rejection_mc_se": 0.008122, "rejection_rate": 0.071, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 160, "rejection_mc_se": 0.011593, "rejection_rate": 0.16, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.956, "n_defined": 1000, "n_fit": 1000, "n_reject": 44, "rejection_mc_se": 0.006486, "rejection_rate": 0.044, "share_undefined": 0.0}, "es_0": {"coverage": 0.963, "n_defined": 1000, "n_fit": 1000, "n_reject": 37, "rejection_mc_se": 0.005969, "rejection_rate": 0.037, "share_undefined": 0.0}, "es_1": {"coverage": 0.963, "n_defined": 1000, "n_fit": 1000, "n_reject": 37, "rejection_mc_se": 0.005969, "rejection_rate": 0.037, "share_undefined": 0.0}, "es_2": {"coverage": 0.952, "n_defined": 1000, "n_fit": 1000, "n_reject": 48, "rejection_mc_se": 0.00676, "rejection_rate": 0.048, "share_undefined": 0.0}, "es_3": {"coverage": 0.944, "n_defined": 1000, "n_fit": 1000, "n_reject": 56, "rejection_mc_se": 0.007271, "rejection_rate": 0.056, "share_undefined": 0.0}, "es_4": {"coverage": 0.954, "n_defined": 1000, "n_fit": 1000, "n_reject": 46, "rejection_mc_se": 0.006624, "rejection_rate": 0.046, "share_undefined": 0.0}, "overall": {"coverage": 0.956, "n_defined": 1000, "n_fit": 1000, "n_reject": 44, "rejection_mc_se": 0.006486, "rejection_rate": 0.044, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 52, "rejection_mc_se": 0.007021, "rejection_rate": 0.052, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 119, "rejection_mc_se": 0.010239, "rejection_rate": 0.119, "share_undefined": 0.0}}}, "seconds": 257.8, "units_per_cluster": 5}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [], "index": 40, "n_clusters": 32, "n_replications": 1000, "n_treated_per_cohort": 10, "results": {"bootstrap": {"es_-2": {"coverage": 0.931, "n_defined": 1000, "n_fit": 1000, "n_reject": 65, "rejection_mc_se": 0.007796, "rejection_rate": 0.065, "share_undefined": 0.0}, "es_0": {"coverage": 0.938, "n_defined": 1000, "n_fit": 1000, "n_reject": 62, "rejection_mc_se": 0.007626, "rejection_rate": 0.062, "share_undefined": 0.0}, "es_1": {"coverage": 0.928, "n_defined": 1000, "n_fit": 1000, "n_reject": 71, "rejection_mc_se": 0.008122, "rejection_rate": 0.071, "share_undefined": 0.0}, "es_2": {"coverage": 0.92, "n_defined": 1000, "n_fit": 1000, "n_reject": 79, "rejection_mc_se": 0.00853, "rejection_rate": 0.079, "share_undefined": 0.0}, "es_3": {"coverage": 0.911, "n_defined": 1000, "n_fit": 1000, "n_reject": 85, "rejection_mc_se": 0.008819, "rejection_rate": 0.085, "share_undefined": 0.0}, "es_4": {"coverage": 0.921, "n_defined": 1000, "n_fit": 1000, "n_reject": 78, "rejection_mc_se": 0.00848, "rejection_rate": 0.078, "share_undefined": 0.0}, "overall": {"coverage": 0.925, "n_defined": 1000, "n_fit": 1000, "n_reject": 73, "rejection_mc_se": 0.008226, "rejection_rate": 0.073, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 112, "rejection_mc_se": 0.009973, "rejection_rate": 0.112, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 148, "rejection_mc_se": 0.011229, "rejection_rate": 0.148, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.949, "n_defined": 1000, "n_fit": 1000, "n_reject": 51, "rejection_mc_se": 0.006957, "rejection_rate": 0.051, "share_undefined": 0.0}, "es_0": {"coverage": 0.959, "n_defined": 1000, "n_fit": 1000, "n_reject": 41, "rejection_mc_se": 0.00627, "rejection_rate": 0.041, "share_undefined": 0.0}, "es_1": {"coverage": 0.938, "n_defined": 1000, "n_fit": 1000, "n_reject": 62, "rejection_mc_se": 0.007626, "rejection_rate": 0.062, "share_undefined": 0.0}, "es_2": {"coverage": 0.945, "n_defined": 1000, "n_fit": 1000, "n_reject": 55, "rejection_mc_se": 0.007209, "rejection_rate": 0.055, "share_undefined": 0.0}, "es_3": {"coverage": 0.932, "n_defined": 1000, "n_fit": 1000, "n_reject": 68, "rejection_mc_se": 0.007961, "rejection_rate": 0.068, "share_undefined": 0.0}, "es_4": {"coverage": 0.941, "n_defined": 1000, "n_fit": 1000, "n_reject": 59, "rejection_mc_se": 0.007451, "rejection_rate": 0.059, "share_undefined": 0.0}, "overall": {"coverage": 0.94, "n_defined": 1000, "n_fit": 1000, "n_reject": 60, "rejection_mc_se": 0.00751, "rejection_rate": 0.06, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 53, "rejection_mc_se": 0.007085, "rejection_rate": 0.053, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 132, "rejection_mc_se": 0.010704, "rejection_rate": 0.132, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.957, "n_defined": 1000, "n_fit": 1000, "n_reject": 43, "rejection_mc_se": 0.006415, "rejection_rate": 0.043, "share_undefined": 0.0}, "es_0": {"coverage": 0.963, "n_defined": 1000, "n_fit": 1000, "n_reject": 37, "rejection_mc_se": 0.005969, "rejection_rate": 0.037, "share_undefined": 0.0}, "es_1": {"coverage": 0.943, "n_defined": 1000, "n_fit": 1000, "n_reject": 57, "rejection_mc_se": 0.007332, "rejection_rate": 0.057, "share_undefined": 0.0}, "es_2": {"coverage": 0.952, "n_defined": 1000, "n_fit": 1000, "n_reject": 48, "rejection_mc_se": 0.00676, "rejection_rate": 0.048, "share_undefined": 0.0}, "es_3": {"coverage": 0.951, "n_defined": 1000, "n_fit": 1000, "n_reject": 49, "rejection_mc_se": 0.006826, "rejection_rate": 0.049, "share_undefined": 0.0}, "es_4": {"coverage": 0.952, "n_defined": 1000, "n_fit": 1000, "n_reject": 48, "rejection_mc_se": 0.00676, "rejection_rate": 0.048, "share_undefined": 0.0}, "overall": {"coverage": 0.952, "n_defined": 1000, "n_fit": 1000, "n_reject": 48, "rejection_mc_se": 0.00676, "rejection_rate": 0.048, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 41, "rejection_mc_se": 0.00627, "rejection_rate": 0.041, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 102, "rejection_mc_se": 0.009571, "rejection_rate": 0.102, "share_undefined": 0.0}}}, "seconds": 210.1, "units_per_cluster": 5}, + {"fit_failures": {"bootstrap": 0, "hc1": 0, "jackknife": 0}, "flags": [], "index": 41, "n_clusters": 32, "n_replications": 1000, "n_treated_per_cohort": 12, "results": {"bootstrap": {"es_-2": {"coverage": 0.924, "n_defined": 1000, "n_fit": 1000, "n_reject": 74, "rejection_mc_se": 0.008278, "rejection_rate": 0.074, "share_undefined": 0.0}, "es_0": {"coverage": 0.934, "n_defined": 1000, "n_fit": 1000, "n_reject": 65, "rejection_mc_se": 0.007796, "rejection_rate": 0.065, "share_undefined": 0.0}, "es_1": {"coverage": 0.928, "n_defined": 1000, "n_fit": 1000, "n_reject": 69, "rejection_mc_se": 0.008015, "rejection_rate": 0.069, "share_undefined": 0.0}, "es_2": {"coverage": 0.938, "n_defined": 1000, "n_fit": 1000, "n_reject": 62, "rejection_mc_se": 0.007626, "rejection_rate": 0.062, "share_undefined": 0.0}, "es_3": {"coverage": 0.907, "n_defined": 1000, "n_fit": 1000, "n_reject": 88, "rejection_mc_se": 0.008959, "rejection_rate": 0.088, "share_undefined": 0.0}, "es_4": {"coverage": 0.908, "n_defined": 1000, "n_fit": 1000, "n_reject": 87, "rejection_mc_se": 0.008912, "rejection_rate": 0.087, "share_undefined": 0.0}, "overall": {"coverage": 0.92, "n_defined": 1000, "n_fit": 1000, "n_reject": 80, "rejection_mc_se": 0.008579, "rejection_rate": 0.08, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 132, "rejection_mc_se": 0.010704, "rejection_rate": 0.132, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 152, "rejection_mc_se": 0.011353, "rejection_rate": 0.152, "share_undefined": 0.0}}, "hc1": {"es_-2": {"coverage": 0.95, "n_defined": 1000, "n_fit": 1000, "n_reject": 50, "rejection_mc_se": 0.006892, "rejection_rate": 0.05, "share_undefined": 0.0}, "es_0": {"coverage": 0.949, "n_defined": 1000, "n_fit": 1000, "n_reject": 51, "rejection_mc_se": 0.006957, "rejection_rate": 0.051, "share_undefined": 0.0}, "es_1": {"coverage": 0.948, "n_defined": 1000, "n_fit": 1000, "n_reject": 52, "rejection_mc_se": 0.007021, "rejection_rate": 0.052, "share_undefined": 0.0}, "es_2": {"coverage": 0.95, "n_defined": 1000, "n_fit": 1000, "n_reject": 50, "rejection_mc_se": 0.006892, "rejection_rate": 0.05, "share_undefined": 0.0}, "es_3": {"coverage": 0.927, "n_defined": 1000, "n_fit": 1000, "n_reject": 73, "rejection_mc_se": 0.008226, "rejection_rate": 0.073, "share_undefined": 0.0}, "es_4": {"coverage": 0.935, "n_defined": 1000, "n_fit": 1000, "n_reject": 65, "rejection_mc_se": 0.007796, "rejection_rate": 0.065, "share_undefined": 0.0}, "overall": {"coverage": 0.937, "n_defined": 1000, "n_fit": 1000, "n_reject": 63, "rejection_mc_se": 0.007683, "rejection_rate": 0.063, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 73, "rejection_mc_se": 0.008226, "rejection_rate": 0.073, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 141, "rejection_mc_se": 0.011005, "rejection_rate": 0.141, "share_undefined": 0.0}}, "jackknife": {"es_-2": {"coverage": 0.962, "n_defined": 1000, "n_fit": 1000, "n_reject": 38, "rejection_mc_se": 0.006046, "rejection_rate": 0.038, "share_undefined": 0.0}, "es_0": {"coverage": 0.962, "n_defined": 1000, "n_fit": 1000, "n_reject": 38, "rejection_mc_se": 0.006046, "rejection_rate": 0.038, "share_undefined": 0.0}, "es_1": {"coverage": 0.961, "n_defined": 1000, "n_fit": 1000, "n_reject": 39, "rejection_mc_se": 0.006122, "rejection_rate": 0.039, "share_undefined": 0.0}, "es_2": {"coverage": 0.957, "n_defined": 1000, "n_fit": 1000, "n_reject": 43, "rejection_mc_se": 0.006415, "rejection_rate": 0.043, "share_undefined": 0.0}, "es_3": {"coverage": 0.944, "n_defined": 1000, "n_fit": 1000, "n_reject": 56, "rejection_mc_se": 0.007271, "rejection_rate": 0.056, "share_undefined": 0.0}, "es_4": {"coverage": 0.952, "n_defined": 1000, "n_fit": 1000, "n_reject": 48, "rejection_mc_se": 0.00676, "rejection_rate": 0.048, "share_undefined": 0.0}, "overall": {"coverage": 0.956, "n_defined": 1000, "n_fit": 1000, "n_reject": 44, "rejection_mc_se": 0.006486, "rejection_rate": 0.044, "share_undefined": 0.0}, "pretrend_bonferroni": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 48, "rejection_mc_se": 0.00676, "rejection_rate": 0.048, "share_undefined": 0.0}, "pretrend_wald_chi2": {"coverage": NaN, "n_defined": 1000, "n_fit": 1000, "n_reject": 107, "rejection_mc_se": 0.009775, "rejection_rate": 0.107, "share_undefined": 0.0}}}, "seconds": 205.1, "units_per_cluster": 5} + ] +} diff --git a/benchmarks/python/cs_jackknife_size.py b/benchmarks/python/cs_jackknife_size.py new file mode 100644 index 000000000..b942f31fe --- /dev/null +++ b/benchmarks/python/cs_jackknife_size.py @@ -0,0 +1,356 @@ +#!/usr/bin/env python3 +"""Size of CallawaySantAnna inference with few clusters: hc1, bootstrap, jackknife. + +Question: at a nominal 5% level and with no treatment effect, how often do +the three inference methods of ``CallawaySantAnna`` reject, as a function of +the number of clusters and of treated clusters? Karim, Nielsen, MacKinnon & +Webb (2026, arXiv:2602.12043) answer it for Stata ``csdid`` on CPS data +(Tables 2-3). This script answers it for this library, whose clustered +``hc1`` path already differs from ``csdid`` (a ``G/(G-1)`` factor and a +``t(G-1)`` reference), and it covers the quantities the paper has no +evidence for: event-study coefficients and the pre-trend test. + +Everything below was fixed before the first run and is not searched. + +Design (the paper's): ``T = 8`` periods, two cohorts adopting in periods 4 +and 6 with ``J`` treated clusters each, the remaining clusters never +treated, no effect. + +Outcome: ``y_it = a_c + d_t + u_ct + e_it``, every draw Gaussian. ``a_c`` and +``d_t`` are ``N(0, 1)``. ``u_ct`` is a cluster-level AR(1) with coefficient +0.8 and innovation sd 1, started from its stationary distribution +``N(0, 1 / (1 - 0.64))``. ``e_it`` is unit-level iid ``N(0, 1)``, present +only when a cluster has more than one unit. + +Grid: the paper's Table 1 (21 cells, each leaving at least two never-treated +clusters) for 1 and for 5 units per cluster, 42 design points. 1,000 +replications per design point; the design points' generators are +``np.random.SeedSequence(20261125).spawn(42)`` in grid order, so the results +do not depend on how the points are scheduled. + +Methods, all clustered on the cluster column: + hc1 ``CallawaySantAnna(cluster=...)`` + bootstrap ``CallawaySantAnna(cluster=..., n_bootstrap=499)`` + jackknife ``CallawaySantAnna(cluster=..., vcov_type="jackknife")`` + +Quantities: the overall ATT; each post-treatment event-study coefficient +(event times 0 to 4); the pre-period coefficient at event time -2; and two +pre-trend tests over the pre-period event-study coefficients: Bonferroni on +the per-row p-values (the test ``DiagnosticReport`` applies to a jackknife +fit) and the chi-square joint Wald on the event-study covariance (the test +it applies to an ``hc1`` fit). + +Scoring: a replication whose inference is undefined (NaN p-value) is counted +on its own and never as a non-rejection; rejection and 95% coverage are over +the defined replications. + +Flag rule (set in advance; it flags, it hides nothing): a design point is +flagged when the jackknife rejection rate of an event-study coefficient or +of the Bonferroni pre-trend test exceeds the jackknife rejection rate of the +overall ATT at the same design point by more than 3 percentage points. With +1,000 replications a difference of two such rates has a Monte Carlo standard +error near 0.01, and about 300 comparisons are made, so a few flags are +expected by chance alone; the count is to be read against that. + +The output JSON underwrites the "Cluster jackknife" notes in +``docs/methodology/REGISTRY.md`` section ``CallawaySantAnna``. + +Usage: + python benchmarks/python/cs_jackknife_size.py \\ + --output benchmarks/data/cs_jackknife_size.json + + # Timing only: 20 replications of the largest design point + python benchmarks/python/cs_jackknife_size.py --timing +""" + +import argparse +import json +import os +import sys +import time +import warnings +from concurrent.futures import ProcessPoolExecutor +from pathlib import Path + +for _var in ( + "OMP_NUM_THREADS", + "OPENBLAS_NUM_THREADS", + "VECLIB_MAXIMUM_THREADS", + "MKL_NUM_THREADS", +): + os.environ.setdefault(_var, "1") + +import numpy as np # noqa: E402 +import pandas as pd # noqa: E402 +from scipy import stats # noqa: E402 + +sys.path.insert(0, str(Path(__file__).resolve().parents[2])) + +import diff_diff # noqa: E402 +from diff_diff import CallawaySantAnna # noqa: E402 + +SEED = 20261125 +ALPHA = 0.05 +N_PERIODS = 8 +COHORTS = (4, 6) +RHO = 0.8 +N_BOOTSTRAP = 499 +POST_EVENT_TIMES = (0, 1, 2, 3, 4) +PRE_EVENT_TIME = -2 +FLAG_MARGIN = 0.03 +TABLE_1 = { + 8: (1, 2, 3), + 16: (1, 2, 3, 4), + 24: (1, 2, 3, 4, 6, 8), + 32: (1, 2, 3, 4, 6, 8, 10, 12), +} +UNITS_PER_CLUSTER = (1, 5) +METHODS = ("hc1", "bootstrap", "jackknife") +FIT_KW = {"outcome": "y", "unit": "unit", "time": "t", "first_treat": "g"} + + +def design_points(): + """The 42 design points, in the fixed order their seeds are spawned in.""" + return [(h, j, m) for m in UNITS_PER_CLUSTER for h in sorted(TABLE_1) for j in TABLE_1[h]] + + +def simulate_panel(rng, n_clusters, n_treated_per_cohort, units_per_cluster): + """One panel of the fixed design with no treatment effect.""" + periods = np.arange(1, N_PERIODS + 1) + cluster_effect = rng.normal(size=n_clusters) + period_effect = rng.normal(size=N_PERIODS) + shock = np.empty((n_clusters, N_PERIODS)) + shock[:, 0] = rng.normal(scale=np.sqrt(1.0 / (1.0 - RHO**2)), size=n_clusters) + for t in range(1, N_PERIODS): + shock[:, t] = RHO * shock[:, t - 1] + rng.normal(size=n_clusters) + cohort = np.zeros(n_clusters, dtype=int) + cohort[:n_treated_per_cohort] = COHORTS[0] + cohort[n_treated_per_cohort : 2 * n_treated_per_cohort] = COHORTS[1] + + cluster = np.repeat(np.arange(n_clusters), units_per_cluster) + n_units = cluster.size + y = cluster_effect[cluster][:, None] + period_effect[None, :] + shock[cluster] + if units_per_cluster > 1: + y = y + rng.normal(size=(n_units, N_PERIODS)) + return pd.DataFrame( + { + "unit": np.repeat(np.arange(n_units), N_PERIODS), + "cluster": np.repeat(cluster, N_PERIODS), + "t": np.tile(periods, n_units), + "g": np.repeat(cohort[cluster], N_PERIODS), + "y": y.reshape(-1), + } + ) + + +def estimator(method, seed): + if method == "hc1": + return CallawaySantAnna(cluster="cluster") + if method == "bootstrap": + return CallawaySantAnna(cluster="cluster", n_bootstrap=N_BOOTSTRAP, seed=seed) + return CallawaySantAnna(cluster="cluster", vcov_type="jackknife") + + +def quantities(results): + """``{name: (p_value, covers_zero)}`` for one fit; NaN p marks undefined.""" + out = { + "overall": ( + float(results.p_value), + bool(results.conf_int[0] <= 0.0 <= results.conf_int[1]), + ) + } + es = results.aggregate("event_study") + times = [int(e) for e in np.asarray(es.event_time).tolist()] + position = {e: i for i, e in enumerate(times)} + for e in POST_EVENT_TIMES + (PRE_EVENT_TIME,): + name = f"es_{e}" + if e not in position: + out[name] = (float("nan"), False) + continue + i = position[e] + out[name] = ( + float(es.p_value[i]), + bool(es.conf_int_lower[i] <= 0.0 <= es.conf_int_upper[i]), + ) + + pre = [i for i, e in enumerate(times) if e < 0 and not bool(es.is_reference[i])] + pre_p = np.array([float(es.p_value[i]) for i in pre]) + # Bonferroni over the per-row p-values, valid only when every retained + # pre-period row has one (the report's rule). + if pre and np.all(np.isfinite(pre_p)): + out["pretrend_bonferroni"] = (float(min(1.0, len(pre) * pre_p.min())), False) + else: + out["pretrend_bonferroni"] = (float("nan"), False) + # Chi-square joint Wald on the event-study covariance. + wald_p = float("nan") + if es.vcov is not None and es.vcov_index is not None and pre: + index = [int(e) for e in np.asarray(es.vcov_index).tolist()] + where = {e: k for k, e in enumerate(index)} + pre_times = [times[i] for i in pre] + if all(e in where for e in pre_times): + rows = [where[e] for e in pre_times] + sub = np.asarray(es.vcov)[np.ix_(rows, rows)] + beta = np.array([float(es.att[i]) for i in pre]) + try: + stat = float(beta @ np.linalg.solve(sub, beta)) + if np.isfinite(stat) and stat >= 0: + wald_p = float(stats.chi2.sf(stat, len(pre))) + except np.linalg.LinAlgError: + pass + out["pretrend_wald_chi2"] = (wald_p, False) + return out + + +def run_design_point(args): + """All replications of one design point. Returns its result record.""" + index, n_clusters, n_treated, units_per_cluster, n_reps, child_state = args + rng = np.random.default_rng(np.random.SeedSequence(**child_state)) + tallies = {} + failures = {method: 0 for method in METHODS} + started = time.perf_counter() + for _ in range(n_reps): + panel = simulate_panel(rng, n_clusters, n_treated, units_per_cluster) + boot_seed = int(rng.integers(0, 2**31 - 1)) + for method in METHODS: + try: + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + fit = estimator(method, boot_seed).fit(panel, **FIT_KW) + values = quantities(fit) + except Exception: # noqa: BLE001 - counted, never swallowed silently + failures[method] += 1 + continue + for name, (p_value, covers) in values.items(): + cell = tallies.setdefault((method, name), [0, 0, 0, 0]) + cell[0] += 1 + if np.isfinite(p_value): + cell[1] += 1 + cell[2] += int(p_value < ALPHA) + cell[3] += int(covers) + record = { + "index": index, + "n_clusters": n_clusters, + "n_treated_per_cohort": n_treated, + "units_per_cluster": units_per_cluster, + "n_replications": n_reps, + "fit_failures": failures, + "seconds": round(time.perf_counter() - started, 1), + "results": {}, + } + for (method, name), (n_fit, n_defined, n_reject, n_cover) in sorted(tallies.items()): + rate = n_reject / n_defined if n_defined else float("nan") + # Derived ratios are rounded to 6 decimals to keep the committed file + # small; the counts they come from are stored exactly. + record["results"].setdefault(method, {})[name] = { + "n_fit": n_fit, + "n_defined": n_defined, + "n_reject": n_reject, + "share_undefined": round(1.0 - n_defined / n_fit, 6) if n_fit else float("nan"), + "rejection_rate": round(rate, 6), + "rejection_mc_se": ( + round(float(np.sqrt(rate * (1.0 - rate) / n_defined)), 6) + if n_defined + else float("nan") + ), + "coverage": ( + round(n_cover / n_defined, 6) + if n_defined and not name.startswith("pretrend") + else float("nan") + ), + } + return record + + +def flags(record): + """Jackknife quantities whose rejection exceeds the overall ATT's by the margin.""" + jk = record["results"].get("jackknife", {}) + base = jk.get("overall", {}).get("rejection_rate", float("nan")) + out = [] + for name, cell in jk.items(): + if name in ("overall", "pretrend_wald_chi2"): + continue + rate = cell["rejection_rate"] + if np.isfinite(rate) and np.isfinite(base) and rate - base > FLAG_MARGIN: + out.append({"quantity": name, "rejection_rate": rate, "overall": base}) + return out + + +def main(): + parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + parser.add_argument("--output", type=str, default=None) + parser.add_argument("--n-replications", type=int, default=1000) + parser.add_argument("--workers", type=int, default=max(1, (os.cpu_count() or 2) - 2)) + parser.add_argument("--timing", action="store_true", help="time 20 replications, no results") + args = parser.parse_args() + + points = design_points() + children = np.random.SeedSequence(SEED).spawn(len(points)) + jobs = [ + ( + i, + h, + j, + m, + args.n_replications, + {"entropy": child.entropy, "spawn_key": child.spawn_key}, + ) + for i, ((h, j, m), child) in enumerate(zip(points, children)) + ] + + if args.timing: + i, h, j, m, _, state = max(jobs, key=lambda job: (job[1] * job[3], job[2])) + started = time.perf_counter() + run_design_point((i, h, j, m, 20, state)) + per_rep = (time.perf_counter() - started) / 20 + print( + f"largest design point (H={h}, J={j}, units/cluster={m}): {per_rep:.3f} s/replication" + ) + return + + started = time.perf_counter() + records = [] + with ProcessPoolExecutor(max_workers=args.workers) as pool: + for record in pool.map(run_design_point, jobs): + record["flags"] = flags(record) + records.append(record) + jk = record["results"]["jackknife"]["overall"]["rejection_rate"] + hc1 = record["results"]["hc1"]["overall"]["rejection_rate"] + print( + f"H={record['n_clusters']:>2} J={record['n_treated_per_cohort']:>2} " + f"m={record['units_per_cluster']}: overall hc1 {hc1:.3f} jackknife {jk:.3f} " + f"flags {len(record['flags'])} ({record['seconds']} s)", + flush=True, + ) + payload = { + "meta": { + "seed": SEED, + "alpha": ALPHA, + "n_periods": N_PERIODS, + "cohorts": list(COHORTS), + "ar1_coefficient": RHO, + "n_bootstrap": N_BOOTSTRAP, + "n_replications": args.n_replications, + "flag_margin": FLAG_MARGIN, + "diff_diff_version": diff_diff.__version__, + "backend": os.environ.get("DIFF_DIFF_BACKEND", "auto"), + "wall_seconds": round(time.perf_counter() - started, 1), + "workers": args.workers, + }, + "design_points": sorted(records, key=lambda r: r["index"]), + } + if args.output: + # One line per design point: readable diffs without ten thousand lines. + lines = [ + "{", + f' "meta": {json.dumps(payload["meta"], sort_keys=True)},', + ' "design_points": [', + ] + rows = [json.dumps(record, sort_keys=True) for record in payload["design_points"]] + lines.append(",\n".join(f" {row}" for row in rows)) + lines.extend([" ]", "}"]) + Path(args.output).write_text("\n".join(lines) + "\n") + print(f"wrote {args.output}") + + +if __name__ == "__main__": + main() diff --git a/changelog.d/20261125-cs-jackknife.md b/changelog.d/20261125-cs-jackknife.md new file mode 100644 index 000000000..fd1b14c44 --- /dev/null +++ b/changelog.d/20261125-cs-jackknife.md @@ -0,0 +1,32 @@ +### Added +- **Cluster jackknife inference for `CallawaySantAnna`** (`vcov_type="jackknife"`): + the delete-one-cluster jackknife (CV3) of Karim, Nielsen, MacKinnon & Webb + (2026, arXiv:2602.12043), for designs with few clusters, where the default + influence-function standard errors and the multiplier bootstrap reject a true + null too often. Each cluster (the `cluster=` column, or the unit when none is + given) is deleted in turn, the estimator is re-run, and the variance is + `((H - 1) / H) * sum_h (theta_h - theta)^2` around the full-sample estimate, + with a `t(H - 1)` reference. It applies to the overall ATT, every ATT(g,t) and + the `event_study` / `group` aggregations (the event-study container carries + the jackknife covariance). `results.get_loo_effects_df()` lists the + delete-one overall ATTs. Overall, event-study and group standard errors match + R `did` on delete-one samples to 1e-8. + - In the library's size simulation (no effect, nominal 5%, 8 to 32 clusters) + the jackknife rejected 3-10% for the overall ATT with two or more treated + clusters per cohort, against 4-15% for the clustered default and 7-21% for + the multiplier bootstrap; with one treated cluster per cohort it rejected + 8-18% against 15-35%. A fit warns when a reported quantity rests on fewer + than three treated clusters. + - A deletion that leaves no estimate makes every jackknife standard error + NaN; a cell, horizon or cohort that is not estimable in every delete-one + sample gets a NaN standard error. + - Not combinable with `n_bootstrap > 0`, `survey_design=` or + `allow_unbalanced_panel=True`; `panel=False` needs `cluster=`. + - `DiagnosticReport` gives a jackknife fit a Bonferroni pre-trend check (no + covariance-based joint Wald) and skips its pre-trends power section. + - `CallawaySantAnna(vcov_type="jackknife")` can be passed to + `diagnose_design` as a candidate. + +### Changed +- **Tutorial 2 (staggered DiD)** no longer says the multiplier bootstrap gives + valid inference with few clusters; it points to the cluster jackknife. diff --git a/diff_diff/aggregation.py b/diff_diff/aggregation.py index ce29cd700..3c0560f01 100644 --- a/diff_diff/aggregation.py +++ b/diff_diff/aggregation.py @@ -577,6 +577,11 @@ class AggregationKit: ``None`` on analytical fits and on pre-replay legacy artifacts (whose bootstrapped recompute levels fail closed with a refit message). + jackknife : JackknifeReplicates or None + Delete-one-cluster replicates of a + ``CallawaySantAnna(vcov_type="jackknife")`` fit, from which the + recompute levels form their jackknife standard errors. ``None`` on + every other fit (and on artifacts pickled before the field existed). """ bookkeeping: Dict[str, Any] @@ -585,6 +590,70 @@ class AggregationKit: anticipation: int cband: bool bootstrap: Optional["BootstrapReplaySpec"] = None + jackknife: Optional["JackknifeReplicates"] = None + + +@dataclass(frozen=True) +class JackknifeReplicates: + """Delete-one-cluster replicates of a cluster-jackknife fit. + + Private kit payload of ``CallawaySantAnna(vcov_type="jackknife")``. One + entry per deletion unit, in deletion order. It holds point estimates + only - no influence functions and no data - so the retained size is + O(H x n_gt) small dicts. + + Attributes + ---------- + labels : tuple + Row labels of the deletion units. Real labels only when the deletion + unit is a cluster coarser than the estimation unit; otherwise the + position of the unit in the kit's canonical unit order, so that no + raw unit identifier is retained (``labels_are_codes``). + unit_name : str + Name shown for the deletion unit: the cluster column, or ``"unit"``. + labels_are_codes : bool + Whether ``labels`` are position codes instead of raw labels. + roles : tuple of str + ``"treated"`` when the deletion unit holds an ever-treated unit, + else ``"control"``. + att : tuple of float + Overall ATT of each delete-one refit (NaN when undefined). + cells : tuple of dict + Per replicate, ``{(g, t): {"effect", "n_treated"[, "agg_weight", + "is_reference"]}}`` - exactly the keys point aggregation reads. + cohort_masses : tuple + Per replicate, the fixed cohort aggregation masses of that refit + (``fixed_cohort_agg_weights``), or ``None`` when the refit weights by + each cell's own count. + n_cells : tuple of int + Number of cells with a finite effect in each replicate. + changed : tuple of bool + Whether the replicate's finite cells differ from the full sample's. + undefined : tuple + ``None`` for a usable replicate, otherwise the reason its refit + produced no overall ATT. + cell_treated : dict + ``{(g, t): positions}``: the deletion units (by position in + ``labels``) that hold treated units of that cell. Used to warn when + a reported quantity rests on very few treated clusters. + """ + + labels: Tuple[Any, ...] + unit_name: str + labels_are_codes: bool + roles: Tuple[str, ...] + att: Tuple[float, ...] + cells: Tuple[Dict[Any, Dict[str, Any]], ...] + cohort_masses: Tuple[Optional[Dict[Any, float]], ...] + n_cells: Tuple[int, ...] + changed: Tuple[bool, ...] + undefined: Tuple[Optional[str], ...] + cell_treated: Dict[Any, Tuple[int, ...]] = field(default_factory=dict) + + @property + def n_replicates(self) -> int: + """Number of deletion units ``H``.""" + return len(self.labels) @dataclass diff --git a/diff_diff/diagnostic_report.py b/diff_diff/diagnostic_report.py index da0340d3c..95bf171ab 100644 --- a/diff_diff/diagnostic_report.py +++ b/diff_diff/diagnostic_report.py @@ -1140,6 +1140,19 @@ def _instance_skip_reason(self, check: str) -> Optional[str]: # bypass this gate. if "pretrends_power" in self._precomputed: return None + if getattr(r, "vcov_type", None) == "jackknife": + # Same policy as the joint Wald in the parallel-trends + # check: the power calculation models a normal-reference + # Wald pre-test on the event-study covariance, which is not + # the test a cluster-jackknife fit is given (Bonferroni over + # per-row t(H - 1) p-values), so its MDV would overstate + # what that test can detect. + return ( + "Pre-trends power is not computed for a cluster-jackknife " + "fit (vcov_type='jackknife'): it models a normal-reference " + "Wald pre-test on the event-study covariance, which is not " + "the pre-trend test applied to this fit." + ) has_vcov = getattr(r, "vcov", None) is not None has_event_vcov = getattr(r, "event_study_vcov", None) is not None has_event_es = getattr(r, "event_study_effects", None) is not None @@ -1876,7 +1889,14 @@ def _mark_derived(section: Dict[str, Any]) -> Dict[str, Any]: # implemented (tracked in DEFERRED.md). Bonferroni over the # BM-adjusted per-row p-values keeps the small-sample correction. # See REGISTRY.md StackedDiD / REPORTING.md PT notes. - if getattr(r, "vcov_type", None) != "hc2_bm": + # Cluster-jackknife fits (CallawaySantAnna vcov_type="jackknife") + # take the same policy for the same reason: no reference + # distribution is established for a Wald statistic built on a + # delete-one-cluster covariance, and the chi-square reference + # ignores the t(H - 1) small-sample reference the per-row jackknife + # inference uses. Bonferroni over the per-row t(H - 1) p-values + # keeps it. + if getattr(r, "vcov_type", None) not in ("hc2_bm", "jackknife"): es_vcov = getattr(r, "event_study_vcov", None) es_vcov_index = getattr(r, "event_study_vcov_index", None) if es_vcov is None or es_vcov_index is None: diff --git a/diff_diff/guides/llms-full.txt b/diff_diff/guides/llms-full.txt index 3b26b3c12..d923a770f 100644 --- a/diff_diff/guides/llms-full.txt +++ b/diff_diff/guides/llms-full.txt @@ -189,7 +189,7 @@ CallawaySantAnna( base_period: str = "varying", # "varying" or "universal" cband: bool = True, # Simultaneous confidence bands pscore_trim: float = 0.01, # Propensity score trimming bound - vcov_type: str = "hc1", # {"hc1"} only — IF-based variance per Callaway & Sant'Anna (2021). Analytical-sandwich {classical, hc2, hc2_bm} and conley REJECTED at __init__ (see REGISTRY.md IF-vs-sandwich subsection). + vcov_type: str = "hc1", # "hc1" (IF-based variance; CR1 on the IF with cluster=) or "jackknife" (cluster jackknife CV3, Karim et al. 2026: delete-one-cluster re-estimation, t(H-1); see below). Analytical-sandwich {classical, hc2, hc2_bm} and conley REJECTED at __init__ (see REGISTRY) ) ``` @@ -252,6 +252,46 @@ boot_res = boot.fit(data, outcome='outcome', unit='unit', time='period', plot_event_study(boot_res.aggregate('event_study')) # replays the bootstrap ``` +**Few clusters: `vcov_type="jackknife"`.** With few clusters (above all few +treated clusters) the default standard errors and the multiplier bootstrap +over-reject. The cluster jackknife (CV3; Karim, Nielsen, MacKinnon & Webb +2026) deletes each cluster in turn (the `cluster=` column, or the unit when +none is given), re-runs the estimator, and forms the variance +`((H-1)/H) * sum_h (theta_h - theta)^2` around the full-sample estimate, with +a `t(H-1)` reference. It covers the overall ATT, every ATT(g,t) and the +`event_study` / `group` aggregations (`aggregate('event_study').vcov` is the +jackknife covariance). + +```python +jk = CallawaySantAnna(cluster='state', vcov_type='jackknife') +jk_res = jk.fit(data, outcome='outcome', unit='unit', time='period', + first_treat='first_treat') +jk_res.df_inference # H - 1 +jk_res.get_loo_effects_df() # delete-one overall ATTs, most influential first +jk_res.aggregate('event_study') # jackknife SEs, t(H-1) +``` + +- Costs `H + 1` extra estimations. Not combinable with `n_bootstrap > 0`, + `survey_design=` or `allow_unbalanced_panel=True`; `panel=False` needs + `cluster=`. +- It reduces over-rejection but does not remove it with very few treated + clusters: the fit and `aggregate()` warn when a reported quantity rests on + fewer than 3 treated clusters (in the library's simulation, 6-18% rejection + at a nominal 5% with two). +- A deletion that leaves no estimate (e.g. it removes the only comparison + cluster) makes every jackknife SE NaN; a cell, horizon or cohort that is not + estimable in every delete-one sample gets a NaN SE. +- `get_loo_effects_df()` shows real labels for clusters coarser than the + unit and position codes when the unit itself is deleted (results objects + keep no raw unit identifiers). +- `DiagnosticReport` on a jackknife fit runs a Bonferroni pre-trend check + (no covariance-based joint Wald) and skips the pre-trends power section. + When the number of event-study horizons approaches `H` the jackknife + covariance is near-singular and `HonestDiD` refuses it. +- It is a valid `diagnose_design` candidate: pass + `CallawaySantAnna(vcov_type='jackknife')` (unit-level; a non-unit `cluster=` + needs `resample_units=False`). + ### ChaisemartinDHaultfoeuille de Chaisemartin & D'Haultfœuille (2020/2022) estimator for **non-absorbing (reversible) treatments**. The most general library estimator for treatments that switch on AND off over time (allows dynamic/carryover effects + joiner/leaver decomposition); `LPDiD` (`non_absorbing="first_entry"`/`"effect_stabilization"`) and `TROP` (`non_absorbing=True`, no-dynamic-effects) also handle non-absorbing treatment under stronger assumptions. Ships `DID_M` (= `DID_1` at horizon `l = 1`) plus the full multi-horizon event study `DID_l` for `l = 1..L_max` from the dynamic companion paper (NBER WP 29873). Includes normalized estimator `DID^n_l`, cost-benefit aggregate `delta`, dynamic placebos `DID^{pl}_l`, and sup-t simultaneous confidence bands. @@ -1566,7 +1606,7 @@ Returned by `CallawaySantAnna.fit()`. | `event_study_effects` | `dict[int, dict] | None` | Legacy field - `None` on EVERY fit since 4.0 (fit() computes no event-study surface); use `aggregate("event_study")` | | `group_effects` | `dict | None` | Legacy field - `None` on EVERY fit since 4.0; use `aggregate("group")` | -**Methods:** `aggregate(type, weights=None, *, balance_e=None)`, `summary()`, `print_summary()`, `to_dataframe(level="group_time")` (`level="event_study"` returns `aggregate('event_study').to_dataframe()` - the unified `EVENT_STUDY_SCHEMA` frame, 4.0 M-093; `level="group"` raises on 4.0 fits) +**Methods:** `aggregate(type, weights=None, *, balance_e=None)`, `get_loo_effects_df()` (cluster-jackknife fits only: delete-one overall ATTs), `summary()`, `print_summary()`, `to_dataframe(level="group_time")` (`level="event_study"` returns `aggregate('event_study').to_dataframe()` - the unified `EVENT_STUDY_SCHEMA` frame, 4.0 M-093; `level="group"` raises on 4.0 fits) `aggregate("simple"|"event_study"|"group"|"total")` re-aggregates POST-FIT with no @@ -1808,7 +1848,7 @@ Each event study effect dict contains: `effect`, `se`, `t_stat`, `p_value`, `con | Attribute | Type | Description | |-----------|------|-------------| -| `vcov_type` | `str` | Variance estimator family (`"hc1"` for IF-based estimators; permanently narrow on `ImputationDiD` / `CallawaySantAnna` / `TripleDifference` / `EfficientDiD` per IF-vs-sandwich taxonomy) | +| `vcov_type` | `str` | Variance estimator family (`"hc1"` for IF-based estimators; permanently narrow on `ImputationDiD` / `TripleDifference` / `EfficientDiD` per IF-vs-sandwich taxonomy; `CallawaySantAnna` also accepts `"jackknife"`, the delete-one-cluster re-estimation variance) | | `cluster_name` | `str | None` | Effective cluster column name (e.g. `"unit"` for default `cluster=None` on `ImputationDiD`; `None` for default on `EfficientDiD` since its per-unit EIF SE is HC1-style not CR1-at-unit); `None` under survey designs (the survey block already names PSU/strata) | | `n_clusters` | `int | None` | Number of effective clusters; `None` under survey designs and `None` under EfficientDiD's default unclustered fit | | `df_convention` | `str | None` | On the knob-carrying containers (`StackedDiDResults`, `ImputationDiDResults`, `WooldridgeDiDResults`, `LPDiDResults`, `SunAbrahamResults`): the configured df convention (3.9 / M-127); `StackedDiDResults` additionally carries `inference_df` (the overall-ATT df actually used) | diff --git a/diff_diff/guides/llms-practitioner.txt b/diff_diff/guides/llms-practitioner.txt index 484e13af2..f83256375 100644 --- a/diff_diff/guides/llms-practitioner.txt +++ b/diff_diff/guides/llms-practitioner.txt @@ -732,7 +732,7 @@ print(bacon_result.summary()) # Step 5: Estimate (cluster at county level — treatment assignment unit) n_clusters = data['countyreal'].nunique() -print(f"Clusters: {n_clusters} -> {'cluster-robust SEs' if n_clusters >= 50 else 'few clusters — CS below uses cluster-robust SEs; a bootstrapped n_bootstrap is the CS small-G option'}") +print(f"Clusters: {n_clusters} -> {'cluster-robust SEs' if n_clusters >= 50 else 'few clusters — CS below uses cluster-robust SEs; the cluster jackknife (vcov_type jackknife) is the CS few-cluster option, the multiplier bootstrap does not correct few-cluster over-rejection'}") cs = CallawaySantAnna( control_group='never_treated', estimation_method='dr', cluster='countyreal', diff --git a/diff_diff/guides/llms.txt b/diff_diff/guides/llms.txt index e2463030e..4440484d7 100644 --- a/diff_diff/guides/llms.txt +++ b/diff_diff/guides/llms.txt @@ -59,7 +59,7 @@ The site is organized into 5 sections, each with a landing page: - [DifferenceInDifferences](https://diff-diff.readthedocs.io/en/stable/api/estimators.html): Basic 2x2 DiD with robust/cluster-robust SEs, wild bootstrap, formula interface, and fixed effects - [TwoWayFixedEffects](https://diff-diff.readthedocs.io/en/stable/api/estimators.html): Panel data DiD with unit and time fixed effects via within-transformation or dummies; `event_study=True` estimates per-period effects (spec='within'|'pooled') returning the unified EventStudyResults surface -- [CallawaySantAnna](https://diff-diff.readthedocs.io/en/stable/api/staggered.html): Callaway & Sant'Anna (2021) group-time ATT estimator for staggered adoption with aggregation +- [CallawaySantAnna](https://diff-diff.readthedocs.io/en/stable/api/staggered.html): Callaway & Sant'Anna (2021) group-time ATT estimator for staggered adoption with aggregation; `vcov_type="jackknife"` gives cluster-jackknife (CV3) inference for few clusters (Karim, Nielsen, MacKinnon & Webb 2026) - [ChaisemartinDHaultfoeuille](https://diff-diff.readthedocs.io/en/stable/api/chaisemartin_dhaultfoeuille.html): de Chaisemartin & D'Haultfœuille (2020/2022) estimator for **reversible (non-absorbing) treatments** with multi-horizon event study (`L_max`), normalized effects, cost-benefit delta, sup-t bands, and dynamic placebos. The most general option for treatments that switch on AND off (LPDiD/TROP `non_absorbing` also handle non-absorbing treatment under stronger assumptions). Alias `DCDH`. - [SunAbraham](https://diff-diff.readthedocs.io/en/stable/api/staggered.html): Sun & Abraham (2021) interaction-weighted estimator for heterogeneity-robust event studies - [ImputationDiD](https://diff-diff.readthedocs.io/en/stable/api/imputation.html): Borusyak, Jaravel & Spiess (2024) imputation estimator — most efficient under homogeneous effects diff --git a/diff_diff/staggered.py b/diff_diff/staggered.py index 135e2e754..446f3be4a 100644 --- a/diff_diff/staggered.py +++ b/diff_diff/staggered.py @@ -16,6 +16,7 @@ from diff_diff.aggregation import ( AggregationKit, BootstrapReplaySpec, + JackknifeReplicates, ) from diff_diff.linalg import ( _check_propensity_diagnostics, @@ -28,6 +29,7 @@ ) from diff_diff.staggered_aggregation import ( CallawaySantAnnaAggregationMixin, + fixed_cohort_agg_weights, ) from diff_diff.staggered_bootstrap import ( CallawaySantAnnaBootstrapMixin, @@ -508,16 +510,32 @@ class CallawaySantAnna( explicit PSU takes precedence; a ``UserWarning`` fires if the bare ``cluster=`` partition differs from the explicit PSU partition. vcov_type : str, default="hc1" - Variance family. CallawaySantAnna accepts ``{"hc1"}`` only — - ``hc1`` means per-unit IF variance when ``cluster=None`` and CR1 - Liang-Zeger on the IF when ``cluster=X`` is set. The - analytical-sandwich families (``classical``, ``hc2``, ``hc2_bm``) - and spatial-HAC (``conley``) are rejected at ``__init__`` because - CS's per-(g,t) doubly-robust / IPW / outcome-regression structure - has no single design matrix to compute hat-matrix leverage or - Bell-McCaffrey Satterthwaite DOF on. See REGISTRY.md "IF-based - variance estimators vs analytical-sandwich estimators" for the - structural taxonomy. + Variance estimator. CallawaySantAnna accepts ``"hc1"`` and + ``"jackknife"``. + + - ``"hc1"`` (default): per-unit IF variance when ``cluster=None`` + and CR1 Liang-Zeger on the IF when ``cluster=X`` is set. + - ``"jackknife"``: the cluster jackknife (CV3) of Karim, Nielsen, + MacKinnon & Webb (2026). Each cluster is deleted in turn (the + ``cluster=`` column, or the unit when no cluster is given), the + whole estimator is re-run on the remaining data, and the variance + is ``((H - 1) / H) * sum_h (theta^(h) - theta)^2`` around the + full-sample estimate, with a ``t(H - 1)`` reference. It applies to + the overall ATT, every ATT(g,t) and the event-study and group + aggregations; the delete-one estimates are available from + ``results.get_loo_effects_df()``. Intended for few clusters, where + the influence-function variance over-rejects. It costs ``H + 1`` + extra estimations and cannot be combined with ``n_bootstrap > 0``, + ``survey_design=`` or ``allow_unbalanced_panel=True``; with + ``panel=False`` it needs ``cluster=``. + + The analytical-sandwich families (``classical``, ``hc2``, + ``hc2_bm``) and spatial-HAC (``conley``) are rejected at + ``__init__`` because CS's per-(g,t) doubly-robust / IPW / + outcome-regression structure has no single design matrix to compute + hat-matrix leverage or Bell-McCaffrey Satterthwaite DOF on. See + REGISTRY.md "IF-based variance estimators vs analytical-sandwich + estimators" for the structural taxonomy. n_bootstrap : int, default=0 Number of bootstrap iterations for inference. If 0, uses analytical standard errors. @@ -768,12 +786,14 @@ def __init__( f"base_period must be 'varying' or 'universal', " f"got '{base_period}'" ) - # vcov_type input contract: CallawaySantAnna is permanently narrow - # to {"hc1"} because the analytical-sandwich families (classical, - # hc2, hc2_bm) require a single regression's hat matrix that CS's + # vcov_type input contract: CallawaySantAnna accepts {"hc1", + # "jackknife"}. The analytical-sandwich families (classical, hc2, + # hc2_bm) require a single regression's hat matrix that CS's # per-(g,t) doubly-robust / IPW / outcome-regression structure - # doesn't have. See REGISTRY.md "IF-based variance estimators vs - # analytical-sandwich estimators" for the structural taxonomy. + # doesn't have; "jackknife" is the delete-one-cluster re-estimation + # variance (Karim et al. 2026), which needs no such matrix. See + # REGISTRY.md "IF-based variance estimators vs analytical-sandwich + # estimators" for the structural taxonomy. # Factored out so fit() can re-run it: set_params now validates # eagerly via the BaseEstimator probe re-init, but DIRECT attribute # mutation (est.vcov_type = ...) still bypasses validation until fit. @@ -791,6 +811,7 @@ def __init__( # avoids surprises if the contract ever broadens). self._vcov_type_explicit = vcov_type != "hc1" validate_n_bootstrap(n_bootstrap) + self._validate_jackknife_inference(vcov_type, n_bootstrap) self.n_bootstrap = n_bootstrap self.bootstrap_weights = bootstrap_weights self.seed = seed @@ -2040,6 +2061,7 @@ def fit( # second layer only catches DIRECT attribute mutation # (est.vcov_type = ...) before it propagates to Results metadata. self._validate_vcov_type(self.vcov_type) + self._validate_jackknife_inference(self.vcov_type, self.n_bootstrap) # Same direct-mutation defense for the anticipation window (an # out-of-domain value silently changes the ESTIMAND); the assignment # also re-normalizes a mutated numpy scalar to a Python int. @@ -2051,6 +2073,36 @@ def fit( validate_cluster(self.cluster) user_cluster = None if self.cluster is False else self.cluster + # Cluster jackknife: the configurations it does not cover fail closed + # before any estimation. ``_jackknife_data`` pins the caller's frame, + # which every delete-one refit starts from. + _use_jackknife = self.vcov_type == "jackknife" + _jackknife_data = data + if _use_jackknife: + if survey_design is not None: + raise ValueError( + "CallawaySantAnna(vcov_type='jackknife') is not supported with " + "survey_design=. The cluster jackknife re-estimates on " + "delete-one-cluster samples of an unweighted design; for a " + "survey design use replicate weights " + "(SurveyDesign(replicate_method='JK1' or 'JKn')) with the " + "default vcov_type='hc1'." + ) + if self.allow_unbalanced_panel: + raise ValueError( + "CallawaySantAnna(vcov_type='jackknife') is not supported with " + "allow_unbalanced_panel=True: that option chooses the estimation " + "route from the balance of the data, and deleting a cluster can " + "change the route, so the delete-one estimates would mix two " + "estimators. Use the default allow_unbalanced_panel=False." + ) + if not self.panel and user_cluster is None: + raise ValueError( + "CallawaySantAnna(vcov_type='jackknife') with panel=False needs " + "cluster=: repeated cross-sections have no unit to " + "delete, so the clusters must be named." + ) + # --- allow_unbalanced_panel routing (RC-on-panel = R's allow_unbalanced_panel) --- # Detect an unbalanced panel (some units unobserved in some periods). # Only meaningful for panel input; declared RC (panel=False) is handled @@ -2913,6 +2965,63 @@ def fit( group_time_effects[gt]["p_value"] = bootstrap_results.group_time_p_values[gt] group_time_effects[gt]["t_stat"] = float(gt_t_stats[idx]) + # Cluster jackknife (Karim, Nielsen, MacKinnon & Webb 2026, eq. 20): + # re-estimate on every delete-one-cluster sample and replace the + # analytical inference of the overall ATT and of every ATT(g,t). + # The replicates ride the kit so the post-fit aggregation levels can + # form their own jackknife standard errors. + jackknife_payload = None + if _use_jackknife and influence_func_info: + from diff_diff.staggered_jackknife import ( + apply_to_fit, + fit_messages, + resolve_deletion_units, + run_replicates, + ) + + _deletion_units = resolve_deletion_units( + _jackknife_data, + unit, + user_cluster, + precomputed, + influence_func_info, + group_time_effects, + ) + # Fewer than two candidates can never give two deletion units. + # The binding check is on the audited payload below: a cluster + # the structural rule left out can still turn out to move an + # estimate, and it then counts. + if len(_deletion_units.values) + len(_deletion_units.spare_values) < 2: + raise ValueError(_too_few_clusters_message(len(_deletion_units.values))) + jackknife_payload, _refit_warnings, _n_refits = run_replicates( + self, + _jackknife_data, + { + "outcome": outcome, + "unit": unit, + "time": time, + "first_treat": first_treat, + "covariates": covariates, + }, + _deletion_units, + float(overall_att), + group_time_effects, + fixed_cohort_agg_weights(precomputed), + ) + if jackknife_payload.n_replicates < 2: + raise ValueError(_too_few_clusters_message(jackknife_payload.n_replicates)) + overall_se, overall_t, overall_p, overall_ci = apply_to_fit( + jackknife_payload, overall_att, group_time_effects, self.alpha + ) + for _message in fit_messages( + jackknife_payload, + _refit_warnings, + group_time_effects, + self.anticipation, + _n_refits, + ): + warnings.warn(_message, UserWarning, stacklevel=2) + # No fit-time event-study surface -> the bootstrap never builds # ``event_study_info`` and no simultaneous band is computed at fit; # the post-fit replay (``results.aggregate('event_study')``) carries @@ -2990,6 +3099,14 @@ def fit( ) else None ) + if jackknife_payload is not None: + # The jackknife's reference distribution is t(H - 1), H being the + # clusters that enter the estimation. A reported cluster count + # must be that same H, never the raw PSU count (which also counts + # clusters made only of rows the fit drops). + df_inference_for_results = jackknife_payload.n_replicates - 1 + if n_clusters_for_results is not None: + n_clusters_for_results = jackknife_payload.n_replicates self.results_ = CallawaySantAnnaResults( group_time_effects=group_time_effects, @@ -3044,6 +3161,7 @@ def fit( is_survey_fit=survey_metadata is not None, bootstrap_results=bootstrap_results, covariates=covariates, + jackknife=jackknife_payload, ) self.is_fitted_ = True @@ -5053,7 +5171,7 @@ def _validate_vcov_type(vcov_type: str) -> None: ``set_params(vcov_type=...)`` mutations are re-checked at use time rather than silently passing a bad value through to Results). """ - _accepted_vcov = {"hc1"} + _accepted_vcov = {"hc1", "jackknife"} _deferred_vcov = {"conley"} _if_incompatible_vcov = {"classical", "hc2", "hc2_bm"} if vcov_type in _if_incompatible_vcov: @@ -5085,9 +5203,28 @@ def _validate_vcov_type(vcov_type: str) -> None: if vcov_type not in _accepted_vcov: raise ValueError( f"CallawaySantAnna(vcov_type={vcov_type!r}) is invalid. " - f"Accepted values: {sorted(_accepted_vcov)}. CS is " - "permanently narrow to 'hc1' per IF-based variance " - "structure; see REGISTRY.md." + f"Accepted values: {sorted(_accepted_vcov)}: 'hc1' is the " + "influence-function variance (cluster-robust with " + "cluster=), 'jackknife' the delete-one-cluster " + "re-estimation variance; see REGISTRY.md." + ) + + @staticmethod + def _validate_jackknife_inference(vcov_type: str, n_bootstrap: int) -> None: + """Refuse the cluster jackknife together with the multiplier bootstrap. + + Both replace the analytical inference, so requesting both leaves no + single answer. Called from ``__init__`` (hence from ``set_params`` + through the probe re-init) and again from ``fit()``, which is the + only place a direct attribute mutation can be caught. + """ + if vcov_type == "jackknife" and n_bootstrap > 0: + raise ValueError( + "CallawaySantAnna(vcov_type='jackknife') cannot be combined with " + f"n_bootstrap={n_bootstrap}: the cluster jackknife and the " + "multiplier bootstrap are two inference methods. Use " + "n_bootstrap=0 with vcov_type='jackknife', or vcov_type='hc1' " + "with the bootstrap." ) # get_params/set_params come from BaseEstimator. @@ -5131,6 +5268,14 @@ def print_summary(self) -> None: ) +def _too_few_clusters_message(n_found: int) -> str: + """Refusal text for a cluster jackknife with fewer than two deletion units.""" + return ( + "CallawaySantAnna(vcov_type='jackknife') needs at least two clusters " + f"whose omission moves the estimate; found {n_found}." + ) + + def _build_aggregation_kit( estimator: "CallawaySantAnna", precomputed: Optional[Dict[str, Any]], @@ -5140,6 +5285,7 @@ def _build_aggregation_kit( is_survey_fit: bool = False, bootstrap_results: Optional["CSBootstrapResults"] = None, covariates: Optional[Sequence[str]] = None, + jackknife: Optional["JackknifeReplicates"] = None, ) -> Optional["AggregationKit"]: """Distil the fit-time state post-fit re-aggregation needs. @@ -5241,4 +5387,5 @@ def _build_aggregation_kit( anticipation=estimator.anticipation, cband=bool(estimator.cband), bootstrap=bootstrap_spec, + jackknife=jackknife, ) diff --git a/diff_diff/staggered_jackknife.py b/diff_diff/staggered_jackknife.py new file mode 100644 index 000000000..092ed1641 --- /dev/null +++ b/diff_diff/staggered_jackknife.py @@ -0,0 +1,876 @@ +"""Cluster jackknife (CV3) inference for CallawaySantAnna. + +Implements the delete-one-cluster jackknife of Karim, Nielsen, MacKinnon & +Webb (2026), "Improved Inference for CSDID Using the Cluster Jackknife" +(arXiv:2602.12043), equation (20):: + + CV3 = ((H - 1) / H) * sum_h (theta^(h) - theta)^2 + +with ``H`` the number of clusters, ``theta`` the full-sample estimate and +``theta^(h)`` the estimate when cluster ``h`` is omitted. Every delete-one +estimate comes from a full re-estimation; no influence function is used. + +The paper states the formula for the overall ATT. Applying it element-wise +to each ATT(g,t), event-study and group estimate, and its outer-product form +to the event-study covariance, is a library extension documented in +``docs/methodology/REGISTRY.md`` (CallawaySantAnna, "Cluster jackknife"). +""" + +from __future__ import annotations + +import re +import warnings +from dataclasses import dataclass +from typing import TYPE_CHECKING, Any, Dict, List, Optional, Sequence, Tuple + +import numpy as np +import pandas as pd + +from diff_diff.aggregation import JackknifeReplicates +from diff_diff.staggered_aggregation import ( + CallawaySantAnnaAggregationMixin, + fixed_cohort_agg_weights, +) +from diff_diff.utils import safe_inference, safe_inference_batch + +if TYPE_CHECKING: + from diff_diff.staggered import CallawaySantAnna + +__all__: List[str] = [] + +#: The per-cell keys point aggregation reads. Copied key-for-key: a key the +#: fit did not set (``agg_weight`` on panel cells) must stay absent, because +#: the aggregators read ``data.get("agg_weight", data["n_treated"])``. +_CELL_KEYS: Tuple[str, ...] = ("effect", "n_treated", "agg_weight", "is_reference") + +#: Refit warnings that concern only the refit's own analytical variance, +#: which the jackknife discards. +_VARIANCE_ONLY_WARNINGS: Tuple[str, ...] = ("PSU(s) found", "analytical SE paths") + +#: Deletion-unit count above which ``fit()`` warns about the refit cost. +_MANY_REPLICATES = 500 + +#: A reported quantity resting on fewer treated clusters than this draws a +#: warning. Library choice, not from the paper: in the size simulation +#: (benchmarks/python/cs_jackknife_size.py) a quantity identified by two +#: treated clusters rejects 6% to 18% at a nominal 5%, against 3% to 10% +#: with four. +_MIN_TREATED_CLUSTERS = 3 + +_NUMBER = re.compile(r"[-+]?\d+(?:\.\d+)?(?:[eE][-+]?\d+)?") + + +@dataclass(frozen=True) +class DeletionUnits: + """The clusters a jackknife deletes, resolved from the estimation sample. + + Attributes + ---------- + column : str + Column of the caller's frame the deletion is made on. + values : tuple + Values of ``column`` to delete, one per replicate. + labels : tuple + Row labels retained on the results (raw labels or position codes). + unit_name : str + Name shown for the deletion unit. + labels_are_codes : bool + Whether ``labels`` are position codes. + roles : tuple of str + ``"treated"`` / ``"control"`` per deletion unit. + cell_treated : dict + ``{(g, t): positions}``: the deletion units (by position) holding + treated units of that cell. + spare_values, spare_labels, spare_roles : tuple + The clusters of the estimation index that the structural rule leaves + out (it expects their omission to move nothing). They are refitted + too, and any whose omission does move an estimate becomes a deletion + unit, so the rule is checked on every fit instead of trusted. + """ + + column: str + values: Tuple[Any, ...] + labels: Tuple[Any, ...] + unit_name: str + labels_are_codes: bool + roles: Tuple[str, ...] + cell_treated: Dict[Any, Tuple[int, ...]] + spare_values: Tuple[Any, ...] = () + spare_labels: Tuple[Any, ...] = () + spare_roles: Tuple[str, ...] = () + + +def jackknife_se(full: float, replicates: Any) -> float: + """Jackknife standard error, the square root of equation (20). + + Centered on the full-sample estimate with factor ``(H - 1) / H``. NaN + when fewer than two replicates are given or any value is non-finite. + """ + reps = np.asarray(replicates, dtype=float) + h = reps.size + if h < 2 or not np.isfinite(full) or not np.all(np.isfinite(reps)): + return float(np.nan) + return float(np.sqrt((h - 1) / h * np.sum((reps - full) ** 2))) + + +def jackknife_vcov(full: np.ndarray, replicates: np.ndarray) -> np.ndarray: + """Outer-product form of equation (20) for a vector of estimates. + + ``replicates`` is ``(H, k)``; the result is ``(k, k)`` with the + element-wise jackknife variances on its diagonal. + """ + deviations = np.asarray(replicates, dtype=float) - np.asarray(full, dtype=float) + h = deviations.shape[0] + return (h - 1) / h * (deviations.T @ deviations) + + +def resolve_deletion_units( + data: pd.DataFrame, + unit: str, + cluster: Optional[str], + precomputed: Dict[str, Any], + influence_func_info: Dict[Any, Any], + group_time_effects: Dict[Any, Dict[str, Any]], +) -> DeletionUnits: + """Resolve the deletion units from the estimation sample. + + A deletion unit is a cluster whose omission can move an estimate. It + holds at least one unit (observation on the repeated-cross-section + route) that either + + - enters some ATT(g,t) cell as treated or as comparison, or + - belongs to a cohort whose WHOLE-cohort mass is an aggregation weight: + with a cluster column (or any route that weights by fixed cohort + masses) that is every cohort with a finite cell, and under a universal + base period it is every cohort with a materialized reference cell, + whose weight is the cohort mass. Such a unit can have no usable + outcome at all and still shift the weights when it is deleted. + + Every other cluster label of the caller's frame - an always-treated + cluster, a cluster made only of rows with a missing unit ID - is returned + as a spare: ``run_replicates`` refits without it and keeps it out only if + that changes nothing. So ``H`` counts exactly the clusters whose omission + moves an estimate, and no label of the frame escapes the check. + + ``data`` is the caller's frame, row-aligned with the fit's working copy. + Cluster labels are read from it and never from the working copy: the fit + recodes the first-treatment and time columns there (``inf`` to 0, numeric + coercion), and a cluster column may be one of them, so a label taken from + the working copy could match no row of the frame the deletion is made on. + """ + index_units = np.asarray(precomputed["all_units"]) + n_index = len(index_units) + is_panel = bool(precomputed.get("is_panel", True)) + # Only entries of the index that have rows in the caller's frame can be + # deleted. On the panel route the index comes from a groupby over the + # unit column, which for a categorical column lists unused categories + # too (the pandas default before 3.0): such an entry has no rows, enters + # nothing, and is neither a deletion unit nor a candidate for the audit. + if is_panel: + observed = pd.Index(pd.unique(data[unit].dropna())) + present = np.asarray(pd.Index(index_units).isin(observed), dtype=bool) + else: + present = np.ones(n_index, dtype=bool) + + contributing = np.zeros(n_index, dtype=bool) + for info in influence_func_info.values(): + if not info: + continue + for key in ("treated_idx", "control_idx"): + idx = np.asarray(info.get(key, ()), dtype=np.intp) + if idx.size: + contributing[idx] = True + cohorts = np.asarray(precomputed["unit_cohorts"]) + with np.errstate(invalid="ignore"): + ever_treated = np.asarray(cohorts > 0, dtype=bool) + uses_cohort_masses = fixed_cohort_agg_weights(precomputed) is not None + mass_cohorts = { + gt[0] + for gt, cell in group_time_effects.items() + if np.isfinite(cell["effect"]) and (uses_cohort_masses or cell.get("is_reference")) + } + if mass_cohorts: + contributing |= np.isin(cohorts, list(mass_cohorts)) + contributing &= present + + def treated_by_cell(position_of_index: np.ndarray) -> Dict[Any, Tuple[int, ...]]: + """Deletion-unit positions of each cell's treated units.""" + out: Dict[Any, Tuple[int, ...]] = {} + for gt, info in influence_func_info.items(): + idx = np.asarray((info or {}).get("treated_idx", ()), dtype=np.intp) + positions = np.unique(position_of_index[idx]) + out[gt] = tuple(int(p) for p in positions if p >= 0) + return out + + if cluster is None: + positions = np.flatnonzero(contributing) + spare = np.flatnonzero(~contributing & present) + position_of_index = np.full(n_index, -1, dtype=np.intp) + position_of_index[positions] = np.arange(positions.size) + # Labels are taken as pandas Index elements, never ``ndarray.tolist()``: + # that turns datetime64 unit IDs into integers, which match no row. + unit_index = pd.Index(index_units) + return DeletionUnits( + column=unit, + values=tuple(unit_index[positions]), + labels=tuple(int(p) for p in positions), + unit_name="unit", + labels_are_codes=True, + roles=tuple("treated" if ever_treated[p] else "control" for p in positions), + cell_treated=treated_by_cell(position_of_index), + spare_values=tuple(unit_index[spare]), + spare_labels=tuple(int(p) for p in spare), + spare_roles=tuple("treated" if ever_treated[p] else "control" for p in spare), + ) + + if is_panel: + per_index = ( + data.groupby(unit, sort=True, observed=True)[cluster] + .first() + .reindex(index_units) + .to_numpy() + ) + else: + # Repeated cross-sections: the index space is the observation row. + per_index = data[cluster].to_numpy() + present_idx = np.flatnonzero(present) + present_codes, uniques = pd.factorize(per_index[present_idx], sort=False) + # ``codes`` is -1 for an index entry with no rows; every use below goes + # through ``present``. + codes = np.full(n_index, -1, dtype=np.intp) + codes[present_idx] = present_codes + n_clusters = len(uniques) + treated_count = np.bincount( + present_codes, weights=ever_treated[present_idx].astype(float), minlength=n_clusters + ) + order = pd.unique(codes[contributing]) + # A cluster column that is one-to-one with the units present IS the unit + # (or a relabelling of it), so it gets position codes: no raw unit + # identifier is retained on the results object. + one_to_one = n_clusters == present_idx.size + first_member = np.full(n_clusters, -1, dtype=np.intp) + if one_to_one: + first_member[present_codes] = present_idx + position_of_code = np.full(n_clusters, -1, dtype=np.intp) + position_of_code[order] = np.arange(len(order)) + position_of_index = np.full(n_index, -1, dtype=np.intp) + position_of_index[present_idx] = position_of_code[present_codes] + spare = [c for c in range(n_clusters) if position_of_code[c] < 0] + # Labels of the caller's frame that hold no unit of the estimation index + # (clusters made only of rows with a missing unit ID). The fit does not + # estimate on those rows, but they are not always inert - a row can add a + # period to the calendar grid and so move a base period - so they are + # audited like every other excluded cluster, never assumed away. + # Membership and labels go through pandas Index objects, so typed labels + # (datetime, period, categorical) compare and round-trip as themselves. + label_index = pd.Index(uniques) + raw_labels = pd.Index(pd.unique(data[cluster])) + outside = list(raw_labels[~raw_labels.isin(label_index)]) + + def labels_of(cluster_codes: Sequence[int]) -> Tuple[Any, ...]: + if one_to_one: + return tuple(int(first_member[c]) for c in cluster_codes) + return tuple(label_index[c] for c in cluster_codes) + + def roles_of(cluster_codes: Sequence[int]) -> Tuple[str, ...]: + return tuple("treated" if treated_count[c] > 0 else "control" for c in cluster_codes) + + return DeletionUnits( + column=cluster, + values=tuple(label_index[c] for c in order), + labels=labels_of(order), + unit_name="unit" if one_to_one else cluster, + labels_are_codes=one_to_one, + roles=roles_of(order), + cell_treated=treated_by_cell(position_of_index), + spare_values=tuple(label_index[c] for c in spare) + tuple(outside), + # In code mode a cluster outside the index has no unit position; it + # gets a code past the index (n_index, n_index + 1, ...). + spare_labels=labels_of(spare) + + (tuple(n_index + k for k in range(len(outside))) if one_to_one else tuple(outside)), + spare_roles=roles_of(spare) + ("control",) * len(outside), + ) + + +def _finite_cells(cells: Dict[Any, Dict[str, Any]]) -> frozenset: + """Keys of the cells with a finite effect (a cell can keep its key with NaN).""" + return frozenset(gt for gt, cell in cells.items() if np.isfinite(cell["effect"])) + + +def _normalize(message: str) -> str: + """A warning message with its numbers masked, for comparing across refits.""" + return _NUMBER.sub("#", message) + + +def _close(a: float, b: float) -> bool: + """Equal up to rounding, NaN matching NaN.""" + if np.isnan(a) or np.isnan(b): + return bool(np.isnan(a) and np.isnan(b)) + return bool(np.isclose(a, b, rtol=1e-10, atol=1e-12)) + + +def _moves_an_estimate( + full_att: float, + full_cells: Dict[Any, Dict[str, Any]], + full_masses: Optional[Dict[Any, float]], + rep_att: float, + rep_cells: Dict[Any, Dict[str, Any]], + rep_masses: Optional[Dict[Any, float]], +) -> bool: + """Whether a delete-one refit differs from the full sample in any point input. + + Compares the overall ATT, the estimate and aggregation weight of every + cell with a finite estimate, and the cohort masses of the cohorts that + have such a cell. Cells without a finite estimate and masses no cell + uses (an always-treated cohort has both) enter no aggregate, so their + disappearance moves nothing. + """ + full_finite = _finite_cells(full_cells) + if not _close(full_att, rep_att) or full_finite != _finite_cells(rep_cells): + return True + for gt in full_finite: + cell = full_cells[gt] + other = rep_cells[gt] + for key in ("effect", "n_treated", "agg_weight"): + if (key in cell) != (key in other): + return True + if key in cell and not _close(float(cell[key]), float(other[key])): + return True + live = {gt[0] for gt in full_finite} + full_live = {g: m for g, m in (full_masses or {}).items() if g in live} + rep_live = {g: m for g, m in (rep_masses or {}).items() if g in live} + if full_live.keys() != rep_live.keys(): + return True + return any(not _close(float(full_live[g]), float(rep_live[g])) for g in full_live) + + +def run_replicates( + estimator: "CallawaySantAnna", + data: pd.DataFrame, + fit_kwargs: Dict[str, Any], + units: DeletionUnits, + full_att: float, + full_cells: Dict[Any, Dict[str, Any]], + full_masses: Optional[Dict[Any, float]], +) -> Tuple[JackknifeReplicates, List[str], int]: + """Re-estimate on every delete-one sample. + + Each refit is a fresh estimator with the fitted estimator's parameters + and ``vcov_type="hc1"``; every other parameter, ``cluster`` included, is + unchanged, so a refit takes the same routing and the same aggregation + weights as the full-sample fit. Returns the replicate payload, the + refit warnings that the full-sample configuration does not raise itself, + and the number of delete-one refits actually run (which exceeds ``H`` + when spare clusters were audited and dropped). + + The clusters the structural rule left out (``units.spare_*``) are + refitted as well. One whose omission moves any point input is a deletion + unit after all and joins the replicates; one whose omission moves + nothing is dropped, as the rule intended. + """ + params = {**estimator.get_params(), "vcov_type": "hc1"} + column = data[units.column] + full_finite = _finite_cells(full_cells) + full_point_cells = { + gt: {k: cell[k] for k in _CELL_KEYS if k in cell} for gt, cell in full_cells.items() + } + + # Warnings the same configuration raises on the full sample are not news. + with warnings.catch_warnings(record=True) as baseline_caught: + warnings.simplefilter("always") + type(estimator)(**params).fit(data, **fit_kwargs) + baseline = {_normalize(str(w.message)) for w in baseline_caught} + + labels: List[Any] = [] + roles: List[str] = [] + atts: List[float] = [] + cells: List[Dict[Any, Dict[str, Any]]] = [] + masses: List[Optional[Dict[Any, float]]] = [] + n_cells: List[int] = [] + changed: List[bool] = [] + undefined: List[Optional[str]] = [] + extra: Dict[str, Tuple[str, int]] = {} + + candidates = [ + (value, label, role, False) + for value, label, role in zip(units.values, units.labels, units.roles) + ] + [ + (value, label, role, True) + for value, label, role in zip(units.spare_values, units.spare_labels, units.spare_roles) + ] + for value, label, role, is_spare in candidates: + subset = data.loc[~column.isin([value])] + if len(subset) == len(data): + # Every candidate was resolved from rows of this frame, so a + # deletion that removes none means the two went out of step. + # Failing here is the only alternative to a silent no-op replicate. + raise RuntimeError( + f"Cluster jackknife: deleting {units.unit_name} {value!r} removed no " + "rows. This is a bug in diff-diff; please report it." + ) + refit = type(estimator)(**params) + reason: Optional[str] = None + rep_results = None + with warnings.catch_warnings(record=True) as caught: + warnings.simplefilter("always") + try: + rep_results = refit.fit(subset, **fit_kwargs) + except (ValueError, np.linalg.LinAlgError) as exc: + reason = str(exc) + + rep_cells: Dict[Any, Dict[str, Any]] = {} + rep_masses: Optional[Dict[Any, float]] = None + rep_att = float(np.nan) + if rep_results is not None: + rep_att = float(rep_results.att) + rep_cells = { + gt: {k: cell[k] for k in _CELL_KEYS if k in cell} + for gt, cell in rep_results.group_time_effects.items() + } + kit = getattr(rep_results, "_aggregation_kit", None) + if kit is not None: + rep_masses = fixed_cohort_agg_weights(kit.bookkeeping) + if not np.isfinite(rep_att): + reason = "the overall ATT is not estimable" + if is_spare and not _moves_an_estimate( + full_att, full_point_cells, full_masses, rep_att, rep_cells, rep_masses + ): + continue + + for w in caught: + message = str(w.message) + if any(marker in message for marker in _VARIANCE_ONLY_WARNINGS): + continue + key = _normalize(message) + if key in baseline: + continue + extra[key] = (message, extra.get(key, (message, 0))[1] + 1) + rep_finite = _finite_cells(rep_cells) + labels.append(label) + roles.append(role) + atts.append(rep_att) + cells.append(rep_cells) + masses.append(rep_masses) + n_cells.append(len(rep_finite)) + changed.append(rep_finite != full_finite) + undefined.append(reason) + + payload = JackknifeReplicates( + labels=tuple(labels), + unit_name=units.unit_name, + labels_are_codes=units.labels_are_codes, + roles=tuple(roles), + att=tuple(atts), + cells=tuple(cells), + cohort_masses=tuple(masses), + n_cells=tuple(n_cells), + changed=tuple(changed), + undefined=tuple(undefined), + cell_treated=dict(units.cell_treated), + ) + extra_messages = [ + f"{message} ({count} refit{'s' if count != 1 else ''})" for message, count in extra.values() + ] + return payload, extra_messages, len(candidates) + + +def _any_undefined(payload: JackknifeReplicates) -> bool: + return any(reason is not None for reason in payload.undefined) + + +def _describe(labels: Sequence[Any], limit: int = 5) -> str: + shown = ", ".join( + repr(label.item() if isinstance(label, np.generic) else label) for label in labels[:limit] + ) + if len(labels) > limit: + shown += f" and {len(labels) - limit} more" + return shown + + +def changed_cells_message(payload: JackknifeReplicates, what: str) -> Optional[str]: + """The paper's second caveat, when some deletion changes the cell set.""" + # An undefined replicate has its own warning (and makes every SE NaN). + labels = [ + label + for label, flag, reason in zip(payload.labels, payload.changed, payload.undefined) + if flag and reason is None + ] + if not labels: + return None + coded = " (position codes)" if payload.labels_are_codes else "" + return ( + f"Cluster jackknife: deleting {len(labels)} of {payload.n_replicates} " + f"{payload.unit_name} deletion unit(s){coded} ({_describe(labels)}) changes " + f"which ATT(g,t) cells are estimable, so those delete-one estimates of " + f"{what} average different cohorts than the full sample (Karim, Nielsen, " + "MacKinnon & Webb 2026, Section 4). A cell or aggregate that is not " + "estimable in every delete-one sample has a NaN standard error. Inspect " + "results.get_loo_effects_df() before relying on this inference." + ) + + +def n_treated_clusters(payload: JackknifeReplicates, cells: Sequence[Any]) -> int: + """Number of deletion units holding treated units of any of ``cells``.""" + behind: set = set() + for gt in cells: + behind.update(payload.cell_treated.get(gt, ())) + return len(behind) + + +def few_treated_message(what: str) -> str: + """The warning for quantities resting on too few treated clusters.""" + return ( + f"Cluster jackknife: {what} on fewer than {_MIN_TREATED_CLUSTERS} treated " + "clusters. The jackknife cannot fully correct for so few: in the library's " + "size simulation a quantity identified by two treated clusters rejected a " + "true null 6% to 18% of the time at a nominal 5% (3% to 10% with four). " + "Treat this inference as indicative; see docs/methodology/REGISTRY.md, " + "CallawaySantAnna, 'Cluster jackknife'." + ) + + +def _few_treated_fit_message( + payload: JackknifeReplicates, + group_time_effects: Dict[Any, Dict[str, Any]], + anticipation: int, +) -> Optional[str]: + """Fit-time form: the overall ATT and the ATT(g,t) cells.""" + live = [ + gt + for gt, cell in group_time_effects.items() + if not cell.get("is_reference") and np.isfinite(cell["effect"]) + ] + post = [gt for gt in live if gt[1] >= gt[0] - anticipation] + parts: List[str] = [] + n_overall = n_treated_clusters(payload, post) + if post and n_overall < _MIN_TREATED_CLUSTERS: + parts.append(f"the overall ATT rests on {n_overall}") + few = [gt for gt in live if n_treated_clusters(payload, [gt]) < _MIN_TREATED_CLUSTERS] + if few: + parts.append(f"{len(few)} of {len(live)} ATT(g,t) cells rest") + if not parts: + return None + return few_treated_message(" and ".join(parts)) + + +def fit_messages( + payload: JackknifeReplicates, + extra: Sequence[str], + group_time_effects: Dict[Any, Dict[str, Any]], + anticipation: int, + n_refits: int, +) -> List[str]: + """The consolidated warnings a jackknife fit emits.""" + messages: List[str] = [] + bad = [ + (label, reason) + for label, reason in zip(payload.labels, payload.undefined) + if reason is not None + ] + if bad: + coded = " (position codes)" if payload.labels_are_codes else "" + messages.append( + f"Cluster jackknife: deleting {payload.unit_name} deletion unit(s){coded} " + f"{_describe([label for label, _ in bad])} leaves no estimate " + f"({bad[0][1]}). The jackknife variance is undefined for this design: " + "every jackknife standard error is NaN." + ) + changed = changed_cells_message( + payload, "the overall ATT and of the event-study and group aggregates" + ) + if changed is not None: + messages.append(changed) + if extra: + messages.append( + "Cluster jackknife: delete-one refits raised warnings the full-sample " + "configuration does not: " + + "; ".join(extra[:3]) + + (f"; and {len(extra) - 3} more" if len(extra) > 3 else "") + ) + few_treated = _few_treated_fit_message(payload, group_time_effects, anticipation) + if few_treated is not None: + messages.append(few_treated) + if n_refits > _MANY_REPLICATES: + # Cost is counted in refits run (audited spare clusters included, plus + # the baseline estimation), not in the H the variance is built on. + messages.append( + f"Cluster jackknife: {payload.n_replicates} deletion units, and fit() ran " + f"{n_refits + 1} extra estimations. The jackknife is meant for few " + "clusters; with this many the default inference is usually adequate." + ) + return messages + + +def apply_to_fit( + payload: JackknifeReplicates, + overall_att: float, + group_time_effects: Dict[Any, Dict[str, Any]], + alpha: float, +) -> Tuple[float, float, float, Tuple[float, float]]: + """Replace the fit's analytical inference with jackknife inference. + + Writes the cell-level ``se`` / ``t_stat`` / ``p_value`` / ``conf_int`` + in place and returns the overall quartet. Reference cells are left as + the fit produced them. + """ + df = payload.n_replicates - 1 + undefined = _any_undefined(payload) + overall_se = float(np.nan) if undefined else jackknife_se(overall_att, payload.att) + overall_t, overall_p, overall_ci = safe_inference(overall_att, overall_se, alpha=alpha, df=df) + + keys = [ + gt + for gt, cell in group_time_effects.items() + if not cell.get("is_reference") and np.isfinite(cell["effect"]) + ] + if keys: + effects = np.array([float(group_time_effects[gt]["effect"]) for gt in keys]) + ses = np.full(len(keys), np.nan) + if not undefined: + for i, gt in enumerate(keys): + reps = [ + float(cells[gt]["effect"]) if gt in cells else np.nan for cells in payload.cells + ] + ses[i] = jackknife_se(effects[i], reps) + t_stats, p_values, ci_lo, ci_hi = safe_inference_batch(effects, ses, alpha=alpha, df=df) + for i, gt in enumerate(keys): + cell = group_time_effects[gt] + cell["se"] = float(ses[i]) + cell["t_stat"] = float(t_stats[i]) + cell["p_value"] = float(p_values[i]) + cell["conf_int"] = (float(ci_lo[i]), float(ci_hi[i])) + return overall_se, overall_t, overall_p, overall_ci + + +class _PointOnlyAggregator(CallawaySantAnnaAggregationMixin): + """The aggregation mixin with its variance work switched off. + + Replicate aggregates are needed as point estimates only, and replicates + retain no influence functions, so both variance entry points return NaN + without reading any. + """ + + def __init__(self, alpha: float, anticipation: int) -> None: + self.alpha = alpha + self.anticipation = anticipation + + def _compute_aggregated_se_with_wif( + self, + gt_pairs: Any, + weights: Any, + effects: Any, + groups_for_gt: Any, + influence_func_info: Any, + df: Any, + unit: Any, + precomputed: Any = None, + return_psi: bool = False, + ) -> Any: + if return_psi: + return np.nan, np.empty(0), None + return np.nan, None + + def _se_from_psi(self, psi_total: Any, precomputed: Any = None) -> Any: + return np.nan, None + + +def _replicate_precomputed(masses: Optional[Dict[Any, float]]) -> Dict[str, Any]: + """The bookkeeping a replicate's point aggregation reads: its own masses.""" + return {"agg_cohort_masses": masses} if masses is not None else {} + + +def _override_rows( + rows: Dict[Any, Dict[str, Any]], + keys: List[Any], + replicate_values: np.ndarray, + alpha: float, + df: int, +) -> np.ndarray: + """Write jackknife inference onto ``rows[key]`` for ``keys``; return the SEs.""" + effects = np.array([float(rows[k]["effect"]) for k in keys]) + ses = np.array( + [jackknife_se(effects[j], replicate_values[:, j]) for j in range(len(keys))], dtype=float + ) + t_stats, p_values, ci_lo, ci_hi = safe_inference_batch(effects, ses, alpha=alpha, df=df) + for j, key in enumerate(keys): + row = rows[key] + row["se"] = float(ses[j]) + row["t_stat"] = float(t_stats[j]) + row["p_value"] = float(p_values[j]) + row["conf_int"] = (float(ci_lo[j]), float(ci_hi[j])) + row.pop("cband_conf_int", None) + return ses + + +def few_treated_event_study_message( + payload: JackknifeReplicates, + full_cells: Dict[Any, Dict[str, Any]], + effects: Dict[Any, Dict[str, Any]], + balance_e: Optional[int], +) -> Optional[str]: + """Event-study horizons resting on too few treated clusters, if any.""" + retained = None + if balance_e is not None: + # The cohorts a balanced aggregation keeps (same rule as the aggregator). + retained = { + g + for (g, t), cell in full_cells.items() + if t - g == balance_e and np.isfinite(cell["effect"]) + } + few = [] + for e, row in effects.items(): + if row.get("is_reference") or not np.isfinite(row["effect"]): + continue + cells = [ + gt + for gt, cell in full_cells.items() + if gt[1] - gt[0] == e + and not cell.get("is_reference") + and np.isfinite(cell["effect"]) + and (retained is None or gt[0] in retained) + ] + if n_treated_clusters(payload, cells) < _MIN_TREATED_CLUSTERS: + few.append(e) + if not few: + return None + return few_treated_message( + f"the event-study estimates at event time(s) {_describe(sorted(few), limit=12)} rest" + ) + + +def few_treated_group_message( + payload: JackknifeReplicates, + full_cells: Dict[Any, Dict[str, Any]], + effects: Dict[Any, Dict[str, Any]], + anticipation: int, +) -> Optional[str]: + """Cohorts whose group estimate rests on too few treated clusters, if any.""" + few = [] + for g, row in effects.items(): + if not np.isfinite(row["effect"]): + continue + cells = [ + gt + for gt, cell in full_cells.items() + if gt[0] == g and gt[1] >= g - anticipation and np.isfinite(cell["effect"]) + ] + if n_treated_clusters(payload, cells) < _MIN_TREATED_CLUSTERS: + few.append(g) + if not few: + return None + return few_treated_message( + f"the group estimates of cohort(s) {_describe(sorted(few), limit=12)} rest" + ) + + +def apply_to_event_study( + payload: JackknifeReplicates, + effects: Dict[Any, Dict[str, Any]], + *, + alpha: float, + anticipation: int, + groups: List[Any], + time_periods: List[Any], + balance_e: Optional[int], +) -> Tuple[Optional[np.ndarray], Optional[List[Any]]]: + """Jackknife inference for an event-study aggregation. + + Overrides the non-reference rows of ``effects`` in place and returns the + jackknife covariance with its index: the horizons that are finite in + every delete-one sample, in row order. + """ + df = payload.n_replicates - 1 + keys = [ + e + for e, row in effects.items() + if not row.get("is_reference") and np.isfinite(row["effect"]) + ] + if not keys: + return None, None + values = np.full((payload.n_replicates, len(keys)), np.nan) + if not _any_undefined(payload): + agg = _PointOnlyAggregator(alpha, anticipation) + for h in range(payload.n_replicates): + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + rep = agg._aggregate_event_study( + payload.cells[h], + {}, + groups, + time_periods, + balance_e, + None, + None, + _replicate_precomputed(payload.cohort_masses[h]), + ).effects + for j, e in enumerate(keys): + # ``keys`` are horizons estimated in the full sample. A + # delete-one sample can leave such a horizon with reference + # cells only (a universal base on a gapped grid); its + # aggregate is then the finite reference value 0, which is + # that sample's estimate and enters like any other. + row = rep.get(e) + if row is not None: + values[h, j] = float(row["effect"]) + ses = _override_rows(effects, keys, values, alpha, df) + ok = np.isfinite(ses) + if not ok.any(): + return None, None + full = np.array([float(effects[e]["effect"]) for e in keys]) + vcov = jackknife_vcov(full[ok], values[:, ok]) + return vcov, [e for e, keep in zip(keys, ok) if keep] + + +def apply_to_group( + payload: JackknifeReplicates, + effects: Dict[Any, Dict[str, Any]], + *, + alpha: float, + anticipation: int, + groups: List[Any], +) -> None: + """Jackknife inference for a group aggregation, written in place.""" + df = payload.n_replicates - 1 + keys = [g for g, row in effects.items() if np.isfinite(row["effect"])] + if keys: + values = np.full((payload.n_replicates, len(keys)), np.nan) + if not _any_undefined(payload): + agg = _PointOnlyAggregator(alpha, anticipation) + for h in range(payload.n_replicates): + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + rep = agg._aggregate_by_group( + payload.cells[h], + {}, + groups, + precomputed=_replicate_precomputed(payload.cohort_masses[h]), + ) + for j, g in enumerate(keys): + if g in rep: + values[h, j] = float(rep[g]["effect"]) + _override_rows(effects, keys, values, alpha, df) + # The df this table's inference used, for every row (the analytical + # aggregator records only a survey df here). + for row in effects.values(): + row["df_used"] = float(df) + + +def loo_effects_frame(payload: JackknifeReplicates, full_att: float) -> pd.DataFrame: + """The delete-one overall ATTs as a table, most influential first.""" + att_loo = np.asarray(payload.att, dtype=float) + frame = pd.DataFrame( + { + "cluster": list(payload.labels), + "role": list(payload.roles), + "att_loo": att_loo, + "delta_from_full": att_loo - full_att, + "n_cells": list(payload.n_cells), + } + ) + # Same ordering as SyntheticDiDResults.get_loo_effects_df(): |delta| + # descending, undefined replicates last. + frame["_abs_delta"] = frame["delta_from_full"].abs() + frame = frame.sort_values(by="_abs_delta", ascending=False, na_position="last").drop( + columns="_abs_delta" + ) + return frame.reset_index(drop=True) diff --git a/diff_diff/staggered_results.py b/diff_diff/staggered_results.py index e56d83680..96bbfd5b0 100644 --- a/diff_diff/staggered_results.py +++ b/diff_diff/staggered_results.py @@ -5,6 +5,7 @@ group-time average treatment effects and their aggregations. """ +import warnings from dataclasses import dataclass, field, replace from typing import Any, Dict, List, Optional, Tuple @@ -43,6 +44,18 @@ CSBootstrapResults, apply_cband_conf_ints, ) +from diff_diff.staggered_jackknife import ( + apply_to_event_study as apply_jackknife_to_event_study, +) +from diff_diff.staggered_jackknife import ( + apply_to_group as apply_jackknife_to_group, +) +from diff_diff.staggered_jackknife import ( + changed_cells_message, + few_treated_event_study_message, + few_treated_group_message, + loo_effects_frame, +) class _KitAggregator(CallawaySantAnnaAggregationMixin): @@ -184,11 +197,13 @@ class CallawaySantAnnaResults(BaseResults, AggregationMixin): pscore_trim : float Propensity score trimming bound used during estimation. vcov_type : str - Variance type used during estimation. CallawaySantAnna is - permanently narrow to ``"hc1"`` — see REGISTRY.md - "IF-based variance estimators vs analytical-sandwich estimators" - for why analytical-sandwich families don't compose with the - per-(g,t) doubly-robust / IPW / outcome-regression structure. + Variance estimator used during estimation: ``"hc1"`` (the + influence-function variance, cluster-robust when clustered) or + ``"jackknife"`` (the delete-one-cluster re-estimation variance of + Karim et al. 2026). See REGISTRY.md "IF-based variance estimators + vs analytical-sandwich estimators" for why analytical-sandwich + families don't compose with the per-(g,t) doubly-robust / IPW / + outcome-regression structure. cluster_name : str, optional Canonical cluster column. Set to ``survey_design.psu`` when an explicit survey PSU was provided (regardless of bare ``cluster=``), @@ -196,13 +211,17 @@ class CallawaySantAnnaResults(BaseResults, AggregationMixin): injects a PSU. ``None`` when no clustering is active. n_clusters : int, optional Number of unique clusters (PSUs) used for variance estimation. - ``None`` when no clustering is active. + ``None`` when no clustering is active. On a ``"jackknife"`` fit + with a cluster column it is ``H``, the number of clusters that + enter the estimation (the count ``df_inference`` is built on). df_inference : int, optional Cluster-level degrees of freedom for downstream inference (e.g., - ``HonestDiD`` t-critical-value selection) on the bare-``cluster=`` - synthesize path ONLY (the case where ``survey_metadata`` is - intentionally ``None`` to preserve the survey/non-survey contract - for ``DiagnosticReport`` / ``summary()``). When the user provides + ``HonestDiD`` t-critical-value selection). Populated on two paths, + both without a user survey design: the bare-``cluster=`` synthesize + path (``G - 1``; ``survey_metadata`` is intentionally ``None`` there + to preserve the survey/non-survey contract for ``DiagnosticReport`` + / ``summary()``), and every ``vcov_type="jackknife"`` fit + (``H - 1``, with or without a cluster column). When the user provides an explicit ``survey_design=`` (inject or conflict branches), ``df_inference`` stays ``None`` and the canonical df carrier is ``survey_metadata.df_survey`` — which holds the actual CS-internal @@ -273,16 +292,16 @@ class CallawaySantAnnaResults(BaseResults, AggregationMixin): ) epv_threshold: float = 10 pscore_fallback: str = "error" - # Variance / clustering metadata (PR #XXX — narrow vcov_type contract - # + cluster= wiring fix). vcov_type is permanently narrow to "hc1" for - # CS per IF-based variance structure (REGISTRY.md). cluster_name + - # n_clusters surface the effective clustering level for downstream - # introspection and label rendering. + # Variance / clustering metadata. vcov_type is "hc1" (IF-based + # variance) or "jackknife" (delete-one-cluster re-estimation) for CS + # (REGISTRY.md). cluster_name + n_clusters surface the effective + # clustering level for downstream introspection and label rendering. vcov_type: str = "hc1" cluster_name: Optional[str] = None n_clusters: Optional[int] = None # df_inference: cluster-level degrees of freedom for downstream - # inference, populated on the bare-cluster-synthesize path ONLY. + # inference, populated on the bare-cluster-synthesize path (G - 1) and + # on every cluster-jackknife fit (H - 1), never on a survey-design fit. # When the user provides an explicit survey_design= (inject or # conflict branches), df_inference stays None and the canonical df # carrier is survey_metadata.df_survey (which holds the actual @@ -380,6 +399,10 @@ def _aggregate_compute( return self._aggregate_simple_result(kit) if level == "total": return self._aggregate_total_result(kit) + # Cluster-jackknife fits carry their delete-one replicates on the + # kit; the recompute levels below form their inference from them. + # ``getattr``: a kit pickled before the field existed has none. + jackknife = getattr(kit, "jackknife", None) # Shallow copy: shares every array (no data is duplicated) but gives the # aggregators a scratch dict to memoize `_agg_cache` into, so the kit @@ -468,6 +491,20 @@ def _aggregate_compute( # recomputed t, df_used cleared (percentile inference never # used the analytical df). apply_bootstrap_group_overrides(effects, boot_replay, kit.alpha) + if jackknife is not None: + self._warn_jackknife( + changed_cells_message(jackknife, "the group aggregates"), + few_treated_group_message( + jackknife, self.group_time_effects, effects, kit.anticipation + ), + ) + apply_jackknife_to_group( + jackknife, + effects, + alpha=kit.alpha, + anticipation=kit.anticipation, + groups=self.groups, + ) return self._group_effects_to_aggregation(effects, kit) # event_study -> the unified EventStudyResults container (row M-092) @@ -488,17 +525,41 @@ def _aggregate_compute( # false provenance otherwise). apply_bootstrap_event_study_overrides(es.effects, boot_replay, kit.alpha) apply_cband_conf_ints(es.effects, boot_replay.cband_crit_value) + es_vcov = boot_replay.event_study_vcov if boot_replay is not None else es.vcov + es_vcov_index = ( + boot_replay.event_study_vcov_index if boot_replay is not None else es.vcov_index + ) + es_df = None if boot_replay is not None else es.df_used + if jackknife is not None: + # Cluster jackknife: element-wise equation (20) on every + # non-reference horizon, its outer-product form for the + # covariance (indexed by the horizons finite in every + # delete-one sample), and the t(H - 1) df. + self._warn_jackknife( + changed_cells_message(jackknife, "the event-study estimates"), + few_treated_event_study_message( + jackknife, self.group_time_effects, es.effects, balance_e + ), + ) + es_vcov, es_vcov_index = apply_jackknife_to_event_study( + jackknife, + es.effects, + alpha=kit.alpha, + anticipation=kit.anticipation, + groups=self.groups, + time_periods=self.time_periods, + balance_e=balance_e, + ) + es_df = float(jackknife.n_replicates - 1) # `build_event_study_surface` reads the surface off a RESULTS object. # Under the immutability contract we cannot populate `self`, so a # throwaway carrier holds the freshly computed values. carrier = replace( self, event_study_effects=es.effects, - event_study_vcov=boot_replay.event_study_vcov if boot_replay is not None else es.vcov, - event_study_vcov_index=( - boot_replay.event_study_vcov_index if boot_replay is not None else es.vcov_index - ), - event_study_df=None if boot_replay is not None else es.df_used, + event_study_vcov=es_vcov, + event_study_vcov_index=es_vcov_index, + event_study_df=es_df, cband_crit_value=( boot_replay.cband_crit_value if boot_replay is not None else self.cband_crit_value ), @@ -716,6 +777,58 @@ def _group_effects_to_aggregation( estimator=type(self).__name__.replace("Results", ""), ) + @staticmethod + def _warn_jackknife(*messages: Optional[str]) -> None: + """Emit the cluster-jackknife caveats that apply to a post-fit aggregate.""" + for message in messages: + if message is not None: + warnings.warn(message, UserWarning, stacklevel=4) + + def get_loo_effects_df(self) -> pd.DataFrame: + """ + Delete-one-cluster overall ATTs from the cluster jackknife. + + Requires a fit with ``vcov_type="jackknife"`` (``ValueError`` + otherwise). Karim, Nielsen, MacKinnon & Webb (2026) recommend + inspecting these estimates to check that the result is not driven by + a single cluster. + + Returns + ------- + pd.DataFrame + One row per deleted cluster, most influential first (sorted by + ``|delta_from_full|`` descending, undefined replicates last), the + layout of ``SyntheticDiDResults.get_loo_effects_df()`` with + ``cluster`` in place of ``unit``: + + - ``cluster``: the deleted cluster. Its label when ``cluster=`` + named a column coarser than the unit. A position code when the + jackknife deleted units (no ``cluster=``, or a cluster column + that is one-to-one with units): the position of the unit in the + sorted unique unit IDs of the estimation sample (the row + position, for ``panel=False``). Results objects do not retain + raw unit identifiers, so unit labels are not stored; map the + codes back with your own data. (A code at or past the number + of units marks a cluster that holds no unit of the estimation + sample, e.g. rows with a missing unit ID.) + - ``role``: ``"treated"`` if the cluster holds an ever-treated + unit, else ``"control"``. + - ``att_loo``: the overall ATT with that cluster omitted (NaN + when it is not estimable). + - ``delta_from_full``: ``att_loo`` minus the full-sample ATT. + - ``n_cells``: the number of ATT(g,t) cells estimated in that + delete-one sample. + """ + jackknife = getattr(getattr(self, "_aggregation_kit", None), "jackknife", None) + if self.vcov_type != "jackknife" or jackknife is None: + raise ValueError( + "get_loo_effects_df() requires vcov_type='jackknife'. This result " + f"used vcov_type={self.vcov_type!r}. Re-fit with " + "CallawaySantAnna(vcov_type='jackknife') to obtain the " + "delete-one-cluster estimates." + ) + return loo_effects_frame(jackknife, float(self.att)) + def summary(self, alpha: Optional[float] = None) -> str: """ Generate formatted summary of estimation results. @@ -775,6 +888,17 @@ def summary(self, alpha: Optional[float] = None) -> str: ] ) + # Cluster-jackknife fits name their variance estimator: the default + # (influence-function) summary prints no variance line, so this is + # the only place a reader learns the inference was jackknifed. + jackknife = getattr(getattr(self, "_aggregation_kit", None), "jackknife", None) + if jackknife is not None: + h = jackknife.n_replicates + lines.append( + f"Variance: cluster jackknife (CV3), delete-one {jackknife.unit_name}, " + f"H={h}, t({h - 1})" + ) + cv = self.coef_var if np.isfinite(cv): lines.append(f"{'CV (SE/abs(ATT)):':<25} {cv:>10.4f}") diff --git a/docs/api/_autosummary/diff_diff.CallawaySantAnnaResults.rst b/docs/api/_autosummary/diff_diff.CallawaySantAnnaResults.rst index 9ff523feb..4b77a8b04 100644 --- a/docs/api/_autosummary/diff_diff.CallawaySantAnnaResults.rst +++ b/docs/api/_autosummary/diff_diff.CallawaySantAnnaResults.rst @@ -14,6 +14,7 @@ ~CallawaySantAnnaResults.__init__ ~CallawaySantAnnaResults.aggregate ~CallawaySantAnnaResults.epv_summary + ~CallawaySantAnnaResults.get_loo_effects_df ~CallawaySantAnnaResults.print_summary ~CallawaySantAnnaResults.summary ~CallawaySantAnnaResults.to_dataframe diff --git a/docs/api/_autosummary/diff_diff.dml_did_results.DMLDiDResults.rst b/docs/api/_autosummary/diff_diff.dml_did_results.DMLDiDResults.rst index 42afa6443..0273a1b59 100644 --- a/docs/api/_autosummary/diff_diff.dml_did_results.DMLDiDResults.rst +++ b/docs/api/_autosummary/diff_diff.dml_did_results.DMLDiDResults.rst @@ -15,6 +15,7 @@ ~DMLDiDResults.aggregate ~DMLDiDResults.bad_control_summary ~DMLDiDResults.epv_summary + ~DMLDiDResults.get_loo_effects_df ~DMLDiDResults.print_summary ~DMLDiDResults.summary ~DMLDiDResults.to_dataframe diff --git a/docs/api/design.rst b/docs/api/design.rst index 1ef123f75..f165f2476 100644 --- a/docs/api/design.rst +++ b/docs/api/design.rst @@ -29,6 +29,13 @@ Carlo allowance for the ``R`` replicates scored - or when it loses more than 10% of its replicates. Its power is then not meaningful and no minimum detectable effect is reported for it. +Candidates are estimator instances, so two configurations of one estimator can +be compared. With few units, ``CallawaySantAnna(vcov_type="jackknife")`` (the +cluster jackknife, which deletes one unit at a time here) is a natural candidate +next to the default ``CallawaySantAnna()``: the size check then shows on your own +panel whether the default standard errors over-reject and whether the jackknife +corrects it. + **What it does not test.** Placebo treatment is assigned at random, so these runs test inference - size and power - on your panel's own error structure. They do not test parallel trends: a design that passes the size check can still be diff --git a/docs/api/staggered.rst b/docs/api/staggered.rst index b56abf518..14b50d27b 100644 --- a/docs/api/staggered.rst +++ b/docs/api/staggered.rst @@ -33,6 +33,24 @@ covariate-unconfoundedness approach with extra covariates :math:`W`, use :class:`~diff_diff.DMLDiD` with ``fit(..., bad_control=, bad_control_covariates=)``. +**Few clusters.** With few clusters, and above all few treated clusters, the +default influence-function standard errors and the multiplier bootstrap +reject a true null too often. ``vcov_type="jackknife"`` selects the cluster +jackknife (CV3) of Karim, Nielsen, MacKinnon & Webb (2026): each cluster (the +``cluster=`` column, or the unit when none is given) is deleted in turn, the +estimator is re-run, and the variance is formed from the delete-one estimates +around the full-sample one, with a ``t(H - 1)`` reference for ``H`` clusters. +It applies to the overall ATT, every ATT(g,t) and the ``event_study`` and +``group`` aggregations. ``results.get_loo_effects_df()`` lists the delete-one +overall ATTs, most influential cluster first. The jackknife reduces +over-rejection but does not remove it when very few treated clusters stand +behind a number: the fit and ``aggregate()`` warn when a reported quantity +rests on fewer than three. It cannot be combined with ``n_bootstrap > 0``, +``survey_design=`` or ``allow_unbalanced_panel=True``, and with +``panel=False`` it needs ``cluster=``. Measured rejection rates and the +library's rules for deletions that remove cells are in the Methodology +Registry (CallawaySantAnna, "Cluster jackknife"). + .. autoclass:: diff_diff.CallawaySantAnna :no-index: :members: @@ -64,6 +82,7 @@ Results container for Callaway-Sant'Anna estimation. .. autosummary:: ~CallawaySantAnnaResults.aggregate + ~CallawaySantAnnaResults.get_loo_effects_df ~CallawaySantAnnaResults.summary ~CallawaySantAnnaResults.to_dataframe diff --git a/docs/choosing_estimator.rst b/docs/choosing_estimator.rst index d3356c572..d95d4b4fc 100644 --- a/docs/choosing_estimator.rst +++ b/docs/choosing_estimator.rst @@ -857,7 +857,7 @@ differences helps interpret results and choose appropriate inference. - Always clusters at unit level after within-transformation (static AND event-study mode). Specify ``cluster`` to override. Use ``inference='wild_bootstrap'`` for few clusters (static mode only; event-study mode raises). * - ``CallawaySantAnna`` - Analytical (influence function) - - Uses influence-function SEs with WIF adjustment by default. Set ``n_bootstrap=999`` for multiplier bootstrap inference (weight types: ``rademacher``, ``mammen``, ``webb``). + - Uses influence-function SEs with WIF adjustment by default. Set ``n_bootstrap=999`` for multiplier bootstrap inference (weight types: ``rademacher``, ``mammen``, ``webb``). With few clusters use ``vcov_type="jackknife"`` (cluster jackknife, delete-one re-estimation with a ``t(H - 1)`` reference); the bootstrap does not correct few-cluster over-rejection. * - ``SyntheticDiD`` - Placebo, paper-faithful refit bootstrap, or jackknife - Default uses placebo-based variance (``variance_method="placebo"``). Set ``variance_method="bootstrap"`` for paper-faithful Algorithm 2 bootstrap (re-estimates ω and λ via Frank-Wolfe per draw; ~5–30× slower than placebo, panel-size dependent). Both methods use ``n_bootstrap`` replications (default 200). ``variance_method="jackknife"`` is also available. diff --git a/docs/doc-deps.yaml b/docs/doc-deps.yaml index d8c690264..37661eaf8 100644 --- a/docs/doc-deps.yaml +++ b/docs/doc-deps.yaml @@ -28,6 +28,7 @@ groups: - diff_diff/staggered.py - diff_diff/staggered_aggregation.py - diff_diff/staggered_bootstrap.py + - diff_diff/staggered_jackknife.py - diff_diff/staggered_results.py staggered_triple_diff: - diff_diff/triple_diff_results.py @@ -221,6 +222,17 @@ sources: type: methodology - path: docs/api/staggered.rst type: api_reference + - path: docs/methodology/REPORTING.md + section: "Cluster-jackknife parallel-trends policy" + type: methodology + note: "DiagnosticReport treatment of vcov_type='jackknife' fits" + - path: docs/methodology/papers/karim-2026-review.md + type: methodology + note: "Source audit for the cluster jackknife (status line only)" + - path: docs/v4-design.md + section: "7. Inference surface" + type: methodology + note: "Why the cluster jackknife sits on vcov_type" - path: docs/tutorials/02_staggered_did.ipynb type: tutorial - path: docs/tutorials/16_survey_did.ipynb diff --git a/docs/methodology/REGISTRY.md b/docs/methodology/REGISTRY.md index 114b54d98..cf04233da 100644 --- a/docs/methodology/REGISTRY.md +++ b/docs/methodology/REGISTRY.md @@ -794,9 +794,13 @@ Sant'Anna 2021 for `CallawaySantAnna`; Borusyak-Jaravel-Spiess 2024 for This split is a structural property of the estimator's variance derivation, not a missing feature. The `vcov_type` input contract for IF-based estimators -is **permanently narrow** at `{"hc1"}`. Enforced today on +is **permanently narrow** at `{"hc1"}` as far as analytical families go. +Enforced today on `CallawaySantAnna`, `TripleDifference`, `ImputationDiD`, `EfficientDiD`, and -`TwoStageDiD`. `TwoStageDiD` is sandwich-class rather than pure-IF — its +`TwoStageDiD`. `CallawaySantAnna` additionally accepts `"jackknife"`, which is +not an analytical family: it is a delete-one-cluster re-estimation variance +that uses neither an influence function nor a hat matrix (see its section, +*Cluster jackknife*). `TwoStageDiD` is sandwich-class rather than pure-IF — its variance is the Gardner (2022) two-stage GMM sandwich — but reaches the same narrow `{"hc1"}` contract for a meat-specific reason: the GMM-corrected score `S_g = gamma_hat' c_g - X'_{2g} eps_{2g}` folds first-stage FE uncertainty into @@ -1017,7 +1021,7 @@ double-weight). - **Note (rank-guarded IF standard errors):** The analytical SE paths invert the propensity-score Hessian (`H_psi`) and outcome-regression bread (`X'WX`) across every `(g, t)` cell via `_safe_inv()`. `np.linalg.solve`/`inv` raise `LinAlgError` only on *exactly* singular matrices; a **near**-singular Gram (a constant or collinear covariate) does **not** raise, so the prior code returned a garbage inverse (entries ~1e13) that flowed straight into the SE (`overall_se` ~1e13 was reproduced for `estimation_method="dr"`). `_safe_inv()` now delegates to the shared `_rank_guarded_inv()` (`diff_diff/linalg.py`): it symmetrically equilibrates `A → D^{-1/2} A D^{-1/2}` (`D = diag(A)`), then, when rank-deficient, inverts a **column-dropped** principal submatrix — keeping the most-independent columns via pivoted QR on the **equilibrated** Gram. This is a column-drop generalized inverse in the **same family** as the point estimate / R's `lm()` (drop redundant columns, *not* a minimum-norm pseudo-inverse), but the column *selection* is computed on the equilibrated Gram and is therefore **scale-invariant** by construction — so it need not pick the *same member* of a collinear set as the point estimate's raw-pivot `_detect_rank_deficiency` under mixed-scale *exact* collinearity (see the selection caveat below); the resulting SE is well-defined and order-invariant regardless of which redundant member is dropped. The `rcond = 1e-10` relative-eigenvalue threshold on the equilibrated Gram sets the rank (chosen because a Gram squares the condition number of `X`; matches EfficientDiD's `tol/max_eigval`). The result is a **finite SE on the identified covariate subset**; an all-NaN inverse (and NaN SE) is returned **only** on true rank-0. **Column-drop equals the full-rank limit:** using a column-drop generalized inverse (rather than a minimum-norm pseudo-inverse) makes the analytical SE equal the **well-conditioned near-collinear limit** — replacing an exactly-collinear covariate with a near-collinear (full-rank) one yields the same SE to working precision (verified `se_ratio ≈ 1` across `reg`/`ipw`/`dr`), for every per-cell bread (the PS Hessian — including unweighted ipw's since v3.7 — and the control- *and* treated-side OR breads, including reg's centered estimation-effect Gram `G` since v3.7). A minimum-norm pseudo-inverse would instead diverge sharply when the IF multiplier leaves `range(A)` — e.g. a control (or treated-sub-cell) bread multiplied by a mean from a cell where the covariate is *not* collinear — so it is rejected. With column-drop there is no such divergence; a covariate that is rank-deficient only within one cell still legitimately enters the other cells' full-rank fits, so the ATT and SE reflect that (poor) covariate specification, surfaced by the aggregate warning. **Selection caveat (equilibrated vs raw pivot):** because `_rank_guarded_inv` pivots the *equilibrated* Gram, the *member* it drops from a collinear set can differ from the point estimate's raw-pivot `_detect_rank_deficiency` choice **only** under mixed-scale *exact* collinearity (e.g. a covariate and its `1e8×` duplicate). This selection difference does **not** change the SE: dropping either member of an exactly-collinear pair leaves the identified subspace — hence the variance — unchanged, and the SE is order-invariant (verified for both column orders and under survey weighting). It is a documented, intentional deviation in the *generalized-inverse column choice* (equilibrated, scale-invariant) from the point-estimate's raw pivot; it is not a parity claim with the raw selection. **Caveat (point-estimate side, NOT the rank-guard):** the CS and staggered-DDD engines' reg/DR *point-estimate* OR fit now routes through the scale-equilibrated `solve_ols` (SVD/gelsd), so a covariate correlated with another regressor at a very large scale no longer perturbs the point-estimate ATT — or the IF SE that consistently follows it — under `reg`/`dr`; scale-invariance is pinned by tests (covariate + large constant offset → ATT(g,t) unchanged to ~1e-11). This is independent of the rank-guarded IF inverse, whose SE is invariant to which collinear member is dropped (see the selection caveat above). The well-conditioned fast path returns `np.linalg.solve(A, I)` unchanged (R-parity preserved). `fit()` emits ONE aggregate `UserWarning` (count + max condition number) reporting the dropped redundant direction(s); suppressed under `rank_deficient_action="silent"`. **`rank_deficient_action` enforcement:** `"error"` is enforced *upstream* at the point-estimate solve (`solve_ols` / `solve_logit` / the covariate-regression fit), which raises `ValueError` when the covariate **design** is rank-deficient at its `1e-7` threshold (`_detect_rank_deficiency`) **before** any influence-function SE is computed — so for a genuinely (design-)rank-deficient covariate the rank-guarded IF inverse is reached only under `"warn"`/`"silent"`. The IF guard truncates on a *stricter* relative threshold, though: `1e-10` on the **equilibrated Gram** vs `1e-7` on the design, and a Gram squares `X`'s condition number, so the IF guard drops a direction once `X`'s singular-value ratio falls below ~`1e-5` (= √`1e-10`), well above the design's `1e-7`. A cell that is *near-singular yet still full-rank by the upstream design check* (singular-value ratio between ~`1e-7` and ~`1e-5`) therefore passes the `"error"` gate without an exception and is **still** column-dropped by the IF guard — the guard does not re-raise, and (under `"error"`/`"warn"`, not `"silent"`) the aggregate warning still fires. So `"error"` blocks design-rank-deficient *covariates*; it does not promise that every near-singular IF bread/Hessian raises. Sibling of axis-A finding #17 in the Phase 2 silent-failures audit. *Variance families (`vcov_type`, IF-based):* -- `hc1` (default, only accepted value) — per-unit IF variance per Callaway & Sant'Anna (2021) when `cluster=None`; cluster-robust CR1 Liang-Zeger on the IF when `cluster=X` is set (synthesizes `SurveyDesign(psu=X)` internally, threading through the same PSU machinery as explicit survey designs). When `survey_design=SurveyDesign(psu=Y)` is provided, the explicit PSU takes precedence; if `cluster=X` is also set with a different partition, emits a `UserWarning` (PSU wins). +- `hc1` (default) — per-unit IF variance per Callaway & Sant'Anna (2021) when `cluster=None`; cluster-robust CR1 Liang-Zeger on the IF when `cluster=X` is set (synthesizes `SurveyDesign(psu=X)` internally, threading through the same PSU machinery as explicit survey designs). When `survey_design=SurveyDesign(psu=Y)` is provided, the explicit PSU takes precedence; if `cluster=X` is also set with a different partition, emits a `UserWarning` (PSU wins). - `classical`, `hc2`, `hc2_bm`, `conley` — REJECTED at `__init__`. The rejection is **library-architectural, not paper-prescribed**: analytical-sandwich variance families (`classical`, `hc2`, `hc2_bm`) are defined on a single regression's hat matrix, and CS's per-(g,t) doubly-robust / IPW / outcome-regression structure has no equivalent single design matrix to compute hat-matrix leverage or Bell-McCaffrey Satterthwaite DOF on. Spatial-HAC (`conley`) likewise has no defined composition with per-unit IF aggregation today. See ["IF-based variance estimators vs analytical-sandwich estimators"](#if-based-variance-estimators-vs-analytical-sandwich-estimators) above for the structural taxonomy. *Cluster wiring:* @@ -1035,6 +1039,47 @@ The `cluster_name` and `n_clusters` fields on `CallawaySantAnnaResults` report t non-`str` labels raise the shared `ValueError`. - **Note (API decision — `cluster=` retained, NOT deprecated):** the `cluster=` → `SurveyDesign(psu=cluster)` synthesis above is an internal implementation detail, not a user-facing redundancy to be consolidated away. `cluster=` is the **canonical ergonomic single-level clustering kwarg** and is intentionally retained on `CallawaySantAnna` (and the sibling IF-based estimators `EfficientDiD` / `ImputationDiD` / `TwoStageDiD`): it matches the field's universal convention (R `fixest::feols(..., cluster = ~unit)`, Stata `vce(cluster id)`, statsmodels `cov_type="cluster"`), so users reach for `cluster=` first. `survey_design=SurveyDesign(psu=X, ...)` is the **advanced** entry point (adds strata / FPC / replicate weights / explicit weights); a bare `cluster=` is the shorthand for the common "just cluster at X" case and would be strictly less ergonomic if forced through `survey_design=`. This mirrors the HAD survey-API consolidation, which deprecated only the *redundant* `survey=` / `weights=` entry points in favor of `survey_design=` while deliberately keeping `cluster=`. Decision recorded 2026-07-04: do not deprecate `cluster=`; the former "decide whether to deprecate `CallawaySantAnna.cluster=X`" `TODO.md` row is closed as resolved (keep). +- `jackknife` — the delete-one-cluster re-estimation variance described under *Cluster jackknife* below. It uses no influence function, so the IF-vs-sandwich restriction above does not bear on it. + +*Cluster jackknife (`vcov_type="jackknife"`):* + +Source: Karim, Nielsen, MacKinnon & Webb (2026), "Improved Inference for CSDID Using the Cluster Jackknife", arXiv:2602.12043, Section 4. Paper review: `docs/methodology/papers/karim-2026-review.md`. + +Each cluster `h = 1, ..., H` is omitted in turn, every ATT(g,t) is re-estimated on the remaining data and re-aggregated, and the variance of the overall ATT is the paper's equation (20): + +``` +CV3(ATT) = ((H - 1) / H) * SUM_h ( ATT^(h) - ATT )^2 +``` + +`ATT` is the full-sample estimate and `ATT^(h)` the estimate without cluster `h`. The deviations are centered on the full-sample estimate, not on the mean of the delete-one estimates. The sum runs over all clusters, treated and comparison alike. The standard error is the square root. Each `ATT^(h)` comes from a full re-estimation (the paper counts `H + 1` estimations in total; the library runs one more, a second full-sample estimation whose warnings are the baseline against which delete-one refit warnings are reported); no influence-function expression enters. The clusters are the `cluster=` column, or the units when no cluster is given (`cluster=None` and `cluster=False` are the same request). + +The paper's three caveats apply as stated: a deletion can remove an entire cohort, so some ATT(g,t) cannot be computed in that sample; the weights given to the ATT(g,t) terms then differ across delete-one samples; and the procedure costs `H + 1` estimations. The paper gives no asymptotic theory for the jackknife applied to this estimator; its support is simulation evidence. It also reports that over-rejection remains when the number of treated clusters is small. + +- **Note:** Reference distribution. Jackknife t-statistics, p-values and confidence intervals use `t(H - 1)`. The paper does not state a reference distribution; its reported jackknife p-values and intervals are numerically consistent with `t(H - 1)` (review, "Reference distribution"), and the paper's R package `didjack` uses `df = replicates - 1`. `df_inference` on the results is `H - 1`. +- **Note:** Cluster labels are read from the caller's frame and each deletion removes that label's rows from it. They are not read from the fit's working copy, which recodes the first-treatment and time columns (`inf` to 0, numeric coercion): a cluster column can be one of those, and a recoded label would match no row. A deletion that removes no row raises instead of contributing a no-op replicate. +- **Note:** `H` counts the clusters whose omission can move an estimate. A cluster is a deletion unit if it holds a unit that enters some ATT(g,t) cell as treated or as comparison, or a unit of a cohort whose whole-cohort mass is an aggregation weight. The second case covers units with no usable outcome: with a cluster column the aggregations weight by fixed cohort masses that count every unit of the cohort, and under `base_period="universal"` each materialized reference cell is weighted by its cohort's mass, so deleting such a unit shifts the weights and the estimate. A cluster that satisfies neither condition (an always-treated cluster, a cluster made only of rows with a missing unit ID) is expected to be inert, and counting it would only inflate `H`. That expectation is checked on every fit, not trusted: every other cluster label in the caller's data is refitted without as well, and one whose omission changes the overall ATT, a cell's estimate or aggregation weight, or a used cohort mass beyond rounding (relative `1e-10`) is a deletion unit after all. This matters because rows the fit does not estimate on are not always inert; for example a row with a missing unit ID at an otherwise unobserved period adds that period to the calendar grid and can move a cohort's base period. A cluster the rule includes always stays, even when its omission happens to change nothing. Only labels that have rows in the caller's data are candidates: an unused category of a categorical unit column, which older pandas versions list in the fit's unit index, is neither deleted nor audited. The two-cluster minimum is applied to the deletion units that remain after this check. In a unit-level jackknife (no cluster column) rows with a missing unit ID belong to no unit: they are never deleted and are part of the full sample and of every delete-one sample alike. When a cluster column is given, `n_clusters` on a jackknife fit is this same `H`, so it cannot disagree with `df_inference`. Without a cluster column `cluster_name` and `n_clusters` stay `None`, as on an `hc1` fit (M-080 is unchanged); the summary line names the deletion unit and `H`. +- **Note:** Each delete-one refit is a fresh estimator with every parameter of the fitted one, `cluster` included, and `vcov_type="hc1"`. Keeping `cluster=` matters: a cluster column routes aggregation through fixed cohort masses, and a refit without it would weight cells by their complete-case counts, a different estimator from the one eq. (20) is centered on. Cohort-size aggregation weights are therefore recomputed in each delete-one sample, which is also what `didjack` does by re-running `did::att_gt` and `aggte`. +- **Note:** Library extension beyond the paper. Equation (20) is stated for the overall ATT only. The library applies it element-wise to every ATT(g,t), to each event-study horizon and to each cohort of the group aggregation, and uses its outer-product form `((H - 1) / H) * SUM_h d_h d_h'` (`d_h` = delete-one minus full-sample event-study vector) as the event-study covariance, with the same `t(H - 1)` reference. The paper has no formula and no evidence for these quantities. The evidence is the library's size simulation (next Note). The delete-one aggregates are computed by the same aggregation code as the full-sample ones, from each replicate's own cells and cohort masses. The covariance is indexed by the horizons that are finite in every delete-one sample. It is built from `H` deviations, so it is singular or near-singular when the number of horizons approaches `H`; `HonestDiD` then refuses it with its own singular-covariance error. +- **Note:** Measured size (`benchmarks/python/cs_jackknife_size.py`, results in `benchmarks/data/cs_jackknife_size.json`; pinned by `tests/test_staggered_jackknife.py::TestSizeEvidence`). Design: no effect, 8 periods, two cohorts adopting in periods 4 and 6 with `J` treated clusters each, cluster-level AR(1) shocks with coefficient 0.8, the grid of the paper's Table 1 (8 to 32 clusters) with 1 and 5 units per cluster, 1,000 replications per design point, nominal 5%. Rejection rates, as ranges over the design points with that `J`: + + | `J` | Overall ATT: `hc1` + `cluster=` | multiplier bootstrap | jackknife | Single-cohort horizon: `hc1` | jackknife | + |---|---|---|---|---|---| + | 1 | 15-35% | 26-39% | 8-18% | 42-72% | NaN | + | 2 | 5-15% | 14-19% | 3-10% | 14-29% | 6-18% | + | 3 | 7-11% | 12-21% | 5-8% | 12-19% | 6-12% | + | 4 | 6-9% | 9-12% | 4-7% | 7-14% | 4-9% | + | 6 to 12 | 4-7% | 7-10% | 3-6% | 6-10% | 4-7% | + + The jackknife rejects less than the clustered `hc1` path at every design point for the overall ATT, and is close to nominal from three treated clusters per cohort. It still over-rejects with one treated cluster per cohort, as the paper reports for its own data (9% to 16%). Event-study horizons that both cohorts identify behave like the overall ATT. Horizons that a single cohort identifies ("single-cohort horizon", event times 3 and 4 here) rest on `J` treated clusters and reject more; compared at an equal number of treated clusters they match the overall ATT (two treated clusters: 8-18% overall at `J = 1`, 6-18% single-cohort at `J = 2`; four: 3-10% and 4-9%). The multiplier bootstrap rejects more than the analytical `hc1` path throughout (it has no `t(G - 1)` reference). These are results for one simulated design, not guarantees. +- **Note:** Few treated clusters warning (library choice, not from the paper). A jackknife fit warns when the overall ATT, or any ATT(g,t) cell, rests on fewer than 3 treated clusters, and `aggregate()` warns for the event-study horizons and cohorts that do. "Rests on" counts the deletion units holding treated units of the cells that enter the quantity. The threshold comes from the simulation above: two treated clusters gave 6% to 18% rejection, four gave 3% to 10%. The inference is still reported; the warning says it is indicative. +- **Note:** Deleted cells (library rules where the paper gives none). "Estimable cell" means a cell with a finite estimate; a cell can remain under its key with a NaN estimate. (a) If a deletion leaves no overall ATT (for example it removes the only comparison cluster, or the only treated cluster), the jackknife variance is undefined: every jackknife standard error is NaN and a warning names the deletion units. The paper notes the case (Example 1, dropping region C) and gives no rule. (b) If a deletion changes which cells are estimable but an overall ATT remains, that delete-one ATT, built from the surviving cells, enters eq. (20), as the paper's second caveat describes, and a warning names the deletion units; the same holds for an event-study horizon or cohort that survives with a different cohort mix. (c) An ATT(g,t) cell, event-study horizon or cohort that is not estimable in every delete-one sample gets a NaN standard error (with NaN t, p and interval). +- **Deviation from R:** `didjack` skips the treated cluster when there is exactly one treated cluster and scales by the replicates actually run, returning a standard error from the comparison clusters alone. The library returns NaN in that case (rule (a) above): with the treated cluster never deleted, the variation that the standard error is meant to measure is not sampled. +- **Note:** Reference cells of `base_period="universal"` keep `se = NaN`; they are 0 in every delete-one sample by construction and are excluded from the event-study covariance. On a gapped time grid a horizon can mix an estimated cell of one cohort with a reference cell of another; it is then an estimated horizon and gets jackknife inference, and a delete-one sample in which only the reference cell survives contributes that sample's value, 0, like any other delete-one estimate. +- **Note:** `aggregate("total")` relays `C x` the overall jackknife inference, with `C` the realized full-sample treated mass, so it is conditional on that mass (as its analytical form is). +- **Note:** Refused combinations. `n_bootstrap > 0` (two inference methods); `survey_design=` (use a replicate-weight design, which is the survey route; note that its JK1 path reweights the stored influence function and on a delete-one-PSU design equals CR1 exactly, whereas this jackknife re-estimates); `allow_unbalanced_panel=True` (that option chooses the estimation route from the balance of the data, and a deletion can change the route; tracked in `TODO.md`); and `panel=False` without `cluster=` (repeated cross-sections have no unit to delete). Covariates, all three estimation methods, both comparison groups, both base periods and anticipation are supported, since each replicate is a full re-estimation; the paper's evidence covers never-treated comparison, base period `g - 1` and post-treatment cells only, so the other configurations rest on the library's by-hand-loop equality and not on the paper. +- **Note:** Delete-one estimates and retained labels. `results.get_loo_effects_df()` returns the delete-one overall ATTs (the paper recommends inspecting them). The results object keeps a cluster's label only when the cluster is coarser than the unit. When the deletion unit is the unit (no cluster column, a cluster column that is the unit column, or one that is one-to-one with units) the rows carry position codes (the unit's position in the sorted unit IDs of the estimation sample), so the 4.0 guarantee that results retain no raw unit identifier holds. +- **Note:** Reports. `DiagnosticReport` gives a jackknife fit the `hc2_bm` parallel-trends policy (Bonferroni over the per-row `t(H - 1)` p-values, no covariance-based joint Wald) and skips its pre-trends power section; see `REPORTING.md`. In the size simulation that Bonferroni check rejected 8-29% at `J = 2`, 6-14% at `J = 3`, 5-12% at `J = 4` and 4-7% from `J = 6`; the chi-square joint Wald on the jackknife covariance, which the report does not run, rejected 49-71% at `J = 2`. + *Estimator equation (as implemented):* Group-time average treatment effect: @@ -7197,7 +7242,7 @@ should be a deliberate user choice. | DifferenceInDifferences | HC1 robust | Cluster-robust, wild bootstrap (with `cluster=`) | | TwoWayFixedEffects event-study mode (`event_study=True`; the removed MultiPeriodDiD's design) | Cluster at unit when `unit=` is passed (HC1 otherwise, e.g. the pooled spec on repeated cross-sections) | Cluster-robust (via `cluster` param), hc2 / hc2_bm (CR2-BM per-period DOF), Conley; no wild path — `inference="wild_bootstrap"` raises `ValueError` | | TwoWayFixedEffects | Cluster at unit (static AND event-study mode; ES carve-outs: dropped on Conley / never a survey PSU / explicit one-way) | Wild bootstrap (static only; event-study mode raises) | -| CallawaySantAnna | Analytical (influence fn) | Multiplier bootstrap | +| CallawaySantAnna | Analytical (influence fn) | Multiplier bootstrap; cluster jackknife (`vcov_type="jackknife"`, CV3 by delete-one-cluster re-estimation) | | SunAbraham | Cluster-robust + delta method | Pairs bootstrap | | ImputationDiD | Conservative clustered (Thm 3) | Multiplier bootstrap (library extension; percentile CIs and empirical p-values, consistent with CS/SA) | | TwoStageDiD | GMM sandwich (Newey & McFadden 1994) | Multiplier bootstrap on GMM influence function | diff --git a/docs/methodology/REPORTING.md b/docs/methodology/REPORTING.md index db6461151..68816af6d 100644 --- a/docs/methodology/REPORTING.md +++ b/docs/methodology/REPORTING.md @@ -605,6 +605,30 @@ what is reconciled. statistic; otherwise it falls back to Bonferroni over the per-row p-values (a documented conservative downgrade, not a defect). +- **Note:** Cluster-jackknife parallel-trends policy (same deviation + by omission as `hc2_bm`). When the source fit's `vcov_type` is + `"jackknife"` (`CallawaySantAnna`), the PT check does NOT run the + covariance-based joint Wald: no reference distribution is + established for a Wald statistic built on a delete-one-cluster + covariance, the chi-square reference ignores the `t(H - 1)` reference + the per-row jackknife inference uses, and that covariance is singular + or near-singular when the number of pre-periods approaches the number + of clusters. The check runs Bonferroni over the per-row `t(H - 1)` + p-values (`method="bonferroni"`). Measured size of that check with no + violation, nominal 5% (`benchmarks/data/cs_jackknife_size.json`; `J` = + treated clusters per cohort): 8-29% at `J = 2`, 6-14% at `J = 3`, + 5-12% at `J = 4`, 4-7% from `J = 6`. It flags a violation too often + when the earliest pre-periods rest on very few treated clusters; the + chi-square joint Wald on the same covariance rejected 49-71% at + `J = 2`. The `pretrends_power` section is skipped for a jackknife fit + (`status="skipped"` with the reason): the power calculation models a + normal-reference Wald pre-test on the event-study covariance, which + is not the test applied to the fit, so its MDV would overstate what + that test can detect. `compute_pretrends_power` called directly on + the container from `results.aggregate("event_study")` is not guarded: + the container records no variance-estimator provenance (tracked in + `TODO.md`). + - **Note:** Unit-translation policy. BusinessReport does not arithmetically translate log-points to percents or level effects to log-points. The estimate is rendered in the scale the estimator diff --git a/docs/methodology/papers/karim-2026-review.md b/docs/methodology/papers/karim-2026-review.md index a14ab0729..3fbcc2c5c 100644 --- a/docs/methodology/papers/karim-2026-review.md +++ b/docs/methodology/papers/karim-2026-review.md @@ -12,7 +12,7 @@ ## Methodology Registry Entry -**Status: proposed text for a future addition to the `## CallawaySantAnna` section of `docs/methodology/REGISTRY.md`; this file is a non-authoritative source audit.** The existing `## CallawaySantAnna` REGISTRY section remains the **sole authoritative methodology contract**. Nothing below changes library behavior, and `CallawaySantAnna` has no inference path implementing the paper's full-re-estimation cluster jackknife today. Every statement about the paper in this file is sourced from the paper only. +**Status: implemented as `CallawaySantAnna(vcov_type="jackknife")`; this file is a non-authoritative source audit written before the implementation.** The `## CallawaySantAnna` REGISTRY section ("Cluster jackknife") is the **sole authoritative methodology contract**, including the library choices this review lists as open. Statements below about what the library lacks ("no full-re-estimation cluster jackknife today", the open items under *Relation to Existing diff-diff Estimators*) describe the library at review time. Every statement about the paper in this file is sourced from the paper only. *Formatted to match the REGISTRY structure. The registry-candidate text ends just before `## Monte Carlo Evidence`; the sections after that boundary are evidence summaries and audit notes and are NOT part of the proposed registry text.* diff --git a/docs/methodology/variance-conventions.md b/docs/methodology/variance-conventions.md index c3ec2ddd3..f56f7eb73 100644 --- a/docs/methodology/variance-conventions.md +++ b/docs/methodology/variance-conventions.md @@ -236,7 +236,7 @@ column lookup. | ImputationDiD | yes | `cluster_var = unit` inside the unit-level IF variance (`"unit"`, G) | accepted explicit no-op | c2 | | TwoStageDiD | yes | `cluster_var = unit` inside the unit-level IF variance (`"unit"`, G) | accepted explicit no-op | c2 | | StackedDiD | yes (`'unit'`/`'unit_subexp'` only) | CR1 at unit (`"unit"`, G) | REJECTED (validator) | c3 | -| CallawaySantAnna | yes | per-unit influence functions (no G/(G-1)); `cluster_name=None` | accepted explicit no-op | b | +| CallawaySantAnna | yes | per-unit influence functions (no G/(G-1)); `cluster_name=None`. Under `vcov_type="jackknife"` the default deletes one unit at a time (`df_inference = H - 1`; `cluster_name` / `n_clusters` still `None`) | accepted explicit no-op (unit-level jackknife under `vcov_type="jackknife"`) | b | | EfficientDiD | yes | per-unit EIF (no G/(G-1)); `cluster_name=None` | accepted explicit no-op | b | | DMLDiD | yes | per-unit IF (inherits CS); `cluster_name=None` | accepted explicit no-op | b | | ChaisemartinDHaultfoeuille | yes (any non-None raises) | group-level IF + multiplier bootstrap; no cluster fields | accepted explicit no-op | b | diff --git a/docs/references.rst b/docs/references.rst index 521b238b9..b1b4e2035 100644 --- a/docs/references.rst +++ b/docs/references.rst @@ -240,6 +240,8 @@ Multi-Period and Staggered Adoption - **Callaway, B., & Sant'Anna, P. H. C. (2021).** "Difference-in-Differences with Multiple Time Periods." *Journal of Econometrics*, 225(2), 200-230. https://doi.org/10.1016/j.jeconom.2020.12.001 +- **Karim, S. R., Nielsen, M. Ø., MacKinnon, J. G., & Webb, M. D. (2026).** "Improved Inference for CSDID Using the Cluster Jackknife." arXiv:2602.12043. https://arxiv.org/abs/2602.12043 + - **Sant'Anna, P. H. C., & Zhao, J. (2020).** "Doubly Robust Difference-in-Differences Estimators." *Journal of Econometrics*, 219(1), 101-122. https://doi.org/10.1016/j.jeconom.2020.06.003 - **Sun, L., & Abraham, S. (2021).** "Estimating Dynamic Treatment Effects in Event Studies with Heterogeneous Treatment Effects." *Journal of Econometrics*, 225(2), 175-199. https://doi.org/10.1016/j.jeconom.2020.09.006 diff --git a/docs/tutorials/02_staggered_did.ipynb b/docs/tutorials/02_staggered_did.ipynb index d3bd6a397..eb3a57194 100644 --- a/docs/tutorials/02_staggered_did.ipynb +++ b/docs/tutorials/02_staggered_did.ipynb @@ -1050,17 +1050,16 @@ "source": [ "## Bootstrap Inference\n", "\n", - "With few clusters or when analytical standard errors may be unreliable, the **multiplier bootstrap** provides valid inference. This implements the approach from Callaway & Sant'Anna (2021), perturbing unit-level influence functions.\n", + "The **multiplier bootstrap** is the alternative inference procedure of Callaway & Sant'Anna (2021): it perturbs unit-level influence functions without re-estimating, and it is what provides simultaneous confidence bands. It is not a fix for few clusters: in simulations it over-rejects at least as much as the analytical standard errors there (Karim, Nielsen, MacKinnon & Webb 2026). With few clusters use `CallawaySantAnna(vcov_type=\"jackknife\")`, the cluster jackknife, which re-estimates with each cluster deleted in turn.\n", "\n", "**Why use bootstrap?**\n", - "- Analytical SEs may understate uncertainty with few clusters\n", - "- Bootstrap provides finite-sample valid confidence intervals\n", - "- P-values are computed from the bootstrap distribution\n", + "- It gives simultaneous (sup-t) confidence bands for the event study\n", + "- Percentile confidence intervals and p-values come from the bootstrap distribution\n", "\n", "**Weight types:**\n", "- `'rademacher'` - Default, ±1 with p=0.5, good for most cases\n", "- `'mammen'` - Two-point distribution, matches first 3 moments\n", - "- `'webb'` - Six-point distribution, recommended for very few clusters (<10)\n", + "- `'webb'` - Six-point distribution, the usual choice when the number of clusters is small\n", "\n", "**Note:** post-fit aggregation works on *bootstrapped* fits too — `results.aggregate('event_study')` replays the fit-time multiplier bootstrap from the retained RNG state, reproducing the percentile inference without a refit (`aggregate('simple')` relays the stored overall inference bit-exactly).\n" ] diff --git a/docs/v4-design.md b/docs/v4-design.md index 206494d3a..c7862dbb0 100644 --- a/docs/v4-design.md +++ b/docs/v4-design.md @@ -750,6 +750,15 @@ domain vocabulary, not drift. exist; the redundant `robust` flag dies [M-045]..[M-047] [M-115]. Estimators without analytical SEs (SyntheticControl, TROP, CiC) document their native variance methods instead of growing a dead param. + `CallawaySantAnna` accepts `vcov_type="jackknife"` beside `"hc1"` (added + after the 4.0 cut): the cluster jackknife is a deterministic variance + estimator - CV3, the cluster analogue of the `hc3` value this selector + already carries - not a random-draw inference method, so it belongs on the + SE-type selector and not on a resampling one. It is the same family as + `RDDensityTest(vcov_type="jackknife")`. `SyntheticDiD` keeps its own + spelling, `variance_method="jackknife"`, under the rule just above: it has + no analytical SEs and refuses `vcov_type`. An additive value needs no ledger + row (the ledger records lifecycle facts only). - Wild bootstrap is exposed via `inference="wild_bootstrap"` uniformly where supported [M-096] - "supported" meaning the estimator offers wild CLUSTER bootstrap as an ALTERNATIVE to analytical SEs. That roster is diff --git a/tests/test_aggregate_contract.py b/tests/test_aggregate_contract.py index a14af78f0..85109b14d 100644 --- a/tests/test_aggregate_contract.py +++ b/tests/test_aggregate_contract.py @@ -1416,6 +1416,24 @@ class TestInferenceDfProvenance: carried was built on a finite t-reference. """ + def test_cluster_jackknife_df_reaches_every_level(self): + """A jackknife fit's reference is t(H - 1); every level must say so.""" + from diff_diff.prep_dgp import generate_staggered_data + + panel = generate_staggered_data(n_units=40, n_periods=6, seed=7) + panel["state"] = panel["unit"] % 8 + with warnings.catch_warnings(): + warnings.simplefilter("ignore", UserWarning) + fit = CallawaySantAnna(cluster="state", vcov_type="jackknife").fit( + panel, outcome="outcome", unit="unit", time="period", first_treat="first_treat" + ) + assert fit.df_inference == 7 + for level in ("simple", "group", "event_study"): + with warnings.catch_warnings(): + warnings.simplefilter("ignore", UserWarning) + df_col = np.asarray(fit.aggregate(level).df, dtype=float) + assert df_col.size and np.all(df_col == 7.0), level + def test_explicit_survey_df_reaches_every_level(self, survey_fit): """The canonical carrier is ``survey_metadata.df_survey``; on an explicit survey design ``df_inference`` is intentionally None.""" diff --git a/tests/test_staggered.py b/tests/test_staggered.py index 97187c98d..324ed5feb 100644 --- a/tests/test_staggered.py +++ b/tests/test_staggered.py @@ -5558,14 +5558,22 @@ def test_bare_cluster_works_with_panel_false_rcs(self): class TestCallawaySantAnnaVcovTypeNarrowContract: - """Narrow vcov_type contract: CS accepts {hc1} only; rejects + """Narrow vcov_type contract: CS accepts {hc1, jackknife}; rejects analytical-sandwich families and conley with methodology-rooted - messages.""" + messages. The jackknife itself is covered in + tests/test_staggered_jackknife.py.""" def test_default_vcov_type_is_hc1(self): cs = CallawaySantAnna() assert cs.vcov_type == "hc1" + def test_jackknife_accepted(self): + cs = CallawaySantAnna(vcov_type="jackknife") + assert cs.vcov_type == "jackknife" + assert cs.get_params()["vcov_type"] == "jackknife" + with pytest.raises(ValueError, match=r"\['hc1', 'jackknife'\]"): + CallawaySantAnna(vcov_type="hc4") + def test_classical_rejected_at_init(self): with pytest.raises(ValueError, match="influence-function"): CallawaySantAnna(vcov_type="classical") diff --git a/tests/test_staggered_jackknife.py b/tests/test_staggered_jackknife.py new file mode 100644 index 000000000..d1124be12 --- /dev/null +++ b/tests/test_staggered_jackknife.py @@ -0,0 +1,1201 @@ +"""Cluster jackknife (CV3) inference for CallawaySantAnna. + +Karim, Nielsen, MacKinnon & Webb (2026), "Improved Inference for CSDID Using +the Cluster Jackknife" (arXiv:2602.12043), equation (20). The reference for +every number here is a delete-one loop written out by hand: the same +estimator, ``vcov_type="hc1"``, the same ``cluster=``, refitted on each +delete-one frame. +""" + +import json +import pickle +import warnings +from pathlib import Path + +import numpy as np +import pandas as pd +import pytest +from scipy import stats + +from diff_diff import ( + CallawaySantAnna, + DiagnosticReport, + DMLDiD, + HonestDiD, + SurveyDesign, + diagnose_design, +) +from tests.conftest import assert_nan_inference + +FIT_KW = {"outcome": "y", "unit": "unit", "time": "t", "first_treat": "g"} +GOLDEN = Path(__file__).resolve().parents[1] / "benchmarks" / "data" / "cs_jackknife_golden.json" + + +def make_panel(cohorts, n_clusters=10, units_per=2, n_periods=8, seed=0, effect=0.7): + """A panel of ``n_clusters`` clusters; ``cohorts`` maps cluster -> first period.""" + rng = np.random.default_rng(seed) + rows = [] + for c in range(n_clusters): + shock = rng.normal(size=n_periods + 1).cumsum() * 0.3 + g = cohorts.get(c, 0) + for j in range(units_per): + u = c * units_per + j + a = rng.normal() + for t in range(1, n_periods + 1): + y = a + shock[t] + rng.normal() + (effect if g and t >= g else 0.0) + rows.append((u, f"s{c}", t, g, y, rng.normal())) + return pd.DataFrame(rows, columns=["unit", "state", "t", "g", "y", "x"]) + + +TWO_COHORTS = {0: 4, 1: 4, 2: 6, 3: 6} + + +def quiet_fit(estimator, data, **overrides): + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + return estimator.fit(data, **{**FIT_KW, **overrides}) + + +def eq20(full, reps): + reps = np.asarray(reps, dtype=float) + h = len(reps) + return np.sqrt((h - 1) / h * np.sum((reps - full) ** 2, axis=0)) + + +def by_hand(data, column, labels, fit_overrides=None, **params): + """Full-sample ``hc1`` fit and the delete-one refits, in ``labels`` order.""" + fit_overrides = fit_overrides or {} + full = quiet_fit(CallawaySantAnna(**params), data, **fit_overrides) + reps = [ + quiet_fit(CallawaySantAnna(**params), data[data[column] != label], **fit_overrides) + for label in labels + ] + return full, reps + + +def es_frame(results, **kwargs): + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + return results.aggregate("event_study", **kwargs).to_dataframe().set_index("event_time") + + +def group_frame(results): + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + return results.aggregate("group").to_dataframe().set_index("label") + + +@pytest.fixture(scope="module") +def panel(): + return make_panel(TWO_COHORTS, seed=11) + + +@pytest.fixture(scope="module") +def clustered(panel): + """Jackknife fit clustered on ``state`` with its by-hand reference.""" + jk = quiet_fit(CallawaySantAnna(cluster="state", vcov_type="jackknife"), panel) + full, reps = by_hand(panel, "state", list(panel["state"].unique()), cluster="state") + return jk, full, reps + + +class TestEquation20: + """The jackknife equals the by-hand delete-one loop, for every quantity.""" + + def test_overall(self, clustered): + jk, full, reps = clustered + assert jk.att == full.att + np.testing.assert_allclose(jk.se, eq20(full.att, [r.att for r in reps]), rtol=1e-12) + + def test_every_cell(self, clustered): + jk, full, reps = clustered + for gt, cell in jk.group_time_effects.items(): + expected = eq20( + full.group_time_effects[gt]["effect"], + [r.group_time_effects[gt]["effect"] for r in reps], + ) + np.testing.assert_allclose(cell["se"], expected, rtol=1e-12, err_msg=str(gt)) + + @pytest.mark.parametrize("balance_e", [None, 1]) + def test_event_study(self, clustered, balance_e): + jk, full, reps = clustered + got = es_frame(jk, balance_e=balance_e) + ref = es_frame(full, balance_e=balance_e) + rep_att = np.array( + [es_frame(r, balance_e=balance_e)["att"].reindex(got.index).to_numpy() for r in reps] + ) + np.testing.assert_allclose(got["att"], ref["att"], rtol=1e-14) + np.testing.assert_allclose(got["se"], eq20(ref["att"].to_numpy(), rep_att), rtol=1e-12) + + def test_group(self, clustered): + jk, full, reps = clustered + got = group_frame(jk) + ref = group_frame(full) + rep_att = np.array([group_frame(r)["att"].reindex(got.index).to_numpy() for r in reps]) + np.testing.assert_allclose(got["se"], eq20(ref["att"].to_numpy(), rep_att), rtol=1e-12) + + @pytest.mark.parametrize("cluster", [None, False]) + def test_unit_level(self, panel, cluster): + """No cluster column (or an explicit ``False``): the unit is deleted.""" + jk = quiet_fit(CallawaySantAnna(cluster=cluster, vcov_type="jackknife"), panel) + full, reps = by_hand(panel, "unit", sorted(panel["unit"].unique())) + np.testing.assert_allclose(jk.se, eq20(full.att, [r.att for r in reps]), rtol=1e-12) + assert jk.df_inference == panel["unit"].nunique() - 1 + got = es_frame(jk) + rep_att = np.array([es_frame(r)["att"].reindex(got.index).to_numpy() for r in reps]) + np.testing.assert_allclose( + got["se"], eq20(es_frame(full)["att"].to_numpy(), rep_att), rtol=1e-12 + ) + + def test_t_reference_with_h_minus_one_df(self, clustered): + jk, _, reps = clustered + h = len(reps) + t_stat = jk.att / jk.se + crit = stats.t.ppf(0.975, h - 1) + np.testing.assert_allclose(jk.t_stat, t_stat, rtol=1e-12) + np.testing.assert_allclose(jk.p_value, 2 * stats.t.sf(abs(t_stat), h - 1), rtol=1e-10) + np.testing.assert_allclose( + jk.conf_int, (jk.att - crit * jk.se, jk.att + crit * jk.se), rtol=1e-10 + ) + cell = next(iter(jk.group_time_effects.values())) + np.testing.assert_allclose( + cell["p_value"], 2 * stats.t.sf(abs(cell["effect"] / cell["se"]), h - 1), rtol=1e-10 + ) + es = jk.aggregate("event_study") + np.testing.assert_allclose( + es.conf_int_upper - es.att, crit * es.se, rtol=1e-10, equal_nan=True + ) + + +class TestConfigurations: + """Full re-estimation: every point-estimate configuration is covered.""" + + @pytest.mark.parametrize( + "params, fit_overrides", + [ + ({"estimation_method": "reg"}, {"covariates": ["x"]}), + ({"estimation_method": "dr"}, {"covariates": ["x"]}), + ({"estimation_method": "ipw"}, {"covariates": ["x"]}), + ({"control_group": "not_yet_treated"}, {}), + ({"anticipation": 1}, {}), + ({"base_period": "universal"}, {}), + ], + ) + def test_matches_by_hand(self, panel, params, fit_overrides): + jk = quiet_fit( + CallawaySantAnna(cluster="state", vcov_type="jackknife", **params), + panel, + **fit_overrides, + ) + full, reps = by_hand( + panel, "state", list(panel["state"].unique()), fit_overrides, cluster="state", **params + ) + np.testing.assert_allclose(jk.se, eq20(full.att, [r.att for r in reps]), rtol=1e-12) + got = es_frame(jk) + rep_att = np.array([es_frame(r)["att"].reindex(got.index).to_numpy() for r in reps]) + live = ~got["is_reference"].to_numpy() + np.testing.assert_allclose( + got["se"].to_numpy()[live], + eq20(es_frame(full)["att"].to_numpy(), rep_att)[live], + rtol=1e-12, + ) + + def test_repeated_cross_sections(self): + """``panel=False``: the cluster column defines the deletion units.""" + rng = np.random.default_rng(5) + rows = [] + uid = 0 + for c in range(10): + g = TWO_COHORTS.get(c, 0) + level = rng.normal() + for t in range(1, 7): + for _ in range(6): + y = level + 0.1 * t + rng.normal() + (0.6 if g and t >= g else 0.0) + rows.append((uid, f"s{c}", t, g, y)) + uid += 1 + data = pd.DataFrame(rows, columns=["unit", "state", "t", "g", "y"]) + jk = quiet_fit(CallawaySantAnna(panel=False, cluster="state", vcov_type="jackknife"), data) + full, reps = by_hand( + data, "state", list(data["state"].unique()), panel=False, cluster="state" + ) + np.testing.assert_allclose(jk.se, eq20(full.att, [r.att for r in reps]), rtol=1e-12) + assert jk.df_inference == 9 + assert jk.get_loo_effects_df()["cluster"].map(type).eq(str).all() + + @pytest.mark.parametrize("method", ["reg", "ipw", "dr"]) + def test_repeated_cross_sections_with_covariates(self, method): + rng = np.random.default_rng(6) + rows = [] + uid = 0 + for c in range(12): + g = TWO_COHORTS.get(c, 0) + level = rng.normal() + for t in range(1, 7): + for _ in range(8): + x = rng.normal() + 0.3 * (g > 0) + y = level + 0.1 * t + 0.5 * x + rng.normal() + (0.6 if g and t >= g else 0.0) + rows.append((uid, f"s{c}", t, g, y, x)) + uid += 1 + data = pd.DataFrame(rows, columns=["unit", "state", "t", "g", "y", "x"]) + params = dict(panel=False, cluster="state", estimation_method=method) + overrides = {"covariates": ["x"]} + jk = quiet_fit(CallawaySantAnna(vcov_type="jackknife", **params), data, **overrides) + full, reps = by_hand(data, "state", list(data["state"].unique()), overrides, **params) + np.testing.assert_allclose(jk.se, eq20(full.att, [r.att for r in reps]), rtol=1e-12) + for gt, cell in jk.group_time_effects.items(): + expected = eq20( + full.group_time_effects[gt]["effect"], + [r.group_time_effects[gt]["effect"] for r in reps], + ) + np.testing.assert_allclose(cell["se"], expected, rtol=1e-12, err_msg=str(gt)) + got = es_frame(jk) + rep_att = np.array([es_frame(r)["att"].reindex(got.index).to_numpy() for r in reps]) + np.testing.assert_allclose( + got["se"], eq20(es_frame(full)["att"].to_numpy(), rep_att), rtol=1e-12 + ) + groups = group_frame(jk) + rep_g = np.array([group_frame(r)["att"].reindex(groups.index).to_numpy() for r in reps]) + np.testing.assert_allclose( + groups["se"], eq20(group_frame(full)["att"].to_numpy(), rep_g), rtol=1e-12 + ) + + +class TestWeightingRoute: + """A refit must keep ``cluster=``: it selects the aggregation weights.""" + + def test_refits_keep_the_cluster_route(self): + # Unequal cohort sizes plus missing treated outcomes: with a cluster + # column the aggregation weights are full cohort masses, without one + # they are each cell's complete-case count, and the two disagree. + data = make_panel({0: 4, 1: 4, 2: 4, 3: 6}, seed=21) + holes = (data["state"].isin(["s0", "s1"])) & (data["t"] >= 7) + data = data.loc[~holes].reset_index(drop=True) + labels = list(data["state"].unique()) + jk = quiet_fit(CallawaySantAnna(cluster="state", vcov_type="jackknife"), data) + full, reps = by_hand(data, "state", labels, cluster="state") + np.testing.assert_allclose(jk.se, eq20(full.att, [r.att for r in reps]), rtol=1e-12) + + full_none, reps_none = by_hand(data, "state", labels) + wrong = eq20(full_none.att, [r.att for r in reps_none]) + assert abs(full_none.att - full.att) > 1e-6, "panel no longer separates the two routes" + assert abs(wrong - jk.se) > 1e-6 + + +class TestEstimationSample: + """``H`` counts the clusters that enter the estimation, nothing else.""" + + def test_rows_with_a_missing_unit_id_form_no_cluster(self, panel): + extra = panel.head(3).copy() + extra["unit"] = np.nan + extra["state"] = "ghost" + dirty = pd.concat([panel.astype({"unit": float}), extra], ignore_index=True) + clean = quiet_fit(CallawaySantAnna(cluster="state", vcov_type="jackknife"), panel) + got = quiet_fit(CallawaySantAnna(cluster="state", vcov_type="jackknife"), dirty) + np.testing.assert_allclose(got.se, clean.se, rtol=1e-12) + assert got.df_inference == clean.df_inference == 9 + assert got.n_clusters == clean.n_clusters == 10 + assert "ghost" not in set(got.get_loo_effects_df()["cluster"]) + + def test_missing_unit_id_cluster_that_moves_a_base_period_is_deleted(self): + # Rows with a missing unit ID are not estimated on, yet this one adds + # period 2 to the calendar grid: it becomes cohort 3's base period, + # has no usable unit, and cohort 3's cells stop being estimable. + # Deleting the "ghost" cluster therefore moves the overall ATT. + rows = [] + late = {3: 2.9, 4: 3.0, 5: 3.1} + for c in range(9): + g = 3 if c < 3 else 5 if c < 6 else 0 + for j in range(2): + for t in (1, 3, 4, 5, 6): + y = 1.0 if (g == 3 and t >= 3) else late[c] if (g == 5 and t >= 5) else 0.0 + rows.append((float(c * 2 + j), f"s{c}", t, g, y)) + clean = pd.DataFrame(rows, columns=["unit", "state", "t", "g", "y"]) + ghost = pd.DataFrame([(np.nan, "ghost", 2, 0, 0.0)], columns=clean.columns) + data = pd.concat([clean, ghost], ignore_index=True) + with_ghost = quiet_fit(CallawaySantAnna(cluster="state"), data) + without_ghost = quiet_fit(CallawaySantAnna(cluster="state"), clean) + np.testing.assert_allclose(with_ghost.att, 3.0, rtol=1e-12) + np.testing.assert_allclose(without_ghost.att, 5 / 3, rtol=1e-12) + + jk = quiet_fit(CallawaySantAnna(cluster="state", vcov_type="jackknife"), data) + labels = ["s3", "s4", "s5", "s6", "s7", "s8", "ghost"] + assert set(jk.get_loo_effects_df()["cluster"]) == set(labels) + assert jk.df_inference == 6 and jk.n_clusters == 7 + full, reps = by_hand(data, "state", labels, cluster="state") + np.testing.assert_allclose(jk.se, eq20(full.att, [r.att for r in reps]), rtol=1e-12) + np.testing.assert_allclose(jk.se, 1.23616, rtol=1e-4) + + def test_an_audited_cluster_counts_toward_the_two_cluster_minimum(self): + # One ordinary cluster plus a missing-unit-ID cluster that moves the + # base period: two deletion units, the second found only by the + # audit. Deleting "main" leaves no estimate, so inference is NaN, + # loudly - not a refusal for "one cluster". + rows = [] + late = {3: 2.9, 4: 3.0, 5: 3.1} + for c in range(9): + g = 3 if c < 3 else 5 if c < 6 else 0 + for j in range(2): + for t in (1, 3, 4, 5, 6): + y = 1.0 if (g == 3 and t >= 3) else late[c] if (g == 5 and t >= 5) else 0.0 + rows.append((float(c * 2 + j), "main", t, g, y)) + data = pd.DataFrame(rows, columns=["unit", "state", "t", "g", "y"]) + ghost = pd.DataFrame([(np.nan, "ghost", 2, 0, 0.0)], columns=data.columns) + data = pd.concat([data, ghost], ignore_index=True) + with warnings.catch_warnings(record=True) as caught: + warnings.simplefilter("always") + jk = CallawaySantAnna(cluster="state", vcov_type="jackknife").fit(data, **FIT_KW) + assert jk.df_inference == 1 and jk.n_clusters == 2 + loo = jk.get_loo_effects_df().set_index("cluster") + assert set(loo.index) == {"main", "ghost"} + np.testing.assert_allclose(loo.loc["ghost", "att_loo"], 5 / 3, rtol=1e-12) + assert np.isnan(loo.loc["main", "att_loo"]) + assert any("leaves no estimate" in str(w.message) for w in caught) + np.testing.assert_allclose(jk.att, 3.0, rtol=1e-12) + assert_nan_inference( + {"se": jk.se, "t_stat": jk.t_stat, "p_value": jk.p_value, "conf_int": jk.conf_int} + ) + + def test_always_treated_cluster_is_not_a_deletion_unit(self): + data = make_panel({**TWO_COHORTS, 9: 1}, seed=13) + jk = quiet_fit(CallawaySantAnna(cluster="state", vcov_type="jackknife"), data) + labels = [s for s in data["state"].unique() if s != "s9"] + full, reps = by_hand(data, "state", labels, cluster="state") + # Deleting the always-treated cluster changes nothing, so it is no replicate. + dropped = quiet_fit(CallawaySantAnna(cluster="state"), data[data["state"] != "s9"]) + assert dropped.att == full.att + assert jk.df_inference == 8 + assert jk.n_clusters == 9 + assert "s9" not in set(jk.get_loo_effects_df()["cluster"]) + np.testing.assert_allclose(jk.se, eq20(full.att, [r.att for r in reps]), rtol=1e-12) + + def test_cluster_that_only_carries_cohort_mass_is_a_deletion_unit(self): + # With a cluster column the aggregations weight by whole-cohort + # masses. Cluster s10 belongs to cohort 2 and has no outcome at all, + # so it enters no cell, yet deleting it changes the weights: the + # overall ATT moves from 17/11 to 5/3. + rows = [] + for c, g in enumerate([2, 2, 2, 3, 3, 3, 0, 0, 0, 0, 2]): + for j in range(2): + for t in (1, 2, 3): + effect = 1.0 if (g == 2 and t >= 2) else 3.0 if (g == 3 and t >= 3) else 0.0 + rows.append((c * 2 + j, f"s{c:02d}", t, g, np.nan if c == 10 else effect)) + data = pd.DataFrame(rows, columns=["unit", "state", "t", "g", "y"]) + labels = list(data["state"].unique()) + full, reps = by_hand(data, "state", labels, cluster="state") + np.testing.assert_allclose(full.att, 17 / 11, rtol=1e-12) + np.testing.assert_allclose(reps[-1].att, 5 / 3, rtol=1e-12) + jk = quiet_fit(CallawaySantAnna(cluster="state", vcov_type="jackknife"), data) + assert jk.df_inference == 10 and jk.n_clusters == 11 + assert set(jk.get_loo_effects_df()["cluster"]) == set(labels) + np.testing.assert_allclose(jk.se, eq20(full.att, [r.att for r in reps]), rtol=1e-12) + got = es_frame(jk) + rep_att = np.array([es_frame(r)["att"].reindex(got.index).to_numpy() for r in reps]) + np.testing.assert_allclose( + got["se"], eq20(es_frame(full)["att"].to_numpy(), rep_att), rtol=1e-12, atol=1e-15 + ) + # Without a cluster column cells are weighted by their own counts, + # the outcome-less units enter nothing, and they are not deleted. + unit_jk = quiet_fit(CallawaySantAnna(vcov_type="jackknife"), data) + assert unit_jk.df_inference == 20 - 1 + + def test_reference_cell_mass_makes_a_cohort_unit_a_deletion_unit(self): + # Universal base on a gapped grid: horizon -2 mixes cohort 3's + # estimate with cohort 5's reference cell, weighted by cohort 5's + # whole mass. A cohort-5 unit with no outcome enters no cell but is + # in that mass, so deleting it moves the horizon's estimate. + data = make_panel({0: 3, 1: 3, 2: 5, 3: 5}, n_clusters=9, n_periods=7, seed=43) + data = data[data["t"] != 4].reset_index(drop=True) + ghost = data["unit"] == data.loc[data["state"] == "s3", "unit"].iloc[0] + data.loc[ghost, "y"] = np.nan + units = sorted(data["unit"].unique()) + ghost_unit = int(data.loc[ghost, "unit"].iloc[0]) + full, reps = by_hand(data, "unit", units, base_period="universal") + dropped = reps[units.index(ghost_unit)] + assert abs(es_frame(dropped).loc[-2, "att"] - es_frame(full).loc[-2, "att"]) > 1e-8 + jk = quiet_fit(CallawaySantAnna(vcov_type="jackknife", base_period="universal"), data) + assert jk.df_inference == len(units) - 1 + got = es_frame(jk) + rep_e = [es_frame(r).loc[-2, "att"] for r in reps] + np.testing.assert_allclose( + got.loc[-2, "se"], eq20(es_frame(full).loc[-2, "att"], rep_e), rtol=1e-12 + ) + + def test_a_cluster_the_rule_misses_is_still_deleted(self, panel, monkeypatch): + """The structural rule is checked on every fit, not trusted.""" + import diff_diff.staggered_jackknife as module + + real = module.resolve_deletion_units + + def forgets_one_cluster(*args, **kwargs): + units = real(*args, **kwargs) + assert units.spare_values == () + keep = slice(None, -1) + return module.DeletionUnits( + column=units.column, + values=units.values[keep], + labels=units.labels[keep], + unit_name=units.unit_name, + labels_are_codes=units.labels_are_codes, + roles=units.roles[keep], + cell_treated=units.cell_treated, + spare_values=units.values[-1:], + spare_labels=units.labels[-1:], + spare_roles=units.roles[-1:], + ) + + expected = quiet_fit(CallawaySantAnna(cluster="state", vcov_type="jackknife"), panel) + monkeypatch.setattr(module, "resolve_deletion_units", forgets_one_cluster) + got = quiet_fit(CallawaySantAnna(cluster="state", vcov_type="jackknife"), panel) + assert got.df_inference == expected.df_inference == 9 + np.testing.assert_allclose(got.se, expected.se, rtol=1e-12) + assert set(got.get_loo_effects_df()["cluster"]) == set(panel["state"].unique()) + + def test_mixed_type_cluster_labels(self, panel): + data = panel.copy() + mapping = {f"s{c}": (c if c % 2 else f"s{c}") for c in range(10)} + data["state"] = data["state"].map(mapping).astype(object) + jk = quiet_fit(CallawaySantAnna(cluster="state", vcov_type="jackknife"), data) + ref = quiet_fit(CallawaySantAnna(cluster="state", vcov_type="jackknife"), panel) + np.testing.assert_allclose(jk.se, ref.se, rtol=1e-12) + assert set(jk.get_loo_effects_df()["cluster"]) == set(mapping.values()) + + def test_two_clusters(self): + """``H = 2``: each refit has a single cluster and still gives its estimate.""" + data = make_panel({0: 4, 1: 4, 2: 6}, n_clusters=8, units_per=2, seed=3) + # Two regions, each holding treated and never-treated units. + data["region"] = np.where(data["unit"] % 2 == 0, "east", "west") + with warnings.catch_warnings(record=True) as caught: + warnings.simplefilter("always") + jk = CallawaySantAnna(cluster="region", vcov_type="jackknife").fit(data, **FIT_KW) + assert not any("PSU" in str(w.message) for w in caught) + assert jk.df_inference == 1 and jk.n_clusters == 2 + full, reps = by_hand(data, "region", ["east", "west"], cluster="region") + assert np.isfinite(jk.se) and jk.se > 0 + np.testing.assert_allclose(jk.se, eq20(full.att, [r.att for r in reps]), rtol=1e-12) + + +class TestDeletionLabels: + """Deletion labels come from the caller's frame, not the fit's recoded copy.""" + + @pytest.mark.parametrize("never_treated", [np.inf, "0"]) + def test_cluster_column_that_the_fit_recodes(self, never_treated): + # Clustering on the first-treatment column itself: the fit recodes + # ``inf`` to 0 and coerces strings in its working copy, so a label + # read from there would match no row of the caller's frame and the + # comparison cluster would never be deleted. + data = make_panel(TWO_COHORTS, seed=37) + if isinstance(never_treated, str): + data["g"] = data["g"].astype(str) + else: + data["g"] = data["g"].astype(float).replace(0.0, never_treated) + with warnings.catch_warnings(record=True) as caught: + warnings.simplefilter("always") + jk = CallawaySantAnna(cluster="g", vcov_type="jackknife").fit(data, **FIT_KW) + loo = jk.get_loo_effects_df() + assert len(loo) == 3 and jk.df_inference == 2 + # Deleting the comparison cluster leaves no estimate: undefined, loudly. + assert loo["att_loo"].isna().sum() == 1 + assert loo.loc[loo["att_loo"].isna(), "role"].tolist() == ["control"] + assert any("leaves no estimate" in str(w.message) for w in caught) + assert_nan_inference( + {"se": jk.se, "t_stat": jk.t_stat, "p_value": jk.p_value, "conf_int": jk.conf_int} + ) + + @pytest.mark.parametrize("cluster", [None, "state"]) + def test_categorical_unit_ids_with_an_unused_category(self, panel, cluster): + # Before pandas 3.0 a groupby over a categorical column lists unused + # categories, so the fit's unit index gains an entry with no rows. + # It must be neither deleted nor audited. + data = panel.copy() + data["unit"] = pd.Categorical(data["unit"], categories=list(range(20)) + [999]) + expected = quiet_fit(CallawaySantAnna(cluster=cluster, vcov_type="jackknife"), panel) + got = quiet_fit(CallawaySantAnna(cluster=cluster, vcov_type="jackknife"), data) + assert got.att == expected.att + np.testing.assert_allclose(got.se, expected.se, rtol=1e-12) + assert got.df_inference == expected.df_inference + assert len(got.get_loo_effects_df()) == len(expected.get_loo_effects_df()) + + @pytest.mark.parametrize("cluster", [None, "state"]) + def test_index_entry_without_rows_is_not_a_candidate(self, cluster): + """The same case built by hand, so it does not depend on the pandas version.""" + from diff_diff.staggered_jackknife import resolve_deletion_units + + data = pd.DataFrame( + { + "unit": [0, 0, 1, 1, 2, 2, 3, 3], + "state": ["a", "a", "a", "a", "b", "b", "c", "c"], + } + ) + precomputed = { + # Position 4 is a unit the index lists but no row carries. + "all_units": np.array([0, 1, 2, 3, 999]), + "unit_cohorts": np.array([4.0, 4.0, 0.0, 0.0, np.nan]), + "is_panel": True, + } + influence = {(4, 5): {"treated_idx": np.array([0, 1]), "control_idx": np.array([2, 3])}} + cells = {(4, 5): {"effect": 1.0, "n_treated": 2}} + units = resolve_deletion_units(data, "unit", cluster, precomputed, influence, cells) + assert units.spare_values == () + if cluster is None: + assert units.values == (0, 1, 2, 3) and units.labels == (0, 1, 2, 3) + assert units.cell_treated[(4, 5)] == (0, 1) + else: + assert units.values == ("a", "b", "c") and units.roles == ( + "treated", + "control", + "control", + ) + assert units.cell_treated[(4, 5)] == (0,) + assert not units.labels_are_codes + + @pytest.mark.parametrize( + "kind", ["datetime", "period", "categorical", "tuple", "float", "string"] + ) + @pytest.mark.parametrize("column", ["state", "unit"]) + def test_typed_labels(self, panel, kind, column): + """Cluster and unit labels of any hashable type delete the rows they name.""" + data = panel.copy() + codes = pd.factorize(data[column])[0] + days = pd.Timestamp("2020-01-01") + pd.to_timedelta(codes, unit="D") + data[column] = { + "datetime": lambda: days, + "period": lambda: pd.PeriodIndex(days, freq="D"), + "categorical": lambda: pd.Categorical([f"c{c:02d}" for c in codes]), + "tuple": lambda: pd.Series([(int(c), "x") for c in codes], index=data.index), + "float": lambda: codes.astype(float) + 0.5, + "string": lambda: [f"c{c:02d}" for c in codes], + }[kind]() + cluster = "state" if column == "state" else None + expected = quiet_fit(CallawaySantAnna(cluster=cluster, vcov_type="jackknife"), panel) + got = quiet_fit(CallawaySantAnna(cluster=cluster, vcov_type="jackknife"), data) + np.testing.assert_allclose(got.se, expected.se, rtol=1e-12) + assert got.df_inference == expected.df_inference + np.testing.assert_allclose( + np.sort(got.get_loo_effects_df()["att_loo"]), + np.sort(expected.get_loo_effects_df()["att_loo"]), + rtol=1e-12, + ) + + def test_a_deletion_that_removes_nothing_is_an_error(self, panel, monkeypatch): + import diff_diff.staggered_jackknife as module + + real = module.resolve_deletion_units + + def stale_labels(*args, **kwargs): + units = real(*args, **kwargs) + return module.DeletionUnits( + column=units.column, + values=("not-a-state",) + units.values[1:], + labels=units.labels, + unit_name=units.unit_name, + labels_are_codes=units.labels_are_codes, + roles=units.roles, + cell_treated=units.cell_treated, + ) + + monkeypatch.setattr(module, "resolve_deletion_units", stale_labels) + with pytest.raises(RuntimeError, match="removed no rows"): + quiet_fit(CallawaySantAnna(cluster="state", vcov_type="jackknife"), panel) + + +class TestReferenceCells: + def test_horizon_that_turns_reference_only_keeps_its_value(self): + """Universal base on a gapped grid: one horizon mixes an estimate and a reference.""" + data = make_panel({0: 3, 1: 5, 2: 5}, n_clusters=8, n_periods=7, seed=41) + data = data[data["t"] != 4].reset_index(drop=True) + params = dict(cluster="state", base_period="universal") + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + jk = CallawaySantAnna(vcov_type="jackknife", **params).fit(data, **FIT_KW) + got = jk.aggregate("event_study").to_dataframe().set_index("event_time") + full, reps = by_hand(data, "state", list(data["state"].unique()), **params) + # Cohort 5's base is period 3 (event time -2), where cohort 3 has an estimate. + cells = full.group_time_effects + assert cells[(5, 3)].get("is_reference") and not cells[(3, 1)].get("is_reference") + assert not got.loc[-2, "is_reference"] + # Without cohort 3's cluster the horizon is reference-only: its value is 0. + without_s0 = es_frame(reps[0]) + assert without_s0.loc[-2, "att"] == 0.0 and without_s0.loc[-2, "is_reference"] + rep_att = [es_frame(r).loc[-2, "att"] for r in reps] + np.testing.assert_allclose( + got.loc[-2, "se"], eq20(es_frame(full).loc[-2, "att"], rep_att), rtol=1e-12 + ) + assert np.isfinite(got.loc[-2, "se"]) and got.loc[-2, "se"] > 0 + + def test_universal_base_reference_cells_keep_nan_se(self, panel): + jk = quiet_fit( + CallawaySantAnna(cluster="state", vcov_type="jackknife", base_period="universal"), + panel, + ) + refs = [c for c in jk.group_time_effects.values() if c.get("is_reference")] + assert refs, "universal base no longer materializes reference cells" + for cell in refs: + assert cell["effect"] == 0.0 + assert_nan_inference(cell) + es = jk.aggregate("event_study") + ref_times = set(es.event_time[es.is_reference].tolist()) + assert ref_times and not ref_times & set(np.asarray(es.vcov_index).tolist()) + assert np.all(np.isnan(es.se[es.is_reference])) + + +class TestLostCells: + """What a deletion that removes cells does (paper, Section 4 caveats).""" + + def test_single_cluster_cohort(self): + data = make_panel({0: 4, 1: 6, 2: 6}, n_clusters=8, seed=17) + with pytest.warns(UserWarning, match=r"deleting 1 of 8 state .*\('s0'\)"): + jk = CallawaySantAnna(cluster="state", vcov_type="jackknife").fit(data, **FIT_KW) + full, reps = by_hand(data, "state", list(data["state"].unique()), cluster="state") + # Paper rule: the replicate built from the surviving cohort enters the sum. + assert np.isfinite(jk.se) + np.testing.assert_allclose(jk.se, eq20(full.att, [r.att for r in reps]), rtol=1e-12) + for (g, _t), cell in jk.group_time_effects.items(): + if g == 4: + assert_nan_inference(cell) + else: + assert np.isfinite(cell["se"]) and cell["se"] > 0 + with pytest.warns(UserWarning, match="the group aggregates average different cohorts"): + groups = jk.aggregate("group").to_dataframe().set_index("label") + assert np.isnan(groups.loc[4, "se"]) and np.isfinite(groups.loc[6, "se"]) + with pytest.warns(UserWarning, match="the event-study estimates average different cohorts"): + es = jk.aggregate("event_study").to_dataframe().set_index("event_time") + # Event time 0 is shared with cohort 6, so it survives every deletion. + assert np.isfinite(es.loc[0, "se"]) + rep_e0 = [es_frame(r).loc[0, "att"] for r in reps] + np.testing.assert_allclose(es.loc[0, "se"], eq20(es_frame(full).loc[0, "att"], rep_e0)) + # Event time 4 exists for cohort 4 only: lost when its cluster is deleted. + assert np.isnan(es.loc[4, "se"]) + + def test_cell_that_keeps_its_key_with_a_nan_effect(self): + # Cohort 4 has two clusters; one of them is unobserved in the last + # period, so deleting the other leaves (4, 8) with no treated support. + data = make_panel({0: 4, 1: 4, 2: 6, 3: 6}, seed=23) + data = data.loc[~((data["state"] == "s1") & (data["t"] == 8))].reset_index(drop=True) + with pytest.warns(UserWarning, match=r"changes which ATT\(g,t\) cells are estimable"): + jk = CallawaySantAnna(cluster="state", vcov_type="jackknife").fit(data, **FIT_KW) + full, reps = by_hand(data, "state", list(data["state"].unique()), cluster="state") + s0 = reps[0].group_time_effects.get((4, 8)) + assert s0 is None or np.isnan(s0["effect"]) + assert np.isfinite(full.group_time_effects[(4, 8)]["effect"]) + assert_nan_inference(jk.group_time_effects[(4, 8)]) + np.testing.assert_allclose(jk.se, eq20(full.att, [r.att for r in reps]), rtol=1e-12) + loo = jk.get_loo_effects_df().set_index("cluster") + assert loo.loc["s0", "n_cells"] < loo.loc["s5", "n_cells"] + + def test_deleting_the_only_comparison_cluster_is_undefined(self): + data = make_panel({0: 4, 1: 4, 2: 6, 3: 6, 4: 6}, n_clusters=6, seed=19) + with pytest.warns(UserWarning, match=r"'s5' leaves no estimate .*standard error is NaN"): + jk = CallawaySantAnna(cluster="state", vcov_type="jackknife").fit(data, **FIT_KW) + assert np.isfinite(jk.att) + assert_nan_inference( + {"se": jk.se, "t_stat": jk.t_stat, "p_value": jk.p_value, "conf_int": jk.conf_int} + ) + for cell in jk.group_time_effects.values(): + assert_nan_inference(cell) + es = es_frame(jk) + assert es["se"].isna().all() and es["p_value"].isna().all() + assert jk.aggregate("event_study").vcov is None + assert group_frame(jk)["se"].isna().all() + loo = jk.get_loo_effects_df() + assert np.isnan(loo.set_index("cluster").loc["s5", "att_loo"]) + assert loo["cluster"].iloc[-1] == "s5" + + +class TestFewTreatedClusters: + """A number resting on fewer than three treated clusters draws a warning.""" + + @staticmethod + def messages(caught): + return [str(w.message) for w in caught if "treated clusters" in str(w.message)] + + def fit_and_aggregate(self, cohorts, n_clusters): + data = make_panel(cohorts, n_clusters=n_clusters, seed=31) + with warnings.catch_warnings(record=True) as at_fit: + warnings.simplefilter("always") + jk = CallawaySantAnna(cluster="state", vcov_type="jackknife").fit(data, **FIT_KW) + with warnings.catch_warnings(record=True) as at_es: + warnings.simplefilter("always") + jk.aggregate("event_study") + with warnings.catch_warnings(record=True) as at_group: + warnings.simplefilter("always") + jk.aggregate("group") + return self.messages(at_fit), self.messages(at_es), self.messages(at_group) + + def test_two_treated_clusters_per_cohort(self): + # Four treated clusters overall, two behind each cohort's own cells. + fit, es, group = self.fit_and_aggregate(TWO_COHORTS, 10) + assert len(fit) == 1 and "14 of 14 ATT(g,t) cells rest on fewer than 3" in fit[0] + assert "overall ATT" not in fit[0] + # Event times 0 to 2 pool both cohorts (four clusters); the rest do not. + assert len(es) == 1 and "event time(s) -4, -3, 3, 4 rest" in es[0] + assert len(group) == 1 and "cohort(s) 4, 6 rest" in group[0] + + def test_one_treated_cluster_per_cohort_also_names_the_overall_att(self): + fit, _, _ = self.fit_and_aggregate({0: 4, 1: 6}, 8) + assert len(fit) == 1 and "the overall ATT rests on 2 and" in fit[0] + + def test_three_treated_clusters_per_cohort_is_silent(self): + fit, es, group = self.fit_and_aggregate({0: 4, 1: 4, 2: 4, 3: 6, 4: 6, 5: 6}, 12) + assert fit == [] and es == [] and group == [] + + def test_the_default_variance_never_warns(self): + data = make_panel(TWO_COHORTS, seed=31) + with warnings.catch_warnings(record=True) as caught: + warnings.simplefilter("always") + hc1 = CallawaySantAnna(cluster="state").fit(data, **FIT_KW) + hc1.aggregate("event_study") + assert self.messages(caught) == [] + + def test_many_deletion_units_warn_about_the_cost(self, panel, monkeypatch): + import diff_diff.staggered_jackknife as module + + monkeypatch.setattr(module, "_MANY_REPLICATES", 15) + with pytest.warns(UserWarning, match=r"20 deletion units, and fit\(\) ran 21 extra"): + CallawaySantAnna(vcov_type="jackknife").fit(panel, **FIT_KW) + + def test_the_cost_counts_audited_clusters_too(self, monkeypatch): + import diff_diff.staggered_jackknife as module + + # Two always-treated clusters are refitted to check they are inert, + # then dropped: 9 deletion units, 11 delete-one refits, 1 baseline. + data = make_panel({**TWO_COHORTS, 8: 1, 9: 1}, n_clusters=11, seed=13) + monkeypatch.setattr(module, "_MANY_REPLICATES", 10) + with pytest.warns(UserWarning, match=r"9 deletion units, and fit\(\) ran 12 extra"): + jk = CallawaySantAnna(cluster="state", vcov_type="jackknife").fit(data, **FIT_KW) + assert jk.df_inference == 8 + + +class TestRefusals: + def test_bootstrap_at_construction(self): + with pytest.raises(ValueError, match="two inference methods"): + CallawaySantAnna(vcov_type="jackknife", n_bootstrap=99) + + def test_bootstrap_at_set_params(self): + est = CallawaySantAnna(vcov_type="jackknife") + with pytest.raises(ValueError, match="two inference methods"): + est.set_params(n_bootstrap=99) + assert est.n_bootstrap == 0 + boot = CallawaySantAnna(n_bootstrap=99) + with pytest.raises(ValueError, match="two inference methods"): + boot.set_params(vcov_type="jackknife") + assert boot.vcov_type == "hc1" + + def test_bootstrap_after_direct_mutation(self, panel): + est = CallawaySantAnna(vcov_type="jackknife") + est.n_bootstrap = 99 + with pytest.raises(ValueError, match="two inference methods"): + est.fit(panel, **FIT_KW) + + def test_survey_design(self, panel): + data = panel.assign(w=1.0) + with pytest.raises(ValueError, match="not supported with survey_design"): + CallawaySantAnna(vcov_type="jackknife").fit( + data, survey_design=SurveyDesign(weights="w"), **FIT_KW + ) + + def test_allow_unbalanced_panel(self, panel): + with pytest.raises(ValueError, match="allow_unbalanced_panel=True"): + CallawaySantAnna(vcov_type="jackknife", allow_unbalanced_panel=True).fit( + panel, **FIT_KW + ) + + def test_repeated_cross_sections_need_a_cluster(self, panel): + data = panel.assign(unit=np.arange(len(panel))) + with pytest.raises(ValueError, match="panel=False needs cluster"): + quiet_fit(CallawaySantAnna(vcov_type="jackknife", panel=False), data) + + def test_one_cluster(self, panel): + data = panel.assign(state="only") + with pytest.raises(ValueError, match="at least two clusters .* found 1"): + quiet_fit(CallawaySantAnna(cluster="state", vcov_type="jackknife"), data) + + @pytest.mark.parametrize("bad", ["classical", "hc2", "hc2_bm", "conley", "hc3", "cr3"]) + def test_other_values_are_still_rejected(self, bad): + with pytest.raises(ValueError, match="vcov_type"): + CallawaySantAnna(vcov_type=bad) + + +class TestResults: + def test_metadata(self, panel, clustered): + jk, full, _ = clustered + assert jk.vcov_type == "jackknife" + assert jk.df_inference == 9 + assert (jk.cluster_name, jk.n_clusters) == (full.cluster_name, full.n_clusters) + assert jk.bootstrap_results is None + unit_jk = quiet_fit(CallawaySantAnna(vcov_type="jackknife"), panel) + unit_hc1 = quiet_fit(CallawaySantAnna(), panel) + assert (unit_jk.cluster_name, unit_jk.n_clusters) == (None, None) + assert (unit_hc1.cluster_name, unit_hc1.n_clusters) == (None, None) + assert unit_jk.df_inference == panel["unit"].nunique() - 1 + + def test_event_study_covariance(self, clustered): + jk, full, reps = clustered + es = jk.aggregate("event_study") + index = list(np.asarray(es.vcov_index).tolist()) + frame = es.to_dataframe().set_index("event_time") + rep_att = np.array([es_frame(r)["att"].reindex(index).to_numpy() for r in reps]) + deviations = rep_att - es_frame(full)["att"].reindex(index).to_numpy() + h = len(reps) + # Element-wise, off-diagonals included: the outer-product form of eq. 20. + np.testing.assert_allclose( + es.vcov, (h - 1) / h * deviations.T @ deviations, rtol=1e-11, atol=1e-15 + ) + np.testing.assert_allclose(np.diag(es.vcov), frame.loc[index, "se"] ** 2, rtol=1e-12) + assert np.linalg.eigvalsh(es.vcov).min() > -1e-12 + assert not np.allclose(es.vcov, np.diag(np.diag(es.vcov))) + np.testing.assert_array_equal(np.asarray(es.df, dtype=float), np.full(len(es.att), 9.0)) + assert es.cband_crit_value is None + # The results fields stay None on a CS fit: the container carries them. + assert jk.event_study_vcov is None and jk.event_study_vcov_index is None + + def test_group_table_records_its_df(self, clustered): + jk, _, _ = clustered + np.testing.assert_array_equal(np.asarray(jk.aggregate("group").df, dtype=float), 9.0) + + def test_simple_and_total_relay_the_jackknife(self, clustered): + jk, _, _ = clustered + simple = jk.aggregate("simple") + assert simple.se[0] == jk.se and simple.df[0] == 9 + total = jk.aggregate("total") + scale = total.att[0] / jk.att + np.testing.assert_allclose(total.se[0], scale * jk.se, rtol=1e-12) + np.testing.assert_allclose(total.p_value[0], jk.p_value, rtol=1e-12) + + def test_summary_names_the_variance(self, panel, clustered): + jk, full, _ = clustered + line = "Variance: cluster jackknife (CV3), delete-one state, H=10, t(9)" + assert line in jk.summary().splitlines() + assert "jackknife" not in full.summary() + unit_jk = quiet_fit(CallawaySantAnna(vcov_type="jackknife"), panel) + assert "delete-one unit, H=20, t(19)" in unit_jk.summary() + + def test_pickle_round_trip_then_aggregate(self, clustered): + jk, _, _ = clustered + clone = pickle.loads(pickle.dumps(jk)) + pd.testing.assert_frame_equal(es_frame(clone), es_frame(jk)) + pd.testing.assert_frame_equal(clone.get_loo_effects_df(), jk.get_loo_effects_df()) + + def test_fit_is_idempotent_and_leaves_params_alone(self, panel): + est = CallawaySantAnna(cluster="state", vcov_type="jackknife") + before = est.get_params() + first = quiet_fit(est, panel) + second = quiet_fit(est, panel) + assert est.get_params() == before + assert first.se == second.se + pd.testing.assert_frame_equal(first.get_loo_effects_df(), second.get_loo_effects_df()) + + def test_a_kit_without_the_field_still_aggregates(self, panel): + """An artifact pickled before the kit carried replicates has no such attribute.""" + hc1 = quiet_fit(CallawaySantAnna(cluster="state"), panel) + expected = es_frame(hc1) + object.__delattr__(hc1._aggregation_kit, "jackknife") + assert "jackknife" not in vars(hc1._aggregation_kit) + pd.testing.assert_frame_equal(es_frame(hc1), expected) + + +class TestLeaveOneOutTable: + def test_values_and_layout(self, clustered): + jk, full, reps = clustered + loo = jk.get_loo_effects_df() + assert list(loo.columns) == ["cluster", "role", "att_loo", "delta_from_full", "n_cells"] + by_label = loo.set_index("cluster") + for label, rep in zip(full_labels(reps, by_label), reps): + np.testing.assert_allclose(by_label.loc[label, "att_loo"], rep.att, rtol=1e-14) + np.testing.assert_allclose(loo["delta_from_full"], loo["att_loo"] - jk.att) + assert loo["delta_from_full"].abs().is_monotonic_decreasing + assert set(by_label.index[by_label["role"] == "treated"]) == {"s0", "s1", "s2", "s3"} + assert (loo["n_cells"] == len(jk.group_time_effects)).all() + + @pytest.mark.parametrize("cluster", [None, "unit", "unit_alias"]) + def test_unit_level_tables_carry_codes_not_labels(self, panel, cluster): + """No raw unit identifier is retained, however the unit is named.""" + data = panel.copy() + data["unit"] = "store-" + data["unit"].astype(str).str.zfill(3) + data["unit_alias"] = "alias-" + data["unit"] + jk = quiet_fit(CallawaySantAnna(cluster=cluster, vcov_type="jackknife"), data) + loo = jk.get_loo_effects_df() + assert sorted(loo["cluster"]) == list(range(20)) + # Code i is the i-th unit in sorted order. + units = np.sort(data["unit"].unique()) + full, reps = by_hand(data, "unit", list(units), cluster=cluster) + np.testing.assert_allclose( + loo.set_index("cluster").loc[list(range(20)), "att_loo"], + [r.att for r in reps], + rtol=1e-12, + ) + blob = pickle.dumps(jk) + assert b"store-" not in blob and b"alias-" not in blob + assert "delete-one unit" in jk.summary() + + def test_refused_without_the_jackknife(self, panel, clustered): + _, full, _ = clustered + with pytest.raises(ValueError, match="requires vcov_type='jackknife'"): + full.get_loo_effects_df() + + def test_refused_on_dml_did(self): + from diff_diff import generate_staggered_data + + data = generate_staggered_data(n_units=120, n_periods=5, seed=4) + data["x"] = np.random.default_rng(0).normal(size=len(data)) + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + res = DMLDiD(seed=0).fit( + data, "outcome", "unit", "period", "first_treat", covariates=["x"] + ) + with pytest.raises(ValueError, match="requires vcov_type='jackknife'"): + res.get_loo_effects_df() + + +def full_labels(reps, by_label): + """Deletion labels in the by-hand order (order of first appearance).""" + return [f"s{c}" for c in range(len(reps))] + + +class TestConsumers: + def test_honest_did_uses_the_jackknife_df(self): + data = make_panel(TWO_COHORTS, n_clusters=24, n_periods=6, seed=29) + jk = quiet_fit( + CallawaySantAnna(cluster="state", vcov_type="jackknife", base_period="universal"), + data, + ) + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + honest = HonestDiD(method="relative_magnitude", M=1.0).fit(jk.aggregate("event_study")) + width = honest.ci_ub - honest.ci_lb + assert np.isfinite(width) + # t(23) critical value, not 1.96. + assert width > 2 * stats.t.ppf(0.975, 23) * honest.original_se * (1 - 1e-9) + + def test_honest_did_refuses_a_singular_jackknife_covariance(self, panel): + """Ten clusters cannot identify a covariance over nine horizons.""" + jk = quiet_fit( + CallawaySantAnna(cluster="state", vcov_type="jackknife", base_period="universal"), + panel, + ) + es = jk.aggregate("event_study") + assert len(es.vcov_index) >= jk.df_inference + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + with pytest.raises(ValueError, match="singular or near-singular"): + HonestDiD(method="relative_magnitude", M=1.0).fit(es) + + def test_diagnostic_report_policy(self, panel): + flags = dict( + run_sensitivity=False, + run_bacon=False, + run_heterogeneity=False, + run_design_effect=False, + run_epv=False, + ) + jk = quiet_fit(CallawaySantAnna(cluster="state", vcov_type="jackknife"), panel) + hc1 = quiet_fit(CallawaySantAnna(cluster="state"), panel) + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + jk_report = DiagnosticReport(jk, **flags).to_dict() + hc1_report = DiagnosticReport(hc1, **flags).to_dict() + pt = jk_report["parallel_trends"] + assert pt["status"] == "ran" + assert pt["method"] == "bonferroni" + pre = es_frame(jk) + pre = pre[(pre.index < 0) & pre["p_value"].notna()] + np.testing.assert_allclose( + pt["joint_p_value"], min(1.0, len(pre) * pre["p_value"].min()), rtol=1e-12 + ) + assert jk_report["pretrends_power"]["status"] == "skipped" + assert "cluster-jackknife" in jk_report["pretrends_power"]["reason"] + # The default variance keeps its covariance-based test and its power section. + assert hc1_report["parallel_trends"]["method"].startswith("joint_wald") + assert hc1_report["pretrends_power"]["status"] == "ran" + + def test_design_diagnosis_accepts_a_jackknife_candidate(self): + rng = np.random.default_rng(8) + history = pd.DataFrame( + [ + (u, t, level + rng.normal()) + for u, level in enumerate(rng.normal(size=16)) + for t in range(1, 9) + ], + columns=["unit", "t", "y"], + ) + candidates = { + "cs": CallawaySantAnna(), + "cs_jackknife": CallawaySantAnna(vcov_type="jackknife"), + } + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + diagnosis = diagnose_design( + history, + outcome="y", + unit="unit", + time="t", + estimators=candidates, + cohort_periods=[6], + n_treated=6, + n_simulations=10, + seed=1, + progress=False, + ) + lock = diagnosis.lock("cs_jackknife", data=history) + frame = diagnosis.to_dataframe().set_index("label") + assert set(frame.index) == {"cs", "cs_jackknife"} + assert frame.loc["cs_jackknife", "n_simulation_failures"] == 0 + assert frame.loc["cs_jackknife", "n_nan_inference"] == 0 + # Same placebo draws, same estimates; only the standard errors differ. + np.testing.assert_allclose( + frame.loc["cs_jackknife", "mean_estimate"], frame.loc["cs", "mean_estimate"] + ) + assert frame.loc["cs_jackknife", "mean_se"] != frame.loc["cs", "mean_se"] + rebuilt = lock.to_estimator() + assert isinstance(rebuilt, CallawaySantAnna) and rebuilt.vcov_type == "jackknife" + + +SIZE_EVIDENCE = ( + Path(__file__).resolve().parents[1] / "benchmarks" / "data" / "cs_jackknife_size.json" +) + + +@pytest.fixture(scope="module") +def points(): + if not SIZE_EVIDENCE.exists(): + pytest.skip("size simulation results not present") + return json.loads(SIZE_EVIDENCE.read_text())["design_points"] + + +class TestSizeEvidence: + """The rejection rates the registry quotes are the ones the simulation produced. + + ``benchmarks/python/cs_jackknife_size.py`` writes the file; the registry's + "Measured size" note (CallawaySantAnna, Cluster jackknife) and the + reporting note quote the ranges below, in whole percent. + """ + + SINGLE_COHORT = ("es_3", "es_4") + SHARED = ("es_0", "es_1", "es_2") + + @staticmethod + def span(points, method, quantities, treated): + rates = [ + p["results"][method][q]["rejection_rate"] + for p in points + if p["n_treated_per_cohort"] in treated + for q in quantities + ] + rates = [r for r in rates if np.isfinite(r)] + if not rates: + return None + return (int(f"{100 * min(rates):.0f}"), int(f"{100 * max(rates):.0f}")) + + @pytest.mark.parametrize( + "treated, hc1, bootstrap, jackknife, hc1_single, jackknife_single", + [ + ((1,), (15, 35), (26, 39), (8, 18), (42, 72), None), + ((2,), (5, 15), (14, 19), (3, 10), (14, 29), (6, 18)), + ((3,), (7, 11), (12, 21), (5, 8), (12, 19), (6, 12)), + ((4,), (6, 9), (9, 12), (4, 7), (7, 14), (4, 9)), + ((6, 8, 10, 12), (4, 7), (7, 10), (3, 6), (6, 10), (4, 7)), + ], + ) + def test_registry_table( + self, points, treated, hc1, bootstrap, jackknife, hc1_single, jackknife_single + ): + assert self.span(points, "hc1", ["overall"], treated) == hc1 + assert self.span(points, "bootstrap", ["overall"], treated) == bootstrap + assert self.span(points, "jackknife", ["overall"], treated) == jackknife + assert self.span(points, "hc1", self.SINGLE_COHORT, treated) == hc1_single + assert self.span(points, "jackknife", self.SINGLE_COHORT, treated) == jackknife_single + + def test_jackknife_rejects_less_than_the_default_everywhere(self, points): + for p in points: + res = p["results"] + assert ( + res["jackknife"]["overall"]["rejection_rate"] + < res["hc1"]["overall"]["rejection_rate"] + ), (p["n_clusters"], p["n_treated_per_cohort"], p["units_per_cluster"]) + assert sum(p["fit_failures"].values()) == 0 + + def test_equal_treated_clusters_give_like_rejection(self, points): + """Two treated clusters: overall at J=1 and a single-cohort horizon at J=2.""" + assert self.span(points, "jackknife", ["overall"], (1,)) == (8, 18) + assert self.span(points, "jackknife", self.SINGLE_COHORT, (2,)) == (6, 18) + assert self.span(points, "jackknife", ["overall"], (2,)) == (3, 10) + assert self.span(points, "jackknife", self.SINGLE_COHORT, (4,)) == (4, 9) + + def test_pretrend_checks(self, points): + bonferroni = ["pretrend_bonferroni"] + assert self.span(points, "jackknife", bonferroni, (2,)) == (8, 29) + assert self.span(points, "jackknife", bonferroni, (3,)) == (6, 14) + assert self.span(points, "jackknife", bonferroni, (4,)) == (5, 12) + assert self.span(points, "jackknife", bonferroni, (6, 8, 10, 12)) == (4, 7) + wald = ["pretrend_wald_chi2"] + assert self.span(points, "jackknife", wald, (2,)) == (49, 71) + # The default fit's chi-square joint test (tracked in TODO.md). + assert self.span(points, "hc1", wald, (2,)) == (62, 78) + assert self.span(points, "hc1", wald, (6, 8, 10, 12)) == (13, 22) + + def test_single_cohort_quantities_are_undefined_with_one_cluster_per_cohort(self, points): + for p in points: + if p["n_treated_per_cohort"] != 1: + continue + jk = p["results"]["jackknife"] + for name in (*self.SINGLE_COHORT, "pretrend_bonferroni"): + assert jk[name]["share_undefined"] == 1.0 + for name in ("overall", *self.SHARED): + assert jk[name]["share_undefined"] == 0.0 + + +@pytest.fixture(scope="module") +def golden(): + if not GOLDEN.exists(): + pytest.skip("R golden not generated (benchmarks/R/generate_cs_jackknife_golden.R)") + return json.loads(GOLDEN.read_text()) + + +@pytest.fixture(scope="module") +def golden_data(golden): + return pd.DataFrame(golden["data"]) + + +class TestRParity: + """R ``did`` on the same delete-one samples (the ``didjack`` procedure).""" + + @pytest.mark.parametrize( + "name", + [ + "reg_nevertreated_varying", + "dr_nevertreated_varying", + "reg_notyettreated_varying", + "dr_nevertreated_universal", + ], + ) + def test_configuration(self, golden, golden_data, name): + cfg = golden["configurations"][name] + jk = quiet_fit( + CallawaySantAnna( + cluster="state", + vcov_type="jackknife", + estimation_method=cfg["est_method"], + control_group=cfg["control_group"], + base_period=cfg["base_period"], + ), + golden_data, + outcome="y", + unit="unit", + time="t", + first_treat="g", + ) + np.testing.assert_allclose(jk.att, cfg["overall_att"], rtol=1e-8) + np.testing.assert_allclose(jk.se, cfg["overall_se"], rtol=1e-8) + np.testing.assert_allclose(jk.p_value, cfg["overall_p"], rtol=1e-7) + np.testing.assert_allclose(jk.conf_int, (cfg["overall_lci"], cfg["overall_uci"]), rtol=1e-7) + assert jk.df_inference == cfg["df"] + loo = jk.get_loo_effects_df().set_index("cluster")["att_loo"] + np.testing.assert_allclose( + loo.reindex(golden["clusters"]).to_numpy(), cfg["overall_att_loo"], rtol=1e-8 + ) + groups = group_frame(jk) + np.testing.assert_allclose( + groups.loc[cfg["group_labels"], "se"], cfg["group_se"], rtol=1e-8 + ) + es = es_frame(jk) + np.testing.assert_allclose( + es.loc[cfg["event_times"], "se"], cfg["event_study_se"], rtol=1e-8 + )