-
Notifications
You must be signed in to change notification settings - Fork 226
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
boost::math::quantile() incorrect for poisson_distribution #1203
Comments
Confirmed. Mathematica outputs 2718 for command |
In all failing cases we're rounding to floor in
if we change the policy in poisson for p < 0.5 to Edit: branch "1203" has a prebuilt test set |
I'm (somewhat) back from holiday, but I don't have a good answer because there really isn't one, and the correct behaviour depends a lot on your use case. To summarise, we are inverting a real-valued continuous function, but are expecting a discrete result, so the options are:
The choices and rationale is explained here: https://beta.boost.org/doc/libs/1_82_0/libs/math/doc/html/math_toolkit/pol_tutorial/understand_dis_quant.html |
The problem was observed when we plotted the results of uniformly sampling p across 0-1, computing the quantile, and then plotting on a chart. I understand there is a choice, but it is inconsistent with other math packages, and can have other knock-on affects when users expect consistent results across the number space. |
My thought model for the quantile of a non-continuous distribution is: if we draw many, many observations, what would be the empirical quantile? I would use that number as the population quantile. The result turns out to agree with the quantile function defined on Wikipedia:
This might correspind to (Btw, the second graph (CDF zoom-in) on this page is a little suspicious — the CDF jumps at |
Hi,
We spotted an apparent bias in the inverse cumulative poisson distribution function,
looking deeper, we found boost is generating different results when compared with scipy and statslib (https://github.com/kthohr/stats)
The value of mean is not important, but for p < 0.5, the result is offset by -1
ie:
In Scipy:
Code:
Output:
The text was updated successfully, but these errors were encountered: