Repository navigation
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #879 +/- ##
=======================================
Coverage 99.69% 99.69%
=======================================
Files 202 202
Lines 38871 38887 +16
Branches 2501 2502 +1
=======================================
+ Hits 38752 38768 +16
Misses 51 51
Partials 68 68
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On current main d7980a7, the public random-effects estimator fails when both variance components are exactly zero. This includes an all-zero dependent variable with full-rank regressors and ample residual degrees of freedom. The share of variance due to the effects (
rho) and the quasi-demeaning factor (theta) both divide by zero before a result can be returned. The documented contract introduced in #814 is that an undefined R-squared is NaN without an error or warning.On Linux arm64 with Python 3.13 and the exact NumPy 2.2.6 / SciPy 1.15.3 / pandas 2.3.3 pins used by the project's Python 3.13 Azure job, this raises
ZeroDivisionError: float division by zero. On macOS arm64 with NumPy 2.5.5 / SciPy 1.18.1 / pandas 3.1.1, it emits invalid-division warnings and raisesValueError: array must not contain infs or NaNs. A constant outcome of 0.1 also fails on that Mac. The Linux solver produces tiny positive variances for 0.1, so the existing 0.1 test passes there.The patch handles exactly two zero estimated variances. It chooses pooled least squares (theta zero), consistent with the existing zero-random-effect interpretation. The reported share of effects is zero, matching the convention in
PanelOLSwhen total residual variance is zero. The residual and effect variance estimates themselves remain zero. The parameter covariance is zero and R-squared is NaN for the all-zero example. The choice of reported share is a convention because its underlying ratio is undefined; the updated docstring makes that explicit in the behavior.Both added regression cases failed against the parent. The patched wheel passed 507 tests in the zero-total-sum-of-squares, random-effects variance and random-effects degrees-of-freedom modules on both the Linux pins and the Mac stack. The full installed-package suite on macOS passed with 23,688 passed, 2,476 skipped, and 47 expected failures. The new test uses an unbalanced panel and exercises both
small_samplesettings with warnings promoted to errors.Hosted test replay
The Linux Python 3.12 job in Azure build 1204 had one failing test,
IVSystemGMM's comparison of coefficients obtained from equivalent formula and array specifications with random weights. The build recorded 23,391 passed, 2,473 skipped and 47 xfailed in that job. The other nine matrix jobs passed.I repeated the individual test on Linux x86_64 with Python 3.12.16, NumPy 2.0.2, SciPy 1.13.1, pandas 2.2.3, statsmodels 0.14.6, pytest 9.2.0 and pytest-randomly 5.1.0. With one BLAS thread, both builds gave the same results:
Both local failures had 6 of 18 coefficients outside the default tolerance of 1e-7. The hosted job reported 2.51e-6. To reproduce from the source root, using the same test node ID preserves pytest-randomly’s per-test seed.
OPENBLAS_NUM_THREADS=1 python -m pytest --randomly-seed=480777500 'linearmodels/tests/system/test_gmm.py::test_formula_equivalence_weights[steps:1,robust]'