Skip to content

Improve p-value warning message and documentation (Wood 2013 reference) – relates to #163#549

Open
Kinara2020 wants to merge 7 commits intodswah:mainfrom
Kinara2020:fix-bug
Open

Improve p-value warning message and documentation (Wood 2013 reference) – relates to #163#549
Kinara2020 wants to merge 7 commits intodswah:mainfrom
Kinara2020:fix-bug

Conversation

@Kinara2020
Copy link
Copy Markdown

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:
image

AFTER TERMINAL OUTPUT:
image

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.

@Kinara2020
Copy link
Copy Markdown
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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants