Commit dad4f68
linalg: propagate noise-floor NaN DOF to LinearRegression inference (R7 P0)
R7 codex flagged a P0: the noise-floor NaN-guard in
_cr2_bm_dof_inner_weighted correctly returns NaN DOF, but
LinearRegression.get_inference() converted non-finite _bm_dof to df=None,
which safe_inference() then treated as normal-theory inference — producing
huge t-stats, p≈0, and zero-width CIs for the guarded coefficients
instead of suppression.
Fix: in get_inference(), when _bm_dof[index] is non-finite (NaN), return
InferenceResult with NaN t_stat/p_value/conf_int and df=None directly,
short-circuiting the normal-theory fallback. SE and coefficient remain
valid (vcov matched at machine precision); only the affected coef's
small-sample inference is suppressed.
New end-to-end regression test TestLinearRegressionFENanGuardEndToEnd
fits the public LinearRegression(vcov_type="hc2_bm", weights=, cluster_ids=)
on weighted_did_absorbed_fe and asserts: NaN inference for the 3 treated-
unit dummies (the noise-floor cases) AND finite inference for the other 9
coefficients. This catches the exact failure mode R7 surfaced.
Also tightens CHANGELOG/REGISTRY wording (R7 P3): explicitly call out that
"vcov + non-noise-floor DOF + compound-contrast DOF match clubSandwich";
high-leverage FE-dummy coefficients are suppressed to NaN.
All 339 linalg/estimators/methodology tests pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 5758797 commit dad4f68
4 files changed
Lines changed: 85 additions & 3 deletions
0 commit comments