Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly display f-test, j-test in summary. #118

Merged
merged 5 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Changelog
=========

0.5.2 - 2024-10-03
------------------

**Bug fixes:**

- The :class:`~ivmodels.summary.Summary` now correctly includes the rank and J test results.

0.5.1 - 2024-09-16
------------------

Expand Down
8 changes: 4 additions & 4 deletions ivmodels/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,14 @@ def fit(self, X, y, Z=None, C=None, *args, **kwargs):
self.f_statistic_, self.f_p_value_ = (
tests.rank_test(Z, X, C=C, fit_intercept=fit_intercept)
if self.kclass._is_iv_estimator()
else None
), None
else (None, None)
)

self.j_statistic_, self.j_p_value_ = (
tests.j_test(Z, X, y=y, C=C, fit_intercept=fit_intercept)
if self.kclass._is_iv_estimator() and Z.shape[1] > X.shape[1]
else None
), None
else (None, None)
)

return self

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ requires = ['setuptools', 'setuptools-scm', 'wheel']
name = "ivmodels"
description = "IV Models"
readme = "README.md"
version = "0.5.1"
version = "0.5.2"
requires-python = ">=3.7"
authors = [
{ name = "Malte Londschien", email = "[email protected]" },
Expand Down
7 changes: 7 additions & 0 deletions tests/test_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@

assert table.feature_names == names

if k < mx:
assert summary.f_statistic_ > 0
assert 0 <= summary.f_p_value_ <= 1

Check warning on line 49 in tests/test_summary.py

View check run for this annotation

Codecov / codecov/patch

tests/test_summary.py#L48-L49

Added lines #L48 - L49 were not covered by tests

assert summary.j_statistic_ > 0
assert 0 <= summary.j_p_value_ <= 1

summary_string = str(summary)
for name in names:
assert name in summary_string
Expand Down
Loading