From p.dalgaard at biostat.ku.dk  Wed Oct 27 12:12:16 2004
From: p.dalgaard at biostat.ku.dk (Peter Dalgaard)
Date: Wed Oct 27 12:12:26 2004
Subject: [Rd] rhyper has too high variance (PR#7314)
In-Reply-To: <20041026122806.E3BABEAC0@slim.kubism.ku.dk>
References: <20041026122806.E3BABEAC0@slim.kubism.ku.dk>
Message-ID: <x2lldsqxkv.fsf@biostat.ku.dk>

murdoch@stats.uwo.ca writes:

> 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:

Yup, and inconsistent with phyper and dhyper (which is a good thing I
suppose)

> mean(rhyper(1e5,100,60,50))
[1] 31.47707
> sum(phyper(0:50,100,60,50,lower=F))
[1] 31.25
> sum(0:50*dhyper(0:50,100,60,50))
[1] 31.25

Looks like the effect is not due to the choice of random number
generator:

> RNGkind("Super-Duper")
> mean(rhyper(1e5,100,60,50))
[1] 31.45755



-- 
   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


[Rd] rhyper has too high variance (PR#7314)
Peter Dalgaard