Improve p-value warning message and documentation (Wood 2013 reference) – relates to #163#549
Open
Kinara2020 wants to merge 7 commits intodswah:mainfrom
Open
Improve p-value warning message and documentation (Wood 2013 reference) – relates to #163#549Kinara2020 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 improves the warning message related to p-value computation in summary() and clarifies the limitations of the current implementation.
The current implementation follows Wood (2006), which is known to produce p-values that may be smaller than they should be when smoothing parameters are estimated. This PR updates the warning message to make this limitation clearer and references the improved method described in Wood (2013).
No functional changes were made to the statistical computation itself — this change focuses only on improving clarity for users.
⸻
Changes
• Updated warning message from “KNOWN BUG” to “KNOWN LIMITATION”
• Added proper citation to Wood (2013), Biometrika 100(1):221–228
• Explicitly used UserWarning
• Updated _compute_p_value() docstring to reference Wood (2013) and explain the limitation of the current Wood (2006) approach
Testing
All tests pass after the change.
162 passed, 1 skipped
Since this PR only updates warnings and documentation, it does not affect model behavior or break existing functionality.
Example Warning
Before
KNOWN BUG: p-values computed in this summary are likely much smaller than they should be.
After
KNOWN LIMITATION: p-values computed in this summary may be smaller than they should be.
BEFORE TERMINAL OUTPUT:

AFTER TERMINAL OUTPUT:

This implementation follows Wood (2006) which tends to reject the null hypothesis too easily when smoothing parameters are estimated.
A more reliable method is described in:
Wood (2013), "On p-values for smooth components of an extended generalized additive model",
Biometrika 100(1):221–228.
Relates to #163.