Bug 14739 - pbinom fail when log.p=T
Summary: pbinom fail when log.p=T
Alias: None
Product: R
Classification: Unclassified
Component: Accuracy (show other bugs)
Version: R 2.14.0
Hardware: Other Mac OS X v10.6
: P5 minor
Assignee: R-core
Depends on:
Reported: 2011-11-25 16:29 UTC by manganezzz
Modified: 2011-11-26 16:40 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description manganezzz 2011-11-25 16:29:13 UTC
The following expression return NaN in R 2.14.0, but it should not. Furthermore, the same expression seems to have the correct behavior in R 2.10.1

> pbinom(10,1e6,0.01,log.p=T)
[1] NaN
Warning message:
In pbinom(q, size, prob, lower.tail, log.p) : NaNs produced
Comment 1 Brian Ripley 2011-11-26 12:47:55 UTC
This was caused by r51327
Comment 2 Brian Ripley 2011-11-26 16:40:33 UTC
Well, it does not 'fail' as claimed, it does not return -Inf as before (which is not the actual answer).

The fix in r53127 was far too optimistic in using bpser in a region it is clearly documented not to support: this sort of thing gives other people's code an undeserved bad reputation.

I've added some checks to avoid NaNs (and they do give -Inf in this case).