From murdoch at stats.uwo.ca  Tue Oct 26 14:28:06 2004
From: murdoch at stats.uwo.ca (murdoch@stats.uwo.ca)
Date: Tue Oct 26 14:28:15 2004
Subject: [Rd] rhyper has too high variance (PR#7314)
Message-ID: <20041026122806.E3BABEAC0@slim.kubism.ku.dk>

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


[Rd] rhyper has too high variance (PR#7314)
murdoch@stats.uwo.ca