Robert_V._Hogg,_Joseph_W._McKean,_Allen_T._Craig

(Jacob Rumans) #1
306 Some Elementary Statistical Inferences

size of the sample and provides a vector to store theθˆ∗s. In theforloop, the
ith bootstrap sample is obtained by the single commandsample(x,n,replace=T),
which is followed by the computation ofθˆ∗i. The remainder of the code forms the
bootstrap confidence interval, while thelistcommand returns the estimate and
the bootstrap confidence interval. The optional secondlistcommand returns the
θˆ∗s, also. Notice that it easy to change the code for an estimator other than the
mean. For example, to obtain a bootstrap confidence interval for the median just
replace the two occurrences ofmeanwithmedian. We illustrate this discussion in
the next example.


Example 4.9.1. In this example, we sample from a known distribution, but, in
practice, the distribution is usually unknown. Let X 1 ,X 2 ,...,Xnbe a random
sample from a Γ(1,β) distribution. Since the mean of this distribution isβ,the
sample averageXis an unbiased estimator ofβ. In this example, theXserves as
our point estimator ofβ. The following 20 data points are the realizations (rounded)
of a random sample of sizen=20fromaΓ(1,100) distribution:


131.7 182.7 73.3 10.7 150.4 42.3 22.2 17.9 264.0 154.4
4.3 265.6 61.9 10.8 48.8 22.5 8.8 150.6 103.0 85.9

The value ofXfor this sample isx=90.59, which is our point estimate ofβ.
For illustration, we generated one bootstrap sample of these data. This ordered
bootstrap sample is


4.3 4.3 4.3 10.8 10.8 10.8 10.8 17.9 22.5 42.3
48.8 48.8 85.9 131.7 131.7 150.4 154.4 154.4 264.0 265.6

The sample mean of this particular bootstrap sample isx∗=78.725. To obtain
our bootstrap confidence interval forβ, we need to compute many more resam-
ples. For this computation, we used the R functionpercentcibootdiscussed
above. Letxdenote the R vector of the original sample of observations. We se-
lected 3000 as the number of bootstraps and choseα=0.10. We used the code
percentciboot(x,3000,.10)to compute our bootstrap confidence interval. Fig-
ure 4.9.1 displays a histogram of the 3000 sample meansx∗s computed by the code.
The sample mean of these 3000 values is 90.13, close tox=90.59. Our program also
obtained a 90% (bootstrap percentile) confidence interval given by (61. 655 , 120 .48),
which the reader can locate on the figure. It does trap the true valueμ= 100.
Exercise 4.9.3 shows that if we are sampling from a Γ(1,β) distribution, then the
interval (2nx/χ^22 n, 2 nx/χ^22 n)isanexact(1−α)100% confidence in-
terval forβ. Note that, in keeping with our superscript notation for critical values,
χ^22 ndenotes theγ100% percentile of aχ^2 distribution with 2ndegrees of free-
dom. This exact 90% confidence interval for our sample is (64. 99 , 136 .69).


What about the validity of a bootstrap confidence interval? Davison and Hink-
ley (1997) discuss the theory behind the bootstrap in Chapter 2 of their book.
Under some general conditions, they show that the bootstrap confidence interval is
asymptotically valid.

Free download pdf