Re: [Rd] rhyper has too high variance (PR#7314)

From: <murdoch_at_stats.uwo.ca>
Date: Tue 26 Oct 2004 - 22:28:06 EST


On Tue, 26 Oct 2004 13:38:21 +0200 (CEST), oehl_list@gmx.de wrote :

>
>Dear all,
>
>it looks like rhyper() gives wrong results compared to theory and compared
>to sample() and rghyper(SuppDists).

I agree, these results look wrong. The mean also seems high:

> set.seed(1)
> K <- 100
> J <- 60
> N <- K+J
> p <- K/N
> n <- 50
> x <- rhyper(1000000,K,J,n)
> mean(x)

[1] 31.47323
> sd(x)/1000

[1] 0.002925523
> p*n

[1] 31.25
> (mean(x) - p*n)/(sd(x)/1000)

[1] 76.30568

Duncan Murdoch



R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Tue Oct 26 22:34:21 2004

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 09:00:56 EST