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

viele@ms.uky.edu viele@ms.uky.edu
Sun, 2 Dec 2001 01:27:55 +0100 (MET)


Full_Name: Kert Viele
Version: 1.3
OS: Windows ME and 2000
Submission from: (NULL) (65.6.218.65)



Hello! Thanks for all your efforts on R. They are appreciated!

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.

Thanks for any help! (including telling me my mistakes!)
- Kert Viele
Assistant Professor of Statistics
University of Kentucky



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