Repository navigation
BUG: Make GEE cov_type case-insensitive and fix the constraint guard - #10791
Merged
Merged
Conversation
Mixed-case values such as "Kauermann_Carroll" raised UnboundLocalError.
The guard tested x, which is never None, instead of y; KC gets the same guard.
5 of 6 tasks
Contributor
Author
|
Heads-up: this PR and #10792 both add a bullet at the end of the GLM bug-fix list in |
Member
|
Thanks for the work on GEE. |
This was referenced Nov 19, 2026
bashtage
added a commit
to bashtage/statsmodels
that referenced
this pull request
Nov 19, 2026
test_constraint_small_sample_cov_fails (statsmodels#10791) made the third call of GEE._handle_constraint fail by counting calls, so it passed or failed for the wrong reason if fit changed the number of calls. The wrapper now fails only for the call that receives the matrix returned by _bc_covmat, and the test checks that this call was reached. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
bashtage
added a commit
to bashtage/statsmodels
that referenced
this pull request
Nov 19, 2026
…riance The release note of statsmodels#10791 mentioned only the case-insensitive cov_type. When the expansion of the bias_reduced or kauermann_carroll covariance of a constrained fit failed, fit continued and returned results whose covariance raised a ValueError when used; it now returns None with a ConvergenceWarning. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
bashtage
added a commit
to bashtage/statsmodels
that referenced
this pull request
Nov 19, 2026
test_constraint_small_sample_cov_fails (statsmodels#10791) made the third call of GEE._handle_constraint fail by counting calls, so it passed or failed for the wrong reason if fit changed the number of calls. The wrapper now fails only for the call that receives the matrix returned by _bc_covmat, and the test checks that this call was reached. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
bashtage
added a commit
to bashtage/statsmodels
that referenced
this pull request
Nov 19, 2026
…riance The release note of statsmodels#10791 mentioned only the case-insensitive cov_type. When the expansion of the bias_reduced or kauermann_carroll covariance of a constrained fit failed, fit continued and returned results whose covariance raised a ValueError when used; it now returns None with a ConvergenceWarning. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
bashtage
added a commit
to bashtage/statsmodels
that referenced
this pull request
Nov 20, 2026
test_constraint_small_sample_cov_fails (statsmodels#10791) made the third call of GEE._handle_constraint fail by counting calls, so it passed or failed for the wrong reason if fit changed the number of calls. The wrapper now fails only for the call that receives the matrix returned by _bc_covmat, and the test checks that this call was reached. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
bashtage
added a commit
to bashtage/statsmodels
that referenced
this pull request
Nov 20, 2026
…riance The release note of statsmodels#10791 mentioned only the case-insensitive cov_type. When the expansion of the bias_reduced or kauermann_carroll covariance of a constrained fit failed, fit continued and returned results whose covariance raised a ValueError when used; it now returns None with a ConvergenceWarning. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
bashtage
added a commit
to bashtage/statsmodels
that referenced
this pull request
Nov 20, 2026
test_constraint_small_sample_cov_fails (statsmodels#10791) made the third call of GEE._handle_constraint fail by counting calls, so it passed or failed for the wrong reason if fit changed the number of calls. The wrapper now fails only for the call that receives the matrix returned by _bc_covmat, and the test checks that this call was reached. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
bashtage
added a commit
to bashtage/statsmodels
that referenced
this pull request
Nov 20, 2026
…riance The release note of statsmodels#10791 mentioned only the case-insensitive cov_type. When the expansion of the bias_reduced or kauermann_carroll covariance of a constrained fit failed, fit continued and returned results whose covariance raised a ValueError when used; it now returns None with a ConvergenceWarning. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
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.
NumPy's guide.
Two small GEE fixes from the #10781 review:
cov_typeis case-insensitive. A mixed-case value such as"Bias_Reduced"or"Kauermann_Carroll"raisedUnboundLocalErrorinGEE,OrdinalGEEandNominalGEE.fitand the results class now lowercase it.fitcheckedx, which is neverNone, instead ofy. It now checksy, and the Kauermann-Carroll path gets the same check.The new tests fail on
mainand pass here.AI Disclosure
Contributions must comply with the statsmodels AI Policy.
Tick exactly one of the following. If AI tools were used, replace the
<...>placeholders in the second option with the tool name(s) and how the tool's output was
used.
Tool(s):
Claude (Claude Code).Used for:
drafting the first fix, and tests.I have personally read, understood, and can explain every line of this diff, and
have verified the statistical/numerical correctness of the change.