Improve p-value computation using truncated eigendecomposition (Wood 2014)#550
Open
Kinara2020 wants to merge 7 commits intodswah:mainfrom
Open
Improve p-value computation using truncated eigendecomposition (Wood 2014)#550Kinara2020 wants to merge 7 commits intodswah:mainfrom
Kinara2020 wants to merge 7 commits intodswah:mainfrom
Conversation
Author
|
Hi @dswah, Thank you for maintaining this project! While reviewing the p-value computation and its associated references in pyGAM, I worked on this change to improve clarity and ensure the messaging more accurately reflects the underlying statistical formulation described in the literature. I’ve verified that all CI checks pass locally, and confirmed that the change does not introduce any functional differences beyond improving the warning/documentation. If there are any suggestions regarding the wording, structure, or if additional validation/tests would be helpful, I’d be glad to refine this further. Thanks again for your time and for your work on pyGAM! |
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.
Summary
This PR updates the way p-values are computed for smooth terms in pyGAM.
The current implementation uses a pseudoinverse of the covariance matrix
following Wood (2006). However, this approach can lead to overly small
p-values when smoothing parameters are estimated, which is a limitation
already mentioned in the warning message in the library.
To address this, I replaced the pseudoinverse-based computation with a
rank-r truncated eigendecomposition approach based on Wood (2013).
By removing near-zero eigenvalues before computing the test statistic,
the method avoids unstable directions in the covariance matrix and
produces more reliable p-values.
Changes
Testing
All existing tests pass locally.
Note
While running the test suite locally, the only failing test encountered
was related to the known Tkinter plotting issue, which appears unrelated
to this change.
References
Wood, S.N. (2013)
"On p-values for smooth components of an extended generalized additive model"
Biometrika 100(1):221–228.