fix(imputation): FE-span snap guard on the pretrends lead model#650
Open
igerber wants to merge 1 commit into
Open
fix(imputation): FE-span snap guard on the pretrends lead model#650igerber wants to merge 1 commit into
igerber wants to merge 1 commit into
Conversation
The Test-1 lead indicators + covariates now route through snap_absorbed_regressors after the within-transform (the same two-stage snap + LSMR confirmation the absorb= estimators use). A lead whose calendar period contains only its cohort's rows on Omega_0 collapses to a calendar-time dummy in the span of the absorbed time FE; it now snaps to exact zero — deterministic NaN coefficient + cause-specific warning naming lead[h] — instead of relying on the raw rank check alone, which the documented truncated-MAP-iterate exposure can defeat in slow-convergence regimes. Identified leads unchanged (full suites pass unmodified); behavioral tests lock the spanned-NaN contract and the no-op case. REGISTRY ImputationDiD note added. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Overall Assessment✅ Looks good. No unmitigated P0/P1 findings. Executive Summary
Methodology
Code QualityNo findings. PerformanceNo findings. The added LSMR confirmation is behind the existing two-stage snap screen, so it is scoped to near-absorbed candidate regressors rather than every column unconditionally; see MaintainabilityNo findings. Tech DebtNo findings. The relevant deferred TODO row has been removed after implementation; remaining TODO entries do not track this specific gap. See SecurityNo findings. Documentation/Tests
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
snap_absorbed_regressors(the two-stage FE-span snap + LSMR confirmation theabsorb=estimators use) onImputationDiD._compute_lead_coefficients— the change the demean-modernization PR deliberately deferred (TODO row). Lead indicators are the most plausible FE-spanned regressors: when a lead's calendar period contains only its cohort's rows on the untreated sample (e.g., never-treated units unobserved there), the lead collapses to a calendar-time dummy in the span of the absorbed time FE.lead[h], instead of relying on the raw rank check alone — which the documented truncated-MAP-iterate exposure can defeat in slow-convergence regimes (the junk direction then perturbs the identified lead coefficients; see the REGISTRY "Absorbed Fixed Effects" contract). Identified leads are untouched: the snap is a no-op there and the full imputation suites (incl. the R-parity anchors and the replicate/bit-equality grids) pass unmodified — 198 tests.TestLeadSnapAbsorbed: (a) a spanned-lead design (never-treated span ends before a cohort pre-period) locks NaN + the cause-specific warning + finite untouched siblings; (b) a balanced design locks the no-op (no warning, leads finite). REGISTRY ImputationDiD note documents the guard.Methodology references (required if estimator / math changes)
Validation
tests/test_imputation.py::TestLeadSnapAbsorbed(2 behavioral tests);tests/test_imputation.py+tests/test_methodology_imputation.py+tests/test_replicate_weight_expansion.pyall pass (198).Security / privacy
Generated with Claude Code