We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
median
Binomial
For some reason median(Binomial(25,0.3)) is different from quantile(Binomial(25,0.3),0.5) or any other method of computing the median
median(Binomial(25,0.3))
quantile(Binomial(25,0.3),0.5)
julia> median(Binomial(25,0.3)) 8 julia> quantile(Binomial(25,0.3),0.5) 7 julia> [(n,cdf(Binomial(25,0.3),n)) for n in 0:10] 11-element Vector{Tuple{Int64, Float64}}: (0, 0.00013410686196639642) (1, 0.0015709660973206466) (2, 0.0089605278791425) (3, 0.033240516590842865) (4, 0.09047191855413662) (5, 0.1934884420880652) (6, 0.340654904279392) (7, 0.5118485439713417) (8, 0.6769281251028678) (9, 0.8105639764950546) (10, 0.9021999888782681) julia> [(n,sum(pdf(Binomial(25,0.3),0:n))) for n in 0:10] 11-element Vector{Tuple{Int64, Float64}}: (0, 0.0001341068619663966) (1, 0.001570966097320648) (2, 0.008960527879142505) (3, 0.03324051659084287) (4, 0.09047191855413667) (5, 0.19348844208806526) (6, 0.34065490427939144) (7, 0.5118485439713427) (8, 0.6769281251028665) (9, 0.8105639764950529) (10, 0.9021999888782666) julia> quantile([rand(Binomial(25,0.3)) for _ in 1:100_000_000],0.5) 7.0
and the issue is not special to Binomial(25,0.3)
Binomial(25,0.3)
julia> [(n,median(Binomial(n,0.3)),quantile(Binomial(n,0.3),0.5)) for n in 0:5:100] 21-element Vector{Tuple{Int64, Int64, Int64}}: (0, 0, 0) (5, 2, 1) (10, 3, 3) (15, 4, 4) (20, 6, 6) (25, 8, 7) (30, 9, 9) (35, 10, 10) (40, 12, 12) (45, 14, 13) (50, 15, 15) (55, 16, 16) (60, 18, 18) (65, 20, 19) (70, 21, 21) (75, 22, 22) (80, 24, 24) (85, 26, 25) (90, 27, 27) (95, 28, 28) (100, 30, 30)
The text was updated successfully, but these errors were encountered:
2d28655
Successfully merging a pull request may close this issue.
For some reason
median(Binomial(25,0.3))
is different fromquantile(Binomial(25,0.3),0.5)
or any other method of computing the medianand the issue is not special to
Binomial(25,0.3)
The text was updated successfully, but these errors were encountered: