Skip to content

ENH: Add conservative 95% tF confidence intervals for IV2SLS - #1

Closed
soodoku wants to merge 3 commits into
mainfrom
feature/tf-confidence-intervals
Closed

soodoku wants to merge 3 commits into
mainfrom
feature/tf-confidence-intervals

Conversation

@soodoku

@soodoku soodoku commented Nov 2, 2026 •

Copy link
Copy Markdown

Superseded by upstream bashtage/linearmodels #860. The feature branch remains available for upstream review.

Adds IVResults.tf_conf_int() for conservative 95% tF confidence intervals after IV2SLS with one endogenous regressor and one excluded instrument. For an estimate of 1, SE of 0.4 and first-stage F=10, it returns approximately [-0.3729, 2.3729]; the conventional interval excludes zero.

The method reuses the fitted coefficient, covariance and existing first-stage regression. It interpolates in F using the upward-rounded critical values in Table 3a of Lee, McCrary, Moreira and Porter (2022), following the conservative construction in Section 3.2. F below 4 produces an unbounded interval; F at or above 104.67 uses 1.96. Included controls, constant weights, unadjusted or robust covariance (including aliases), and debiased=False are supported. Unsupported configurations raise ValueError. Existing inference is unchanged; there are no new dependencies.

The inference is asymptotic under the single-instrument IV assumptions. This implements the conservative tabulated tF procedure at 95%, without other confidence levels or p-values. The new guide includes an executable example and describes the approximation and limits.

Validation:

  • 66 focused tests cover published values, a hand-calculated fit, independent covariance calculations, labels, missing observations, transformations and unsupported inputs. Independent review checked all 100 calibration pairs against the primary paper and 80 additional numerical designs.
  • Review found two label-handling edge cases, now fixed and tested: duplicate control/endogenous labels and integer/tuple endogenous labels. All three new cases fail for the intended reason against the prior method and pass with the fix. Replacing the critical value by 1.96 also fails the decisive numerical tests.
  • Clean-runner validation at 39ba5850000db22483a4c1e5d444fc8c3ca447d8: 10,556 IV/shared tests passed, 2,400 skipped; all 12 notebooks passed. Flake8, Black, isort, Ruff, numpydoc, the executable example and the HTML documentation build passed. The documentation build retains one existing changelog duplicate-label warning. The rebuilt wheel independently passes all 66 feature tests outside the checkout. The upstream Linux/Windows matrix is running separately.
  • The full local suite passed 23,344 tests, with 2,473 skipped and 47 expected failures. Its remaining failures were the existing RandomEffects constant-outcome case (also reproduced on untouched upstream) and 12 notebooks blocked before execution by the local sandbox's socket policy. Mypy reports the same 17 existing errors in five files. These unrelated issues are unchanged.

References: Valid t-Ratio Inference for IV; February 16, 2022 author version, Table 3a and Section 3.2.

AI assistance was used for implementation, testing, documentation and independent code review.

@soodoku soodoku closed this Nov 2, 2026
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