Implement summary method for InstrumentalVariable#851
Conversation
|
👋 Welcome to CausalPy, @anevolbap! Thank you for opening your first pull request! We're excited to have you contribute to the project. 🎉 Here are a few tips to help your PR get merged smoothly:
A maintainer will review your changes soon. Thanks for helping make CausalPy better! 🚀 💼 LinkedIn Shoutout: Once your PR is merged, we'd love to give you a shoutout on LinkedIn to thank you for your contribution! If you're interested, just drop your LinkedIn profile URL in a comment below. |
|
This PR's failing |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #851 +/- ##
==========================================
- Coverage 94.60% 94.60% -0.01%
==========================================
Files 80 80
Lines 12764 12791 +27
Branches 770 775 +5
==========================================
+ Hits 12076 12101 +25
- Misses 485 486 +1
- Partials 203 204 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@drbenvincent this is ready for review. CI fully green after merging Two things to call out for review:
Thanks! |
Summary
Implement the
summarymethod forInstrumentalVariable, replacing theNotImplementedErrorstub.Fixes #360
Approach
Issue #360 floated overriding the base
PyMCModel.print_coefficientsmethod. This PR overridessummarydirectly instead, because IV has five distinct coefficient blocks that don't fit the single-stage shape ofprint_coefficients:beta_toverinstruments)beta_zovercovariates)The base
print_coefficientsassumes onebetavariable. Reusing it would require either splitting the call into multiple shapes or branching inside the base, both of which leak IV-specific structure into the parent class. Inlining the formatting inInstrumentalVariable.summarykeeps the base unchanged.The Bayesian section uses the same
HDIlabel and quantile computation pattern as the baseprint_coefficients(incausalpy/pymc_models.py). Whether to switch the whole codebase toaz.hdiis out of scope for this PR.Changes
InstrumentalVariable.summary()prints OLS, 2SLS, and Bayesian coefficient blocks (instrument and outcome stages with HDI-style intervals)."summary"fromtest_iv_not_implemented_methodsparametrize list.result.summary()call totest_iv_reg.Testing
panel_regressionissue fixed in Fix mypy type: ignore codes in panel_regression.py #853).