[Rd] Bug in qbinom? (PR#511)

Thomas Lumley thomas@biostat.washington.edu
Fri, 7 Apr 2000 08:33:13 -0700 (PDT)


On Fri, 7 Apr 2000 dtrenkler@nts6.oec.uni-osnabrueck.de wrote:

> n_10;p_0.5;jjx_0:n;qbinom(pbinom(jjx,n,p),n,p) #  This one works as
> expected
> 
> n_100;p_0.5;jjx_0:n;qbinom(pbinom(jjx,n,p),n,p)  # This one causes
> severe problems

The problem is in qbinom(1-epsilon,100,0.5) for epsilon between 10^-15 and
10^-17. It appears to go for ever.

> pbinom(jjx,n,p)[89]-1 
[1] -1.110223e-16

An even simpler version is
   qbinom(1-1e-16,2,0.5)

Presumably a check for zero needs some fuzz.

	-thomas

Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._