Anda di halaman 1dari 7

See

discussions, stats, and author profiles for this publication at: https://www.researchgate.net/publication/227686869

An Introduction to the Bootstrap

Article in Teaching Statistics June 2001


DOI: 10.1111/1467-9639.00050

CITATIONS READS

404 2,008

1 author:

Roger Johnson
South Dakota School of Mines and Technology
40 PUBLICATIONS 620 CITATIONS

SEE PROFILE

All content following this page was uploaded by Roger Johnson on 22 April 2015.

The user has requested enhancement of the downloaded file. All in-text references underlined in blue
are linked to publications on ResearchGate, letting you access and read them immediately.
An Introduction to the Bootstrap
KEYWORDS: Roger W. Johnson
Teaching; South Dakota School of Mines & Technology,
Standard error; USA.
Condence interval; e-mail: rwjohnso@taz.sdsmt.edu
Minitab;
Bias; Summary
Mean square error. This article presents bootstrap methods for
estimation, using simple arguments. Minitab
macros for implementing these methods are given.

^ INTRODUCTION ^

I n the eighteenth century stories of The Adven-


tures of Baron Munchausen by Rudolph Erich
Raspe (Raspe 1785), the Baron apparently falls to
the bottom of a deep lake. Just when it looks like
all is lost, he saves himself by picking himself up
by his own bootstraps. Likewise bootstrap
methods in statistics seem to accomplish the im-
possible. These computationally intensive methods,
brought to prominence through the pioneering
work of Bradley Efron, are commonly used by
Fig 1. M1 motorway interarrival times
statistics professionals and are beginning to work
their way into elementary, even algebra-based
statistics texts (e.g. Stout et al. 1999). In this article a xed point near junction 13 of the M1 motorway
I present bootstrap methods for estimating in Bedfordshire, England. These cars were travel-
standard errors and producing condence inter- ling northwards on the M1 in the late evening on
vals. Bootstrap methods are more exible than Saturday 23 March 1985 (see Hand et al. 1994, p. 3).
classical methods which may be analytically
intractable or unusable because of a lack of the
For this data set of n 40 values we nd a sample
appropriate assumptions being satised. When
mean of x 7:80 seconds and sample standard
classical methods may reasonably be used, how-
deviation of s 7:87 seconds. For future reference
ever, we will typically see that bootstrap methods
note that this data set is tted well by an ex-
give quite similar results. The presentation that
ponential density, f x l elx , with l 1=7:80
follows is based on details that appear in Efron
(this is both the method of moments and the
and Tibshirani (1986, 1993) and Rice (1995), and
maximum likelihood estimate of l).
includes short Minitab macros to come up with the
desired estimates. Related articles that have
The standard error of X; SEX, is given by
appeared in this journal are those of Ricketts and
Berry (1994), Reeves (1995) and Tae and s
SEX  sX p
Garnham (1996). n
where s is the population standard deviation.
Estimating s by s, we have
^ BOOTSTRAP ESTIMATES OF ^ s 7:87
SEX  p p 1:24 seconds
STANDARD ERROR n 40
so that 1.24 seconds is an estimate of the standard
For concreteness, let us consider an example to error of X. In layperson's terms we believe the
illustrate bootstrap estimates of standard error. population mean, m, to be about x 7:80 seconds,
Figure 1 displays a histogram of the 40 interarrival give or take around 1.24 seconds. The population
times between 41 consecutive vehicles passing by of interarrivals, not yet carefully dened, may be
Teaching Statistics. Volume 23, Number 2, Summer 2001 . 49
thought of as the collection of all interarrivals (a) Sample n 40 interarrivals with replacement
during the same general time during the week in from the original data and compute x. 
1985 under similar (e.g. weather) conditions. (b) Repeat step (a) a moderate to large number
of times, B, to come up with `bootstrap'
Although we do not ordinarily proceed in this estimates x 1 ; x 2 ; . . . ; x B .
way, here is another way of estimating the stan- (c) Use the standard deviation of the B estimates
dard error of X which relies only on sX  sX : in step (b) to estimate the standard error.
(i) Sample n 40 interarrivals from our popula-
tion and compute x.  (To nd the standard error of a statistic other than
(ii) Repeat (i) a moderate to large number, B, the sample average, follow this same recipe but
of times to come up with estimates compute that statistic rather than the average.)
x 1 ; x 2 ; . . . ; x B . Carrying out this bootstrap method using the
(iii) Use the standard deviation of the B estimates Minitab macros in gure 2 with B 200, we get
in (ii) to estimate the standard error. an estimated standard error of 1.23 ^ a value
nearly identical to the value of 1.24 obtained
above. The value of B 200 is usually suciently
It is important in this procedure to produce
large for bootstrap standard error estimates. Efron
estimates x i with a sample size identical to our
and Tibshirani, in fact, indicate that `very seldom
original sample size of n. If, in step (ii), we used a
are more than B 200 replications needed for
sample size less than n, then the procedure would
estimating a standard error' (1993, p. 52) and that
tend to overestimate the error in our original
the variance of the bootstrap standard error esti-
estimate of 7.80 seconds; likewise, if in step (ii) we
mate is roughly c1 =n2 c2 =nB, where the con-
used a value more than n, then the procedure
stants c1 and c2 depend on the underlying
would tend to underestimate the error in our
population but not on n or B (p. 272).
original estimate of 7.80 seconds.

A bootstrap method of estimating the standard This bootstrap method may be used with even
error of X now involves a modication of the smaller sized data sets than that given above.
above procedure. In particular, use the sample as Loosely speaking, however, the bootstrap idea of
an approximation of our population. Specically, approximating the population by the sample
take samples with replacement of size n from the becomes more questionable as the sample size, n,
data to approximate samples of size n from the decreases. As with other statistical procedures, our
population. If you think that this is akin to `lifting trust in the bootstrap will grow with increased
yourself by your bootstraps' you are not alone! sample size.
Here, then, is a bootstrap method for estimating
the standard error of X: In the previous example there was, of course, no

File: sedriver.txt

noecho
erase c10
let k1 = n(c1) # the data must have previously been put in column c1
let k2 = 200 # number of bootstrap samples, B
execute 'bootstrp.txt' k2
echo
let k3 = stdev(c10) # se of mean
print k3
end

File: bootstrp.txt
sample k1 c1 c11;
replace.
let k20 = mean(c11)
stack c10 k20 c10

Use execute sedriver.txt at the Minitab prompt to run this bootstrap procedure
Fig 2. Bootstrap standard error code

50 . Teaching Statistics. Volume 23, Number 2, Summer 2001


need to estimate the standard error of X using of the correlation coecient as the standard
the bootstrap method as we know SEX deviation of the B bootstrapped correlation
p p
s= n  s= n. The bootstrap method of esti- coecient values. One such execution of this
mating the standard error of a statistic becomes bootstrap method yielded the estimated standard
valuable in those cases where we do not have a error of 0.075 (Minitab macros to implement this
theoretical formula for the standard error of that are available from the author). If we were willing
statistic. There is, for example, no closed-form to assume that mortality and calcium have a
formula for the standard error of the sample bivariate Normal distribution ^ highly doubtful
median. Continuing the example involving here as the scatter diagram is not strongly elliptical
interarrivals along the M1 motorway, the sample with its points concentrated toward the centre of
median of 5.0 is an estimate of the population the ellipse ^ then we could estimate the standard
median. To estimate the standard error of the error of the correlation coecient p with the known

sample median, use the bootstrap procedure given approximate formula 1 r2 = n 3 0:094.
above, computing medians rather than averages. One of the benets of the bootstrap procedure is
Doing so (replace the line let k20 mean(c11) that no distributional assumptions are necessary to
with let k20 median(c11) in the Minitab code in use it.
gure 2) gives 0.68 as an estimate of the standard
error of the sample median.

^ BOOTSTRAP CONFIDENCE ^
As a nal example to illustrate the above bootstrap
INTERVALS
method of estimating standard errors, consider
male mortality rate averaged over the years 1958^ In this section we outline a bootstrap method for
1964 for towns in England and Wales versus producing a condence interval (see Rice 1995). As
calcium (from Hand et al. 1994, pp. 5^6), shown before, it is helpful to compare this method with a
as a scatter diagram in gure 3. The calcium standard technique, so we start with the well-
concentration may be thought of as a measure of known case of estimating a mean with a `large'
water hardness; the higher the calcium concen- sample size. Returning to the M1 motorway data,
tration, the harder the water. The correlation an approximate 95% condence interval for the
coecient between male mortality and calcium mean interarrival time m, by the central limit
concentration for the 61 data points shown is theorem, is
 
0.655. s s
x 1:96 p ; x 1:96 p 5:36; 10:24
n n
Now we give the rationale for a bootstrap con-
dence interval. Suppose we can nd values c1 and
c2 so that
PX m  c2 0:975 and PX m  c1 0:025
1

then Pc1 < X m < c2 0:95 or, with some


algebra, PX c2 < m < X c1 0:95 so that
X c2 ; X c1 2
Fig 3. Mortality vs calcium
is a 95% condence interval for m. By way of
reminder, (2) is a random interval that we are
We can again use the bootstrap to estimate the using in an attempt to capture the xed unknown
standard error of the correlation coecient. value of m. Returning to (1), the value of m, of
Obtain a bootstrap sample of 61 ordered pairs of course, is unknown. We can estimate it however by
mortality and calcium concentration by sampling the observed sample mean which, recall, is 7.80.
with replacement from the 61 cities 61 times. Then (1) approximately becomes
Compute the correlation coecient of this boot-
pX  c2 7:80 0:975 and
strap sample. Repeat the entire process B times
(200 times, say). Then estimate the standard error pX  c1 7:80 0:025 3

Teaching Statistics. Volume 23, Number 2, Summer 2001 . 51


That is, c2 7:80 is approximately the 97.5th Tibshirani (1993, pp. 273^5). Consequently, setting
percentile of the distribution of X and c1 7:80 is x 25 c1 7:80 and x 975 c2 7:80 in (3)
approximately the 2.5th percentile of the distri- gives c1 2:275 and c2 2:525, so that the
bution of X. desired 95% bootstrap condence interval is
x c2 ; x c1 5:28; 10:08. Note that this is
quite close to the standard calculation given at the
Here is what we could do to estimate c1 and c2 if
beginning of the section.
we were able to time travel back to 1985 and sample
from the interarrival population:
A bit of algebra shows that the 95% bootstrap
(1) Sample n 40 interarrivals from our popula- condence interval just given with B 1000 can be
tion and compute x.  expressed as 2x x 975 ; 2x x 25 (verify this).
(2) Repeat step (1) a number of times, B, to come Generalizing the above chain of reasoning, a
up with estimates x 1 ; x 2 ; . . . ; x B . 1001 a% bootstrap condence interval for the
(3) Use the sample percentiles to estimate the parameter y using the estimate y^ is
desired population percentiles. With B 1000,
for example, sort the estimates above as 2y^ yUpper ; 2y^ yLower 4
x 1  x 2      x 999  x 1000 and use x 25 to
estimate the 2.5th percentile of X (set this where yUpper is the B1 a=2 order statistic of the
equal to c1 7:80 and solve for c1 ) and use bootstrapped estimates and yLower is the Ba=2 order
x 975 to estimate the 97.5th percentile of X (set statistic of the bootstrapped estimates.
this equal to c2 7:80 and solve for c2 ).
Finally, report x c2 ; x c1 as the desired
If we want, for example, a 95% bootstrap
condence interval.
condence interval for the population median, run
the Minitab macro in gure 4 replacing the line let
Mirroring the earlier discussion for the standard k8 mean(c1) with let k8 median(c1) along with
error, the corresponding bootstrap method comes the macro bootstrp.txt in gure 2 replacing the line
up with the estimates in steps (1) and (2) not by let k20 mean(c11) with let k20 median(c11).
sampling from the population, but by sampling with One such execution of this code with the M1
replacement n times from the data. Carrying out motorway data and B 1000 gave the 25th
this bootstrap method on one occasion using the smallest bootstrap median as 4.0 and the 975th
Minitab macro in gure 4 along with the macro smallest bootstrap median as 6.0. Consequently,
bootstrp.txt in gure 2 with B 1000 gave the desired 95% bootstrap condence interval,
x 25 5:525 and x 975 10:325. The value of recalling the sample median to be 5.0, is
B 1000 is considered reasonably large for ^ Upper ; 2yy
2yy ^ Lower 25:06:0; 25:04:0
bootstrap condence intervals; see Efron and 4:0; 6:0.

File: cidriver.txt
noecho
erase c10
let k1 = n(c1) # the data must have previously been put in column c1
let k2 = 1000 # number of bootstrap samples, B
execute 'bootstrp.txt' k2
sort c10 c11
let k3 = 0.95 # desired condence level
let k4 = round(k2*(1^k3)/2)
let k5 = round(k2*(1+k3)/2)
let k6 = c11(k4)
let k7 = c11(k5) # (k6,k7) is the percentile interval
let k8 = mean(c1)
let k10 = 2*k8^k7
let k11 = 2*k8^k6
print k10 k11 # 100*k3% condence interval (4) for mean
end

Use execute cidriver.txt at the Minitab prompt to run this bootstrap procedure
Fig 4. Bootstrap condence interval code

52 . Teaching Statistics. Volume 23, Number 2, Summer 2001


Finally, returning to the problem of estimating with the bias, Biasy ^ Ey
^ y of y^ as well as
the correlation between male mortality and ^
with SEy In fact, a measure of the typical
calcium levels, executing analogous code (available deviation of y^ from y is the root mean square
q
from the author) with B 1000 in one instance error, MSEy ^ , where
gave the 25th smallest bootstrap correlation as    
0.776 and the 975th smallest bootstrap cor- MSEy^ E y^ y2 Biasy ^ 2 SEy^ 2
relation as 0.490. Consequently, the desired
Consequently, if we can estimate the bias as
95% bootstrap condence interval, recalling the
well as the standard error of an estimate, we
sample correlation coecient to be 0.655,
can determine an estimate of the root mean
is 2y^ yUpper ; 2y^ yLower 20:655 0:490;
square error. Fortunately, the bias can also be
20:655 0:776 0:820; 0:534.
estimated by a bootstrap procedure (before
continuing, do you see how?). In particular,
The above is but one (simple) method of using the
reasoning as we have before, we can use the
bootstrap to come up with interval estimates; see
approximation
Efron and Tibshirani (1993) for others. One other
particularly simple interval, however, deserves a ^ Ey
Biasy ^ y
mention (and appears in Tae and Garnham  Average of Bootstrap Estimates y^
(1996)). In some cases the bootstrap distribution is
symmetric about y.^ Then y^ yUpper y^ yLower , The average of the bootstrap estimates can be
and (4) simplies as follows: obtained by inserting the lines let k9 mean(c10),
print k9, just before the end statement in the
2y^ yUpper ; 2y^ yLower sedriver.txt macro. In the given illustrative ex-
y^ y^ yUpper ; y^ y^ yLower amples involving the sample mean, sample median
y^ y^ yLower ; y^ y^ yUpper and sample correlation as estimates of their
corresponding population parameters, little evi-
yLower ; yUpper
dence of bias was seen (indeed, we know the
The interval yLower ; yUpper is, unsurprisingly, called sample mean is unbiased for the population
a bootstrap percentile interval. To illustrate, con- mean).
sider two of our earlier examples. For the mean
interarrival time on the M1 we had 2x x 975 ; The bootstrap procedures discussed here, one for
2x x 25 5:28; 10:08 as opposed to the per- the standard error of an estimate y^ of y, and one
centile interval x 25 ; x 975 5:53; 10:33. The for producing condence intervals for y, are
closeness of these two intervals is due to the nonparametric bootstrap procedures. In each case
near symmetry in the bootstrap distribution of the bootstrap samples are obtained by repeated
X values. In the correlation example, however, samples with replacement from the data. Alter-
we had 2r r975 ; 2r r25 0:820; 0:534, natively, with parametric bootstrap procedures the
whereas r25 ; r975 0:776; 0:490. The rst original data can be used to t a probability
of these two intervals, since it does not assume model and our samples can be drawn from it. To
symmetry, should be favoured over the latter illustrate, the exponential density f x l elx
percentile interval. with l 1=7:80 ts the M1 motorway data well.
Consequently, bootstrap samples can be obtained
Given the correspondence between condence by taking random samples of size n from this
intervals and hypothesis tests, it should come as no tted density and then computing the relevant
surprise that there are bootstrap procedures for statistic (e.g. mean, median) as before. To
conducting hypothesis tests; see Efron and generate a particular random sample from an
Tibshirani (1993) for more details. For further exponential distribution the inverse cdf method
discussion on the use of computationally intensive may be used. Specically, generate a uniform
methods for hypothesis testing see Edgington random number U between 0 and 1. Then
(1995) and Good (2000). lnU=l 7:80 lnU will have the desired
exponential distribution.

^ FURTHER DETAILS ^
Acknowledgement
When trying to assess the performance of an Thanks are due to the referee for comments that
estimate y^ of y we will, in general, be concerned led to an improved presentation.
Teaching Statistics. Volume 23, Number 2, Summer 2001 . 53
References Handbook of Small Data Sets. London:
Edgington, E. (1995). Randomization Tests Chapman & Hall.
(3rd revised edn). New York: Marcel Raspe, R.E. (1785). The Adventures of Baron
Dekker. Munchausen.
Efron, B. and Tibshirani, R. (1986). Bootstrap Reeves, J. (1995). Resampling stats. Teaching
methods for standard errors, condence Statistics, 17(3), 101^3.
intervals, and other measures of statis- Rice, J. (1995). Mathematical Statistics and
tical accuracy. Statistical Science, 1(1), Data Analysis (2nd edn), pp. 271^2.
54^77. Ricketts, C. and Berry, J. (1994). Teaching
Efron, B. and Tibshirani, R. (1993). An Intro- statistics through resampling. Teaching Stat-
duction to the Bootstrap. London: Chapman istics, 16(2), 41^4.
& Hall. Stout, W., Travers, K. and Marden, J.
Good, P. (2000). Permutation Tests: A Prac- (1999). Statistics: Making Sense of Data
tical Guide to Resampling Methods for (2nd edn). Rantoul, Illinois: Mbius Com-
Testing Hypotheses (2nd edn). New York: munications.
Springer. Tae, J. and Garnham, N. (1996). Re-
Hand, D., Daly, F., Lunn A., McConway, sampling, the bootstrap and Minitab.
K. and Ostrowski, E. (eds) (1994). A Teaching Statistics, 18(1), 24^5.

54 . Teaching Statistics. Volume 23, Number 2, Summer 2001

Anda mungkin juga menyukai