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

mode(Binomial) (docs?) wrong when (n+1)*p is integer #1927

Open
andreasnoack opened this issue Dec 14, 2024 · 1 comment · May be fixed by #1931
Open

mode(Binomial) (docs?) wrong when (n+1)*p is integer #1927

andreasnoack opened this issue Dec 14, 2024 · 1 comment · May be fixed by #1931
Labels

Comments

@andreasnoack
Copy link
Member

When (n+1)*p is integer, then there are two modes, see https://onlinelibrary.wiley.com/doi/10.1111/j.1467-9574.1980.tb00681.x. The documentation states

  mode(d::UnivariateDistribution)

  Returns the first mode.

but the second is returned, e.g.

julia> [(i, (pdf(Binomial(5, 4/6), i))) for i in 0:5]
6-element Vector{Tuple{Int64, Float64}}:
 (0, 0.004115226337448564)
 (1, 0.04115226337448562)
 (2, 0.16460905349794255)
 (3, 0.329218106995885)
 (4, 0.3292181069958847)
 (5, 0.13168724279835395)

julia> mode(Binomial(5, 4/6))
4
@marcusps
Copy link
Contributor

Also, modes(d) returns [4] in this case, when it should be [3, 4]

marcusps added a commit to marcusps/Distributions.jl that referenced this issue Dec 17, 2024
@marcusps marcusps linked a pull request Dec 17, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants