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
Possible bug: rv_discret.ppf for percentiles 0 and 100 and loc > 1 #11132
Comments
An update: Line 3384 in _distn_infrastructure.py could be changed to: See full working example below:
|
Another option could be to ad loc to percentile 0 and 1. See changes in lines:
Though, still a bit puzzled about what value is the correct one for percentile 0. How could ppf(0) be _a -1 if the distribution only is defined from _a to _b? Complete code example below:
|
ppf(0) = min(xk) - 1 I'm not sure about loc with custom distribution, those defined by my guess is that the boundary points are not handled correctly. AFAICS https://github.com/scipy/scipy/blob/master/scipy/stats/_distn_infrastructure.py#L3239 compare with continuous which adjust for loc and scale |
Thanks for your reply, @josef-pkt ! I agree,
When it comes to loc it must be a bug. Looks like you have come to the same conclusion that I did in my comment I'll create a PR for that one. |
Updated rv_discrete to support shifting loc of distribution, ref Issue scipy#11132
Updated rv_discrete to support shifting loc of distribution, ref Issue gh-11132
fixed in gh-11248, closing. thanks @reidarkind and @josef-pkt! |
The method rv_discrete.ppf returns "strange" values for percentile 0 and 1 (where percentile is ranges from 0 to 1).
Given a custom discrete method created with rv_discrete, with values = (xk, xp),
Seems like rv_discrete._ppf returns more correct results.
See code and comments in code:
Reproducing code example:
Error message:
No error messages.
Scipy/Numpy/Python version information:
The text was updated successfully, but these errors were encountered: