Skip to content

BUG: Use 3SLS by default when the equations share regressors but not … - #793

Merged
bashtage merged 1 commit into
mainfrom
lm71-fix-iv3sls-instruments-check
Oct 12, 2026
Merged

bashtage merged 1 commit into
mainfrom
lm71-fix-iv3sls-instruments-check

Conversation

@bashtage

Copy link
Copy Markdown
Owner

…instruments

IV3SLS.fit chooses method="ols" (equation by equation estimation) by default if the regressors are the same objects in every equation, since GLS and OLS are then the same estimator. The test compared the exog and endog of the equations but not their instruments. When the equations have the same exog and endog but different instruments, the first stage projections differ across equations and three-stage least squares is not 2SLS by equation. IV3SLS reported "Common Exogenous Variables" and returned the 2SLS estimates, which differ from the 3SLS estimates by up to 0.36 in an example with two equations that share one endogenous regressor and use two different instruments each.

The instruments are now part of the comparison, so the default is GLS (3SLS) unless the instruments are common as well. Models whose equations share exog, endog and instruments, and SUR, are unchanged.

The test compares the default estimates with a direct computation of 3SLS and checks that common instruments still give the equation by equation estimator. It fails without the change.

…instruments

IV3SLS.fit chooses method="ols" (equation by equation estimation) by default if the
regressors are the same objects in every equation, since GLS and OLS are then the same
estimator. The test compared the exog and endog of the equations but not their
instruments. When the equations have the same exog and endog but different instruments,
the first stage projections differ across equations and three-stage least squares is not
2SLS by equation. IV3SLS reported "Common Exogenous Variables" and returned the 2SLS
estimates, which differ from the 3SLS estimates by up to 0.36 in an example with two
equations that share one endogenous regressor and use two different instruments each.

The instruments are now part of the comparison, so the default is GLS (3SLS) unless the
instruments are common as well. Models whose equations share exog, endog and instruments,
and SUR, are unchanged.

The test compares the default estimates with a direct computation of 3SLS and checks that
common instruments still give the equation by equation estimator. It fails without the
change.
@codecov

codecov Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.60%. Comparing base (1782b62) to head (a13a4e1).
⚠️ Report is 71 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #793      +/-   ##
==========================================
+ Coverage   99.59%   99.60%   +0.01%     
==========================================
  Files         128      137       +9     
  Lines       24435    26315    +1880     
  Branches     1820     1888      +68     
==========================================
+ Hits        24336    26212    +1876     
+ Misses         39       38       -1     
- Partials       60       65       +5     
Flag Coverage Δ
adder 99.59% <100.00%> (+0.01%) ⬆️
subtractor 99.59% <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.

@bashtage
bashtage merged commit 6bbe885 into main Oct 12, 2026
24 checks passed
@bashtage
bashtage deleted the lm71-fix-iv3sls-instruments-check branch October 12, 2026 20:50
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