Skip to content

BUG: Exclude implicit intercepts from IV model F tests - #859

Open
CodingSelim wants to merge 1 commit into
bashtage:mainfrom
CodingSelim:fix/iv-implied-constant-fstat
Open

CodingSelim wants to merge 1 commit into
bashtage:mainfrom
CodingSelim:fix/iv-implied-constant-fstat

Conversation

@CodingSelim

@CodingSelim CodingSelim commented Nov 1, 2026 •

Copy link
Copy Markdown

when the regressors include a dummy for every group, the IV model F test currently tests all coefficients against zero, including the intercept those dummies span. it should test that the group effects are equal and the other slopes are zero. this also makes the result depend on whether the same model is written with an explicit intercept. the example in #780 changes from 227.678 on 3 degrees of freedom to the intended 10.775 on 2.

this finds the coefficient direction that produces the implied intercept and tests the remaining directions, using the fitted covariance and the existing F/chi-square calculation. the columns are scaled before finding that direction so differently sized dummy columns give the same test.

related to #780. this handles the IV estimators; the panel and system cases in that issue still need their own changes.

added 48 regression cases covering IV2SLS, IVLIML and IVGMM, unadjusted/robust covariance, debiased on/off, weights, and differently scaled dummies. each checks against explicit Wald restrictions and the equivalent explicit-intercept model. the new test fails on main before the fix. also checked a mixed-column design with IV2SLS, IVGMMCUE and IVJIVE.

validation:

  • IV tests plus the singular-F-statistic regression module: 9582 passed, 2400 skipped.
  • ruff check on the changed files, formatting of the new test file, and git diff --check pass.
  • built and tested the current checkout in an editable install. the whole-repository run was stopped after the IV run completed, so there is no full-suite result.

@codecov

codecov Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.68%. Comparing base (7fa390b) to head (28bed31).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #859   +/-   ##
=======================================
  Coverage   99.68%   99.68%           
=======================================
  Files         199      200    +1     
  Lines       37875    37909   +34     
  Branches     2436     2437    +1     
=======================================
+ Hits        37756    37790   +34     
  Misses         51       51           
  Partials       68       68           
Flag Coverage Δ
adder 99.67% <100.00%> (+<0.01%) ⬆️
subtractor 99.67% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant