Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inconsistent return types of quantile etc. #1805

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

devmotion
Copy link
Member

Currently, the return type of quantile etc. is inconsistent, in particular for discrete distributions. For many distributions (and in particular those for which we fall back to StatsFuns/Rmath) the return type is explicitly to converted to Int to match the type of the variates. However, the behaviour of some distributions such as Geometric or Bernoulli is inconsistent: The return type of quantile does not match the type of the variates.

This PR fixes the inconsistency. Moreover, I added tests to avoid regressions and made an existing test a bit stricter. These tests revealed a few additional problems (e.g. caused by the Rmath behaviour that StatsFuns.RFunctions.binominvcdf(10, 1.0, 0.0) = 0 and StatsFuns.RFunctions.hyperinvlogccdf(2, 2, 2, -Inf) = NaN which so far we have hidden by skipping them in the tests).

Fixes #1798.

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.

Inconsistent behaviour of truncate for discrete distributions
1 participant