Repository navigation
BUG: remove fixed bounds from discrete GOF binning - #10529
Merged
bashtage merged 1 commit intoOct 24, 2026
Merged
Conversation
Find successive bin edges using the distribution's support and quantiles. Keep CDF-based expected masses and use the same binning in both helpers. Add regression tests and an independent R chisq.test reference. Fixes statsmodels#4359. Signed-off-by: Don Yin <[email protected]> Assisted-by: ChatGPT (OpenAI Codex) Assisted-by: Claude <[email protected]>
Member
|
Thanks |
4 of 6 tasks
bashtage
added a commit
that referenced
this pull request
Oct 25, 2026
The generic discrete ppf of SciPy can raise RuntimeError (skellam with large parameters), which worked before gh-10529. Fall back to a search using only the cdf. The bin edges were moved by a fixed 1e-8, which is lost for edges of about 1e9 and larger, so use np.nextafter. Validate nsupp, remove a dead cdf call and a commented line, and document the change of the support in gof_binning_discrete and gof_chisquare_discrete. Follow up to gh-10529, see gh-4359. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
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.
Discrete GOF binning only scans integers in
[-1000, 1000], so a Poisson(2000) sample falls into one bin and the test returnschi2=0,pvalue=NaN.Bin edges now come from the distribution's
supportandppf; expected counts are still CDF differences.gof_chisquare_discretereusesgof_binning_discreteinstead of its own copy.Tests cover large and shifted Poisson, finite supports and custom bin counts, and match R's
chisq.teston the same bins (reference code in a test comment). The stats suite andruff check .pass.NumPy's guide.
AI Disclosure
Contributions must comply with the statsmodels AI Policy.
Tool(s): ChatGPT / OpenAI Codex, Claude.
Used for: reproducing the bug, drafting the fix and tests, and the R cross-check.
I have personally read, understood, and can explain every line of this diff, and
have verified the statistical/numerical correctness of the change.