cdf of binomial and Poisson interpolates between integers at a non-integer point instead of flooring, so P(X<=2.5) is 0.102 instead of 0.0547
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 72/100
Research direction
Start by locating the cdf implementations for the binomial and Poisson distributions, then compare them with the negative binomial implementation, which the issue says already floors non-integer inputs. Check the existing tests for these distributions and add cases at non-integer values such as 2.5 and 3.5. Done means those cases return the CDF at the floored integer, matching the expected values in the issue.
Written by the indexing model from the issue text.
Description
cdf of the discrete families is evaluated as if the distribution were continuous: at a non-integer point it interpolates between the two neighbouring integers instead of returning P(X <= floor(x)). R and every discrete CDF definition floor the argument, so the returned probability is wrong.
library(rssn)
a <- compute(parse_term("cdf(binomial_dist(10,1/2), 2.5)"))
a$text # "0.10201547808034023"
a$value # 0.10201547808034
compute(parse_term("cdf(poisson(5/2), 3.5)"))$value # 0.834308260193408
compute(parse_term("cdf(binomial_dist(10,1/2), 2)"))$value # 0.0546875 (correct, at an integer)
The correct answers are P(X <= 2.5) = P(X <= 2) = pbinom(2, 10, 1/2) = 0.0546875 and P(X <= 3.5) = P(X <= 3) = ppois(3, 2.5) = 0.7575761. rssn instead returns values strictly between the two integer steps: for binomial(10, 1/2) the sequence is 0.05476 (x=2.001), 0.10202 (x=2.5), 0.17171 (x=2.999), i.e. it is a smooth interpolation, not a step function.
The interpolation is exactly the continuous incomplete-beta/gamma formula I_{1-p}(n-x, x+1) evaluated at the real x:
R> pbeta(0.5, 7.5, 3.5) # binomial(10,1/2) "cdf" at x=2.5
[1] 0.1020155
negative_binomial already floors correctly (cdf(negative_binomial(5,1/2), 4.5) is 0.5, the value at 4), so the two discrete kernels are inconsistent with each other as well as with R.
Expected: cdf of a discrete distribution at a non-integer x should return the value at floor(x); e.g. cdf(binomial_dist(10,1/2), 2.5) = 0.0546875 and cdf(poisson(5/2), 3.5) = 0.7575761.
rssn 0.3.0, R 4.6.2 binding, Windows x86_64.
- Dominant language
- Rust
- Stars
- 36
- Forks
- 3
- Avg merge
- 14h 51m
- Merged PRs (30d)
- 29
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Apich-Organization/rssn
-
num_ode_rk4_adaptive rejects atol = 0 while accepting rtol = 0 and while num_ode_dopri5 accepts bothOpenarea/ode-pde good first issue help wanted kind/contract severity/4-minor
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Apich-Organization/rssn#383 ·
Maintainers usually reply within 1 day
-
area/numerical good first issue help wanted kind/doc-mismatch severity/5-trivial
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Apich-Organization/rssn#373 ·
Maintainers usually reply within 1 day
-
area/numerical good first issue help wanted kind/doc-mismatch severity/4-minor
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Apich-Organization/rssn#371 ·
Maintainers usually reply within 1 day
-
json_encode() re-emits a decoded empty JSON object as [], so {} and {"":1} are not round-trip stableOpenarea/api-bindings good first issue help wanted kind/contract severity/4-minor
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Apich-Organization/rssn#361 ·
Maintainers usually reply within 1 day
-
area/statistics good first issue help wanted kind/wrong-result severity/4-minor
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Apich-Organization/rssn#362 ·
Maintainers usually reply within 1 day
All issues in Apich-Organization/rssn
Similar issues
-
triage: failed
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
oxc-project/tsrs#1277 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
autofixer: follow-up triage: bug triage: classified triage: correctness triage: has-reproducer
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
tursodatabase/turso#13221 ·
Maintainers usually reply within 1 day
-
Update Wasmtime to 48.0.11 for RUSTSEC-2026-0648Possibly taken @flyingrobots claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
flyingrobots/edict#457 ·