Bug 16727 - [dpqr]nbinom(..., size = Inf) should behave like [dpqr]pois(...)
Summary: [dpqr]nbinom(..., size = Inf) should behave like [dpqr]pois(...)
Alias: None
Product: R
Classification: Unclassified
Component: Accuracy (show other bugs)
Version: R 3.2.3
Hardware: All Linux
: P5 normal
Assignee: R-core
Depends on:
Reported: 2016-02-26 02:13 UTC by t.yee@auckland.ac.nz
Modified: 2016-02-27 13:14 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description t.yee@auckland.ac.nz 2016-02-26 02:13:12 UTC

I believe a negative binomial distribution with
size == Inf should behave like a Poisson distribution.
Currently NaNs are returned for most input.
Please find below some simple code.



# [dpqr]dnbinom(0, mu = mu, size = Inf) are undefined (NaN):
mu   <- 5
dnbinom(0:3, mu = mu, size = Inf)
pnbinom(0:3, mu = mu, size = Inf)
qnbinom(0.3, mu = mu, size = Inf)
rnbinom(3,   mu = mu, size = Inf)

# This is what should be obtained:
dpois(0:3, mu)
ppois(0:3, mu)
qpois(0.3, mu)
rpois(3,   mu)
Comment 1 Martin Maechler 2016-02-26 13:42:06 UTC
Your assessment is entirely correct, thank you!
I will address this.
Comment 2 Martin Maechler 2016-02-27 13:14:27 UTC
Patch committed (svn rev 70234) a few minutes ago to R-devel.

To be ported to R-patched -- for R 3.2.4 -- in two days or so.

Note that rnbinom(n, size=Inf, mu=mu) will not return the same random numbers
as rpois(n, mu) -- but rather the same as  rnbinom(n, size=<very large>, mu=mu).