Bug 15268 - pnbinom vs dnbinom discrepancy
Summary: pnbinom vs dnbinom discrepancy
Status: CLOSED FIXED
Alias: None
Product: R
Classification: Unclassified
Component: Low-level (show other bugs)
Version: R 2.10.1
Hardware: Other All
: P5 normal
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2013-04-12 18:33 UTC by M Welinder
Modified: 2013-07-09 16:31 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description M Welinder 2013-04-12 18:33:01 UTC
dnbinom(2,0,0.01) ---> 0
pnbinom(2,0,0.01) ---> NaN

The former is ok with size==0, the latter not.
Comment 1 Peter Dalgaard 2013-06-20 12:29:26 UTC
There's no actual inconsistency here: 

pnbinom(2,0,x) ==  sum(dnbinom(0:2,0,x)) and dnbinom(0,0,x) is NaN.  

However, it is not obvious to me that we can't  just define neg.bin(0,x) as a one-point distribution at zero.
Comment 2 Martin Maechler 2013-06-21 11:27:53 UTC
(In reply to comment #1)
> There's no actual inconsistency here: 
> 
> pnbinom(2,0,x) ==  sum(dnbinom(0:2,0,x)) and dnbinom(0,0,x) is NaN.  
> 
> However, it is not obvious to me that we can't  just define neg.bin(0,x) as a
> one-point distribution at zero.

Would seem natural to me, and consistent with our long effort of defining border line cases by their limit, notably if the limit is unique, i.e. a true mathematical 'limes'.

Martin
Comment 3 Peter Dalgaard 2013-07-09 16:31:16 UTC
This was never actually a bug, but the corner case size==0 is now implemented as a one-point distribution at zero. (R-devel for now).