[R] monte carlo method for circle area
(Ted Harding)
Ted.Harding at nessie.mcc.ac.uk
Tue Apr 1 00:07:36 CEST 2003
On 31-Mar-03 Douglas Bates wrote:
> Interestingly, in my first simulation I got a ratio that is exactly
> pi/4 to 4 significant digits.
>
>> rdat = matrix(runif(10000 * 2, min = -1 , max = 1), nrow = 2)
>> sum(colSums(rdat * rdat) < 1)
> [1] 7854
>> pi/4
> [1] 0.7853982
Assuming your error e <= 0.00005 (taken literally, e = 0.0000018).
s = SD = sqrt(p*(1-p)/10000) = 0.004105458 where p = pi/4.
So your e <= 0.00005/s SDs = 0.01217891 SDs, and
P = pnorm(0.01217891) - pnorm(-0.01217891) = 0.009717124
so you are significant! (Not that that's news).
(with e = 0.0000018, we get P = 0.0003498250, but let's not exaggerate)
Cheers,
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 167 1972
Date: 31-Mar-03 Time: 22:07:36
------------------------------ XFMail ------------------------------
More information about the R-help
mailing list