# [Rd] bug in rbinom? (PR#1190)

**Peter Dalgaard BSA
**
p.dalgaard@biostat.ku.dk

*02 Dec 2001 01:55:16 +0100*

viele@ms.uky.edu writes:
>* I was simulating the central limit theorem in class,
*>* but found that repeated use of
*>*
*>* mean(rbinom(100000,500,0.4))
*>*
*>* resulted in values less than 200 (the expected mean), for example
*>*
*>* > mean(rbinom(100000,500,0.4))
*>* [1] 199.0294
*>* > mean(rbinom(100000,500,0.4))
*>* [1] 199.1077
*>* > mean(rbinom(100000,500,0.4))
*>* [1] 199.0668
*>* and so on.
*>*
*>* I did this 1000 times and found the results to be distributed
*>* approximately N(199.0787,s=0.036). The standard deviation
*>* is pretty accurate, but the mean is significantly off from 200.
*
I see the same thing on Linux. Looks like it needs checking against
the original CACM algorithm.
--
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 mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._