[Rd] rhyper has too high variance (PR#7314)
murdoch at stats.uwo.ca
murdoch at stats.uwo.ca
Tue Oct 26 14:28:06 CEST 2004
On Tue, 26 Oct 2004 13:38:21 +0200 (CEST), oehl_list at 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
More information about the R-devel
mailing list