Commit 6f3ade4
SpilloverDiD: address review polish — SE clamp, perf hoist, TODO
- Clamp `max(vcov[i, i], 0.0)` before sqrt for ATT and per-ring SE
extraction (spillover.py:L1740-L1762). Matches the sibling-estimator
convention at two_stage.py:1183, estimators.py:606, stacked_did.py:515.
Prevents numerically tiny negative diagonals from indefinite Conley
sandwiches or near-singular cases from NaN-ing the full inference row.
- Hoist row_pos out of the per-cohort loop in
_compute_nearest_treated_distance_staggered (spillover.py:L400-L425).
row_pos depends only on row_unit and unit_to_pos, both invariant across
the cohort iteration; one O(n_rows) array build instead of O(n_rows ×
n_cohorts) on dense staggered fits.
- Add TODO.md row tracking the sparse cKDTree path for the staggered
helper as Wave B follow-up. Resolves the stale code-comment reference
in spillover.py:L365-L369.
139 tests pass; no behavior change on existing fixtures (the clamp is
defensive against unrealizable values; the hoist is a refactor; the TODO
is bookkeeping).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent fc48d69 commit 6f3ade4
2 files changed
Lines changed: 12 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
128 | 129 | | |
129 | 130 | | |
130 | 131 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
400 | 404 | | |
401 | 405 | | |
402 | 406 | | |
| |||
416 | 420 | | |
417 | 421 | | |
418 | 422 | | |
419 | | - | |
420 | | - | |
421 | 423 | | |
422 | 424 | | |
423 | 425 | | |
| |||
1737 | 1739 | | |
1738 | 1740 | | |
1739 | 1741 | | |
| 1742 | + | |
| 1743 | + | |
| 1744 | + | |
| 1745 | + | |
| 1746 | + | |
1740 | 1747 | | |
1741 | | - | |
| 1748 | + | |
1742 | 1749 | | |
1743 | 1750 | | |
1744 | 1751 | | |
| |||
1750 | 1757 | | |
1751 | 1758 | | |
1752 | 1759 | | |
1753 | | - | |
| 1760 | + | |
1754 | 1761 | | |
1755 | 1762 | | |
1756 | 1763 | | |
| |||
0 commit comments