Draft: Improved p-values for smooth terms (Wood 2013b). For #163.#586
Open
vsl366 wants to merge 8 commits into
Open
Draft: Improved p-values for smooth terms (Wood 2013b). For #163.#586vsl366 wants to merge 8 commits into
vsl366 wants to merge 8 commits into
Conversation
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.
Draft PR. Replaces the current method of computing p values in PyGAM with the method mentioned in Simon Wood's "On p-values for smooth components of an extended generalized additive model" (Biometrika 100:221-228), addressing issue #163.
This is work in progress. A basic implementation has been finished with minimal optimization and limited testing, which includes seperate testing using monte carlo, and empirical validation against mgcv's reference, with many different categories of test cases.
Changes:
edf1_per_coefto model statistics: the effective degrees of freedom per coefficient, computed as 2 * diag(F) - diag(F^2) per Wood (2013) eq. 4. The existing 'edof' (sum of diag(F)) is unchanged and still used for AIC, GCV, CIs._liu2: chi-squared mixture tail probability using the moment matching approximation from Liu, Tang, Zhang (2009)._liu2_scaled_quadrature: integrates_liu2over scaled chi-squared quantiles for the estimated-scale case._woodteststat, which implements the test statistic and reference distribution from the paper._liu2. For estimated scale,_liu2_scaled_quadratureis used. For integer τ, the function falls through to the simpler chi-squared (known scale) or F (estimated scale) reference, since the boundary block isn't needed._compute_p_valueto use the above helper function and implement the changes.test_pvaluesfile, validating all created functionsReferences: