Robert_V._Hogg,_Joseph_W._McKean,_Allen_T._Craig

(Jacob Rumans) #1
4.8. The Method of Monte Carlo 293

ui 0.4743 0.7891 0.5550 0.9693 0.0299
xi 00001
ui 0.8425 0.6012 0.1009 0.0545 0.4677
xi 00110

Note that observations form a realization of a random sampleX 1 ,...,X 10 drawn
from the distribution ofX. For these 10 observations, the realized value of the
statisticXisx=0. 3.


Example 4.8.1(Estimation ofπ).Consider the experiment where a pair of num-
bers (U 1 ,U 2 ) is chosen at random in the unit square, as shown in Figure 4.8.1; that
is,U 1 andU 2 are iid uniform (0,1) random variables. Since the point is chosen at
random, the probability of (U 1 ,U 2 ) lying within the unit circle isπ/4. LetXbe
the random variable,


X=

{
1ifU 12 +U 22 < 1
0otherwise.

u 2

u 1
0.5 1.0

1.0

0.5

0.0
0.0

Figure 4.8.1:Unit square with the first quadrant of the unit circle, Example 4.8.1.

Hence the mean ofX isμ =π/4. Now supposeπis unknown. One way of
estimatingπis to repeat the experimentnindependent times, hence, obtaining
a random sampleX 1 ,...,XnonX.Thestatistic4Xis an unbiased estimator ofπ.
The R functionpiestrepeats this experimentntimes, returning the estimate ofπ.
This function and other R functions discussed in this chapter are available at the
site discussed in the Preface. Figure 4.8.1 shows 20 realizations of this experiment.
Note that of the 20 points, 15 fall within the unit circle. Hence our estimate ofπis
4(15/20) = 3.00. We ran this code for various values ofnwith the following results:

Free download pdf