test(se-audit): fiddly-bits SE parity locks (C2 DOF, C3 df, C4 intercept SE, C5 Yatchew p/sigma2, G2 cluster band)#628
Conversation
…p/sigma2, fixest cluster band Second "fiddly-bits" coverage batch of the SE parity audit. Pins previously- unasserted golden SE/DOF/intercept fields that already matched R but had no CI assertion (the latent-risk pattern that once hid the CallawaySantAnna reg gap): - C4: estimatr HC1/CR1 2SLS intercept SE via an opt-in return_intercept_se hook on the private _fit_mass_point_2sls (surfaces sqrt(V[0,0]); @overload keeps every caller's 3-tuple return byte-unchanged). classical intercept excluded (O(1/n)). - C2: TWFE dof_hc2_bm and MPD per-period dof_per_coef via CI-inversion (no new result fields; reconstruct conf_int from golden DOF, att+se already pinned). - C3: PlaceboTests leave-one-out df via the public leave_one_out_effects count. - C5: Yatchew p_value + sigma2_lin + sigma2_diff (through the N/(N-1) shift). - G2: fixest DiD/TWFE cluster-SE band pin within the documented ~0.25% CR1 band. C1 (StackedDiD intercept SE) dropped after measurement: it diverges ~0.3% from R (nuisance-parameter reference-cell gap, not machine-precision lockable; the event- study interaction SEs already match ~2e-13) - documented in TODO. Remaining deferrals (G2 hetero golden regen, boundary_gap, C6-C8) tracked in TODO. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0178r8ZK6VRiXbaBiknrWjQB
Overall Assessment✅ Looks good. No unmitigated P0/P1 findings. Executive Summary
MethodologyFinding: P3 informational Finding: P3 informational No undocumented methodology mismatch found in the changed implementation. The new intercept SE is derived from Code QualityNo findings. The optional return arity is centralized through PerformanceNo findings. The new intercept SE calculation reuses the existing 2x2 sandwich and adds only one scalar square root on the opt-in path. MaintainabilityNo findings. Existing production call sites continue to unpack three values with Tech DebtFinding: P3 informational SecurityNo findings. The diff does not introduce secrets, external I/O, credential handling, or unsafe execution paths. Documentation/TestsFinding: P3 informational |
Summary
return_intercept_sehook on the private_fit_mass_point_2sls(surfacessqrt(V[0,0]);@overloadkeeps every caller's 3-tuple return byte-unchanged). Matchesestimatr::iv_robustse_interceptto ~1e-15.TwoWayFixedEffects(hc2_bm)dof_hc2_bmandMultiPeriodDiD(hc2_bm)per-perioddof_per_coef, via CI-inversion (no new result fields): reconstructconf_intfrom the golden Satterthwaite DOF — with ATT+SE already pinned, the CI matches iff the DOF matches.df, recovered from the publicleave_one_out_effectsfinite count.p_value+sigma2_lin+sigma2_diff(through the documentedN/(N-1)sample-vs-population convention shift;sigma2_diffholds despite the literal-2Gdivisor — verified by measurement).fixestDiD/TWFE cluster-robust SE band pin within the documented ~0.25% CR1 small-sample DOF-convention band.TODO.md.Methodology references (required if estimator / math changes)
HeterogeneousAdoptionDiDmass-point Wald-IV / 2SLS SE (intercept surfacing);TwoWayFixedEffects/MultiPeriodDiDCR2 Bell-McCaffrey Satterthwaite DOF; PlaceboTests leave-one-out; DIDHAD Yatchew linearity test;fixestcluster-robust SE.estimatr/fixestR packages. Seedocs/methodology/REGISTRY.md.classicalintercept SE excluded (same documentedO(1/n)projection/DOF deviation as the slope);fixestcluster SE band-pinned only (documented ~0.25% CR1 DOF-convention difference); StackedDiD intercept SE not locked (~0.3% nuisance-parameter parameterization gap). All tracked inTODO.md/REGISTRY.md.Validation
tests/test_estimatr_iv_robust_parity.py,tests/test_estimators_vcov_type.py,tests/test_did_had_parity.py,tests/test_methodology_placebo.py,tests/test_fixest_did_twfe_parity.py. New locks pass at ~1e-10 to ~1e-16; the 3-tuple return contract of_fit_mass_point_2slsis byte-unchanged across all callers (verified viatests/test_had.py).Security / privacy
🤖 Generated with Claude Code
https://claude.ai/code/session_0178r8ZK6VRiXbaBiknrWjQB