Repository navigation
Conversation
Member
|
Could you write a test that will hit this line? |
Aniketsy
reviewed
Jun 9, 2026
| # Regression test for GH#9415: GLMInfluence constructed directly | ||
| # (without hat_matrix_diag) called get_hat_matrix instead of | ||
| # get_hat_matrix_diag, raising AttributeError. | ||
| from statsmodels.stats.outliers_influence import GLMInfluence |
Contributor
There was a problem hiding this comment.
lets move import at top level, you can keep this with --L18
from statsmodels.stats.outliers_influence import MLEInfluence
Aniketsy
reviewed
Jun 9, 2026
Comment on lines
+53
to
+55
| # Regression test for GH#9415: GLMInfluence constructed directly | ||
| # (without hat_matrix_diag) called get_hat_matrix instead of | ||
| # get_hat_matrix_diag, raising AttributeError. |
Contributor
There was a problem hiding this comment.
how about keeping like this ...
# GH#9415: GLMInfluence constructed directly raised AttributeError on cooks_distance
i'll leave this upto you, earlier version is also fine.
Contributor
Author
|
Done both, thanks. |
Aniketsy
approved these changes
Jun 15, 2026
Aniketsy
left a comment
Contributor
There was a problem hiding this comment.
looks fine 👍 , i think you need to resolve conflicts
Call get_hat_matrix_diag() instead of get_hat_matrix() which does not exist on GLMResults, raising AttributeError. Closes statsmodels#9415
Test that GLMInfluence(res) without passing hat_matrix_diag computes cooks_distance correctly via get_hat_matrix_diag.
EdenRochmanSharabi
force-pushed
the
fix/glminfluence-hat-matrix-diag-9415
branch
from
June 18, 2026 07:19
f1c644d to
ac7055c
Compare
bashtage
requested changes
Jun 19, 2026
| from statsmodels.genmod.generalized_linear_model import GLM | ||
| from statsmodels.regression.linear_model import OLS | ||
| from statsmodels.stats.outliers_influence import MLEInfluence, variance_inflation_factor | ||
| from statsmodels.stats.outliers_influence import GLMInfluence, MLEInfluence, variance_inflation_factor |
Member
There was a problem hiding this comment.
Need to run isort on this file. CI shows incorrect sorting in linting.
bashtage
self-requested a review
July 20, 2026 16:01
bashtage
approved these changes
Jul 20, 2026
Member
|
Thanks. Will merge and fix anything that crops up on the formatting side. |
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.
Fix typo in
GLMInfluence.hat_matrix_diag: callsget_hat_matrix()(which does not exist onGLMResults) instead ofget_hat_matrix_diag().The bug is triggered when constructing
GLMInfluencedirectly rather than viaGLMResults.get_influence(), since the latter passeshat_matrix_diagto the constructor.One-line change at
outliers_influence.py:1427.Closes #9415