Skip to content

Wrong quantiles for the binomial distribution #170

@Martin-exp-z2

Description

@Martin-exp-z2

Hello everyone,

I have noticed that the call quantile(Binomial(5000, 0.998575), 0.0005) returns 5000, which is wrong. Consider:

cdf(Binomial(5000, 0.998575), 4982)
## 0.0004383433701278433
cdf(Binomial(5000, 0.998575), 4983)
## 0.001143721045677184

which return correct values (virtually the same as the corresponding calls of scipy.stats.binom.cdf in Python). Thus, the above-mentioned call of quantile() should return 4983.

In addition, in my opinion, it would be more natural and useful if the function cquantile() returned the upper quantile. In particular, this would allow the user to get the middle median by calling (quantile(dist, 0.5) + cquantile(dist, 0.5))/2.

I am using Distributions v0.25.111 in Julia v1.10.5.

Thank you very much in advance for considering the issue!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions