Date: Fri, 3 Apr 1998 00:47:43 +0200 (MET DST) From: Goran Brostrom <gb@stat.umu.se> To: r-help@stat.math.ethz.ch Subject: R-beta: Bug in dhyper (and phyper) In-Reply-To: <199803261543.RAA26167@noppa.Helsinki.FI> I think I have found a bug in the function dhyper (R-0.61.2): R> dhyper(0,3,3,0) Warning: NAs produced in function "dhyper" [1] NA Documentation: "Usage dhyper(x, N1, N2, n) ........ The hypergeometric distribution is used for sampling without replacement. It has density p(x) = Choose(N1, x) Choose(N2, n-x) / Choose(N1+N2, n) for x = 0,...,n" R> choose(3,0) * choose(3,0) / choose(6,0) [1] 1 This result is correct, and obviously dhyper is implemented in some way not consistent with the documentation. Also note the spelling error of 'choose' in the documentation. --- Goran Brostrom phone : +46 90 7865223 Department of Statistics 7865213 (secr) Umea University fax : 7866614 S-90187 Umea, Sweden e-mail: gb@stat.umu.se -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help 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-help-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._