quantiles of the hypergeometric distribution (PR#502)
Thomas Lumley <thomas@biostat.washington.edu> writes:
As phyper seems to work we could just start at the Normal approximation to qhyper and search for x such that phyper(x)=p. Since it's a discrete distribution this shouldn't take that long.
Or apply the same fixup:
sum += (small_N ? term : exp(term));
...
if(small_N) term *= (NR / xr) * (xb / NB);
else term += log((NR / xr) * (xb / NB));
which is pretty obviously not optimized for speed, but certainly
avoids the multiply-by-zero effect.
O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._