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

From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>
Date: Wed 27 Oct 2004 - 20:12:16 EST

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

______________________________________________
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Wed Oct 27 20:53:31 2004

This archive was generated by hypermail 2.1.8 : Wed 03 Nov 2004 - 22:45:26 EST