Correct InverseGamma's mean and support bounds - #151
Merged
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.
Summary:
Building on the earlier CDF/ICDF fix (#149), two more ScalarDistribution methods were found silently returning the internal Gamma helper's statistics instead of InverseGamma's own:
Went further on getApacheDistribution() itself: it e if it were "the" Apache distribution backingInverseGamma, which is exactly what caused this bug (and the earlier CDF/ICDF one) — the Gamma object doesn't represent InverseGamma's own density/CDF/mean at all, it's onlling via x = 1/y. Per the method's own documentedcontract ("or null otherwise"), it now returns null, so any future ScalarDistribution method that isn't explicitly overridden hewill throw instead of silently returning a Gamma-flae thing that implicitly relied on it —getLowerBoundOfParameter()/getUpperBoundOfParameter() — is now overridden directly with the hardcoded correct support, (0, +Infinity), rather than derived from getApacheDistri
Test plan (InverseGammaTest, +3 tests):
sized from the distribution's own finite variance soross repeated runs).
mvn test -Dtest=InverseGammaTest → 6/6 pass. Full beass, 0 regressions.