From thomas@biostat.washington.edu  Fri Apr  7 17:10:59 2000
From: thomas@biostat.washington.edu (Thomas Lumley)
Date: Fri, 7 Apr 2000 09:10:59 -0700 (PDT)
Subject: [Rd] Bug in qbinom? (PR#511)
In-Reply-To: <200004071515.RAA13504@pubhealth.ku.dk>
Message-ID: <Pine.GSO.4.21.0004070904390.20598-100000@mail.biostat.washington.edu>

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


In qbinom  we calculate an estimate y based on a Cornish-Fisher expansion
and then search up or down to the right number.  However, for p=1-1e-16 or
thereabouts we get

y=83931130944911952

which is bigger than 1/machine epsilon.  Thus y=y-1 and searching up or
down doesnt work.  A crude solution is to just treat this as p=1, but it
would be better to search up or down in bigger steps.

	-thomas


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


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