Commit 9ebb682
Round-3 CI P1: reject cell-bootstrap when recentering leaks mass to sentinel cells
**P1 (methodology):** Under terminal missingness,
`_cohort_recenter_per_period` subtracts cohort column means across
the full period grid, so a group with no observation at period t
acquires non-zero centered mass at that cell. The PR-4 cell-level
bootstrap builds `psu_codes_per_cell` with -1 sentinels for such
cells and `_unroll_target_to_cells` drops them — silently losing
that centered mass. Under within-group-varying PSU + terminal
missingness, this would under-cluster the bootstrap SE/CI/p-values.
Conservative guard: `_unroll_target_to_cells` now raises
`ValueError` when any sentinel cell (-1 PSU) carries non-zero
cohort-recentered IF mass (|u| > 1e-12). The error message points
users to `n_bootstrap=0` for analytical TSL on such panels. The
analytical path has the same mass-leakage behavior under this
regime but was shipped in PR #323; documenting the bootstrap-
specific guard here avoids advertising a broken combination.
Regression test: `test_bootstrap_cell_level_raises_on_sentinel_mass_leak`
constructs a per-cell IF tensor with non-zero mass at a -1-PSU cell
and asserts `_compute_dcdh_bootstrap` raises with the documented
error message.
**P2 (tests):** The slow MC bootstrap coverage test previously ran
at `L_max=1`, which collapsed the multi-horizon block to a single
target and never exercised the cross-horizon shared-weight path
described in its own docstring. Bumped to `L_max=2` so the shared
(n_bootstrap, n_psu) PSU-level weight matrix is drawn once and
broadcast across horizons via each horizon's cell-to-PSU map.
Added three assertions:
- Horizon-1 bootstrap CI coverage in [0.925, 0.975].
- Horizon-2 bootstrap CI coverage in [0.910, 0.975]. Tolerance is
wider than h-1 because finite-sample analytical TSL coverage on
this DGP is itself ~0.93 at l=2 (measured offline: analytical
h-1 = 0.94, h-2 = 0.926 at n_groups=40). An observed bootstrap
coverage within 1pp of the analytical baseline is consistent
with correct clustering; a drop to ≤ 0.90 would indicate a
real shared-weight broadcast regression.
- `cband_crit_value` finite in ≥ 90% of reps — validates that the
shared (n_bootstrap, n_psu) weight matrix produces a coherent
joint distribution across horizons (required for a valid sup-t
simultaneous band).
Bumped n_bootstrap to 1000 (from 500) to keep internal bootstrap
MC noise below ~0.3pp per CI endpoint at horizon-2's slightly
wider percentile-CI spread.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent c930f74 commit 9ebb682
3 files changed
Lines changed: 157 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
606 | 606 | | |
607 | 607 | | |
608 | 608 | | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
609 | 621 | | |
610 | 622 | | |
611 | 623 | | |
| |||
626 | 638 | | |
627 | 639 | | |
628 | 640 | | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
629 | 666 | | |
630 | 667 | | |
631 | 668 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
20 | 24 | | |
21 | 25 | | |
22 | 26 | | |
| |||
101 | 105 | | |
102 | 106 | | |
103 | 107 | | |
| 108 | + | |
| 109 | + | |
104 | 110 | | |
105 | 111 | | |
106 | 112 | | |
| |||
121 | 127 | | |
122 | 128 | | |
123 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
124 | 142 | | |
125 | | - | |
| 143 | + | |
126 | 144 | | |
127 | 145 | | |
128 | 146 | | |
129 | 147 | | |
130 | | - | |
| 148 | + | |
131 | 149 | | |
132 | 150 | | |
133 | 151 | | |
| |||
146 | 164 | | |
147 | 165 | | |
148 | 166 | | |
149 | | - | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
150 | 173 | | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
159 | 196 | | |
160 | 197 | | |
161 | 198 | | |
| |||
164 | 201 | | |
165 | 202 | | |
166 | 203 | | |
| 204 | + | |
167 | 205 | | |
168 | 206 | | |
169 | 207 | | |
| |||
177 | 215 | | |
178 | 216 | | |
179 | 217 | | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1935 | 1935 | | |
1936 | 1936 | | |
1937 | 1937 | | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
1938 | 1973 | | |
1939 | 1974 | | |
1940 | 1975 | | |
| |||
0 commit comments