Bootstrapping is a procedure for estimating the distribution of an estimator by resampling (often with replacement) one's data or a model estimated from the data. Bootstrapping assigns measures of accuracy (bias, variance, confidence intervals, prediction error, etc.) to sample estimates.[1] [2] This technique allows estimation of the sampling distribution of almost any statistic using random sampling methods.[3]
Bootstrapping estimates the properties of an estimand (such as its variance) by measuring those properties when sampling from an approximating distribution. One standard choice for an approximating distribution is the empirical distribution function of the observed data. In the case where a set of observations can be assumed to be from an independent and identically distributed population, this can be implemented by constructing a number of resamples with replacement, of the observed data set (and of equal size to the observed data set). A key result in Efron's seminal paper that introduced the bootstrap is the favorable performance of bootstrap methods using sampling with replacement compared to prior methods like the jackknife that sample without replacement. However, since its introduction, numerous variants on the bootstrap have been proposed, including methods that sample without replacement or that create bootstrap samples larger or smaller than the original data.
The bootstrap may also be used for constructing hypothesis tests.[4] It is often used as an alternative to statistical inference based on the assumption of a parametric model when that assumption is in doubt, or where parametric inference is impossible or requires complicated formulas for the calculation of standard errors.
The bootstrap was first described by Bradley Efron in "Bootstrap methods: another look at the jackknife" (1979),[5] inspired by earlier work on the jackknife.[6] [7] [8] Improved estimates of the variance were developed later.[9] [10] A Bayesian extension was developed in 1981.[11] The bias-corrected and accelerated (
BCa
BCa
The basic idea of bootstrapping is that inference about a population from sample data (sample → population) can be modeled by resampling the sample data and performing inference about a sample from resampled data (resampled → sample). [13] As the population is unknown, the true error in a sample statistic against its population value is unknown. In bootstrap-resamples, the 'population' is in fact the sample, and this is known; hence the quality of inference of the 'true' sample from resampled data (resampled → sample) is measurable.
More formally, the bootstrap works by treating inference of the true probability distribution J, given the original data, as being analogous to an inference of the empirical distribution Ĵ, given the resampled data. The accuracy of inferences regarding Ĵ using the resampled data can be assessed because we know Ĵ. If Ĵ is a reasonable approximation to J, then the quality of inference on J can in turn be inferred.
As an example, assume we are interested in the average (or mean) height of people worldwide. We cannot measure all the people in the global population, so instead, we sample only a tiny part of it, and measure that. Assume the sample is of size N; that is, we measure the heights of N individuals. From that single sample, only one estimate of the mean can be obtained. In order to reason about the population, we need some sense of the variability of the mean that we have computed. The simplest bootstrap method involves taking the original data set of heights, and, using a computer, sampling from it to form a new sample (called a 'resample' or bootstrap sample) that is also of size N. The bootstrap sample is taken from the original by using sampling with replacement (e.g. we might 'resample' 5 times from [1,2,3,4,5] and get [2,5,4,4,1]), so, assuming N is sufficiently large, for all practical purposes there is virtually zero probability that it will be identical to the original "real" sample. This process is repeated a large number of times (typically 1,000 or 10,000 times), and for each of these bootstrap samples, we compute its mean (each of these is called a "bootstrap estimate"). We now can create a histogram of bootstrap means. This histogram provides an estimate of the shape of the distribution of the sample mean from which we can answer questions about how much the mean varies across samples. (The method here, described for the mean, can be applied to almost any other statistic or estimator.)
A great advantage of bootstrap is its simplicity. It is a straightforward way to derive estimates of standard errors and confidence intervals for complex estimators of the distribution, such as percentile points, proportions, Odds ratio, and correlation coefficients. However, despite its simplicity, bootstrapping can be applied to complex sampling designs (e.g. for population divided into s strata with ns observations per strata, bootstrapping can be applied for each stratum). Bootstrap is also an appropriate way to control and check the stability of the results. Although for most problems it is impossible to know the true confidence interval, bootstrap is asymptotically more accurate than the standard intervals obtained using sample variance and assumptions of normality.[14] Bootstrapping is also a convenient method that avoids the cost of repeating the experiment to get other groups of sample data.
Bootstrapping depends heavily on the estimator used and, though simple, naive use of bootstrapping will not always yield asymptotically valid results and can lead to inconsistency.[15] Although bootstrapping is (under some conditions) asymptotically consistent, it does not provide general finite-sample guarantees. The result may depend on the representative sample. The apparent simplicity may conceal the fact that important assumptions are being made when undertaking the bootstrap analysis (e.g. independence of samples or large enough of a sample size) where these would be more formally stated in other approaches. Also, bootstrapping can be time-consuming and there are not many available software for bootstrapping as it is difficult to automate using traditional statistical computer packages.
Scholars have recommended more bootstrap samples as available computing power has increased. If the results may have substantial real-world consequences, then one should use as many samples as is reasonable, given available computing power and time. Increasing the number of samples cannot increase the amount of information in the original data; it can only reduce the effects of random sampling errors which can arise from a bootstrap procedure itself. Moreover, there is evidence that numbers of samples greater than 100 lead to negligible improvements in the estimation of standard errors.[16] In fact, according to the original developer of the bootstrapping method, even setting the number of samples at 50 is likely to lead to fairly good standard error estimates.[17]
Adèr et al. recommend the bootstrap procedure for the following situations:
However, Athreya has shown[18] that if one performs a naive bootstrap on the sample mean when the underlying population lacks a finite variance (for example, a power law distribution), then the bootstrap distribution will not converge to the same limit as the sample mean. As a result, confidence intervals on the basis of a Monte Carlo simulation of the bootstrap could be misleading. Athreya states that "Unless one is reasonably sure that the underlying distribution is not heavy tailed, one should hesitate to use the naive bootstrap".
In univariate problems, it is usually acceptable to resample the individual observations with replacement ("case resampling" below) unlike subsampling, in which resampling is without replacement and is valid under much weaker conditions compared to the bootstrap. In small samples, a parametric bootstrap approach might be preferred. For other problems, a smooth bootstrap will likely be preferred.
For regression problems, various other alternatives are available.
The bootstrap is generally useful for estimating the distribution of a statistic (e.g. mean, variance) without using normality assumptions (as required, e.g., for a z-statistic or a t-statistic). In particular, the bootstrap is useful when there is no analytical form or an asymptotic theory (e.g., an applicable central limit theorem) to help estimate the distribution of the statistics of interest. This is because bootstrap methods can apply to most random quantities, e.g., the ratio of variance and mean. There are at least two ways of performing case resampling.
\binom{2n-1}n=
(2n-1)! | |
n!(n-1)! |
Consider a coin-flipping experiment. We flip the coin and record whether it lands heads or tails. Let be 10 observations from the experiment. if the i th flip lands heads, and 0 otherwise. By invoking the assumption that the average of the coin flips is normally distributed, we can use the t-statistic to estimate the distribution of the sample mean,
\bar{x}=
1 | |
10 |
(x1+x2+ … +x10).
Such a normality assumption can be justified either as an approximation of the distribution of each individual coin flip or as an approximation of the distribution of the average of a large number of coin flips. The former is a poor approximation because the true distribution of the coin flips is Bernoulli instead of normal. The latter is a valid approximation in infinitely large samples due to the central limit theorem.
However, if we are not ready to make such a justification, then we can use the bootstrap instead. Using case resampling, we can derive the distribution of
\bar{x}
In regression problems, case resampling refers to the simple scheme of resampling individual cases – often rows of a data set. For regression problems, as long as the data set is fairly large, this simple scheme is often acceptable. However, the method is open to criticism.[20]
In regression problems, the explanatory variables are often fixed, or at least observed with more control than the response variable. Also, the range of the explanatory variables defines the information available from them. Therefore, to resample cases means that each bootstrap sample will lose some information. As such, alternative bootstrap procedures should be considered.
Bootstrapping can be interpreted in a Bayesian framework using a scheme that creates new data sets through reweighting the initial data. Given a set of
N
i
l{D}J
J | |
w | |
i |
=
J | |
x | |
i |
-
J | |
x | |
i-1 |
xJ
N-1
[0,1]
l{D}J
Under this scheme, a small amount of (usually normally distributed) zero-centered random noise is added onto each resampled observation. This is equivalent to sampling from a kernel density estimate of the data. Assume K to be a symmetric kernel density function with unit variance. The standard kernel estimator
\hat{f}h(x)
f(x)
\hat{f}h(x)={1\over
nK\left({x-X | |
nh}\sum | |
i\over |
h}\right),
where
h
\hat{F}h(x)
\hat{F}h(x)=\int
x | |
-infty |
\hatfh(t)dt.
Based on the assumption that the original data set is a realization of a random sample from a distribution of a specific parametric type, in this case a parametric model is fitted by parameter θ, often by maximum likelihood, and samples of random numbers are drawn from this fitted model. Usually the sample drawn has the same sample size as the original data. Then the estimate of original function F can be written as
\hat{F}=F\hat{\theta
F\theta
F\hat{\theta
\bar{Xn
*-\mu | |
\bar{X} | |
n |
*
*=\mu | |
\mu | |
\hat{\theta |
F\hat{\theta
Another approach to bootstrapping in regression problems is to resample residuals. The method proceeds as follows.
\widehat{y}i
\widehat{\varepsilon}i=yi-\widehat{y}i,(i=1,...,n)
\widehat{\varepsilon}j
\widehat{y}i
* | |
y | |
i |
=\widehat{y}i+\widehat{\varepsilon}j
* | |
y | |
i |
* | |
\widehat\mu | |
i |
* | |
y | |
i |
This scheme has the advantage that it retains the information in the explanatory variables. However, a question arises as to which residuals to resample. Raw residuals are one option; another is studentized residuals (in linear regression). Although there are arguments in favor of using studentized residuals; in practice, it often makes little difference, and it is easy to compare the results of both schemes.
When data are temporally correlated, straightforward bootstrapping destroys the inherent correlations. This method uses Gaussian process regression (GPR) to fit a probabilistic model from which replicates may then be drawn. GPR is a Bayesian non-linear regression method. A Gaussian process (GP) is a collection of random variables, any finite number of which have a joint Gaussian (normal) distribution. A GP is defined by a mean function and a covariance function, which specify the mean vectors and covariance matrices for each finite collection of the random variables.[24]
Regression model:
y(x)=f(x)+\varepsilon, \varepsilon\siml{N}(0,\sigma2),
\varepsilon
Gaussian process prior:
For any finite collection of variables, x1, ..., xn, the function outputs
f(x1),\ldots,f(xn)
m=[m(x1),\ldots,m(x
\intercal | |
n)] |
(K)ij=k(xi,xj).
Assume
f(x)\siml{GP}(m,k).
y(x)\siml{GP}(m,l)
where
l(xi,xj)=k(xi,x
2\delta(x | |
i,x |
j)
\delta(xi,xj)
Gaussian process posterior:
According to GP prior, we can get
[y(x1),\ldots,y(xr)]\siml{N}(m0,K0)
where
m0=[m(x1),\ldots,m(x
\intercal | |
r)] |
(K0)ij=k(xi,x
2\delta(x | |
i,x |
j).
Let x1*,...,xs* be another finite collection of variables, it's obvious that
[y(x1),\ldots,y(xr),f(x
*)] | |
s |
\intercal\siml{N}(\binom{m0}{m*}\begin{pmatrix}K0&K*
\intercal | |
\ K | |
* |
&K**\end{pmatrix})
where
m*=[m(x
*)] | |
s |
\intercal
(K**)ij
*) | |
=k(x | |
j |
(K*)ij=k(xi,x
*). | |
j |
According to the equations above, the outputs y are also jointly distributed according to a multivariate Gaussian. Thus,
*)] | |
[f(x | |
s |
\intercal\mid([y(x)]\intercal=y)\siml{N}(mpost,Kpost),
where
y=[y1,...,y
\intercal | |
r] |
mpost=m*+K
-1 | |
r) |
(y-m0)
Kpost=K**
-1 | |
-K | |
r) |
K*
Ir
r x r
The wild bootstrap, proposed originally by Wu (1986),[25] is suited when the model exhibits heteroskedasticity. The idea is, as the residual bootstrap, to leave the regressors at their sample value, but to resample the response variable based on the residuals values. That is, for each replicate, one computes a new
y
* | |
y | |
i |
=\widehat{y}i+\widehat{\varepsilon}ivi
so the residuals are randomly multiplied by a random variable
vi
vi
vi
vi=\begin{cases} -(\sqrt{5}-1)/2&withprobability(\sqrt{5}+1)/(2\sqrt{5}),\\ (\sqrt{5}+1)/2&withprobability(\sqrt{5}-1)/(2\sqrt{5}) \end{cases}
Approximately, Mammen's distribution is:
vi=\begin{cases} -0.6180 (witha0intheunits'place)&withprobability0.7236,\\ +1.6180 (witha1intheunits'place)&withprobability0.2764. \end{cases}
vi=\begin{cases} -1&withprobability1/2,\\ +1&withprobability1/2. \end{cases}
The block bootstrap is used when the data, or the errors in a model, are correlated. In this case, a simple case or residual resampling will fail, as it is not able to replicate the correlation in the data. The block bootstrap tries to replicate the correlation by resampling inside blocks of data (see Blocking (statistics)). The block bootstrap has been used mainly with data correlated in time (i.e. time series) but can also be used with data correlated in space, or among groups (so-called cluster data).
In the (simple) block bootstrap, the variable of interest is split into non-overlapping blocks.
In the moving block bootstrap, introduced by Künsch (1989),[27] data is split into n − b + 1 overlapping blocks of length b: Observation 1 to b will be block 1, observation 2 to b + 1 will be block 2, etc. Then from these n − b + 1 blocks, n/b blocks will be drawn at random with replacement. Then aligning these n/b blocks in the order they were picked, will give the bootstrap observations.
This bootstrap works with dependent data, however, the bootstrapped observations will not be stationary anymore by construction. But, it was shown that varying randomly the block length can avoid this problem.[28] This method is known as the stationary bootstrap. Other related modifications of the moving block bootstrap are the Markovian bootstrap and a stationary bootstrap method that matches subsequent blocks based on standard deviation matching.
Vinod (2006),[29] presents a method that bootstraps time series data using maximum entropy principles satisfying the Ergodic theorem with mean-preserving and mass-preserving constraints. There is an R package, meboot,[30] that utilizes the method, which has applications in econometrics and computer science.
Cluster data describes data where many observations per unit are observed. This could be observing many firms in many states or observing students in many classes. In such cases, the correlation structure is simplified, and one does usually make the assumption that data is correlated within a group/cluster, but independent between groups/clusters. The structure of the block bootstrap is easily obtained (where the block just corresponds to the group), and usually only the groups are resampled, while the observations within the groups are left unchanged. Cameron et al. (2008) discusses this for clustered errors in linear regression.[31]
The bootstrap is a powerful technique although may require substantial computing resources in both time and memory. Some techniques have been developed to reduce this burden. They can generally be combined with many of the different types of Bootstrap schemes and various choices of statistics.
Most bootstrap methods are embarrassingly parallel algorithms. That is, the statistic of interest for each bootstrap sample does not depend on other bootstrap samples. Such computations can therefore be performed on separate CPUs or compute nodes with the results from the separate nodes eventually aggregated for final analysis.
The nonparametric bootstrap samples items from a list of size n with counts drawn from a multinomial distribution. If
Wi
Wi
Wi
Wj
i ≠ j
The Poisson bootstrap instead draws samples assuming all
Wi
\limn\to\operatorname{Binomial}(n,1/n)=\operatorname{Poisson}(1)
The Poisson bootstrap had been proposed by Hanley and MacGibbon as potentially useful for non-statisticians using software like SAS and SPSS, which lacked the bootstrap packages of R and S-Plus programming languages.[32] The same authors report that for large enough n, the results are relatively similar to the nonparametric bootstrap estimates but go on to note the Poisson bootstrap has seen minimal use in applications.
Another proposed advantage of the Poisson bootstrap is the independence of the
Wi
A way to improve on the Poisson bootstrap, termed "sequential bootstrap", is by taking the first samples so that the proportion of unique values is ≈0.632 of the original sample size n. This provides a distribution with main empirical characteristics being within a distance of
O(n3/4)
For massive data sets, it is often computationally prohibitive to hold all the sample data in memory and resample from the sample data. The Bag of Little Bootstraps (BLB)[37] provides a method of pre-aggregating data before bootstrapping to reduce computational constraints. This works by partitioning the data set into
b
b=n\gamma
\gamma\in[0.5,1]
b=n0.7
The bootstrap distribution of a point estimator of a population parameter has been used to produce a bootstrapped confidence interval for the parameter's true value if the parameter can be written as a function of the population's distribution.
Population parameters are estimated with many point estimators. Popular families of point-estimators include mean-unbiased minimum-variance estimators, median-unbiased estimators, Bayesian estimators (for example, the posterior distribution's mode, median, mean), and maximum-likelihood estimators.
A Bayesian point estimator and a maximum-likelihood estimator have good performance when the sample size is infinite, according to asymptotic theory. For practical problems with finite samples, other estimators may be preferable. Asymptotic theory suggests techniques that often improve the performance of bootstrapped estimators; the bootstrapping of a maximum-likelihood estimator may often be improved using transformations related to pivotal quantities.[38]
The bootstrap distribution of a parameter-estimator has been used to calculate confidence intervals for its population-parameter.
If the bootstrap distribution of an estimator is symmetric, then percentile confidence-interval are often used; such intervals are appropriate especially for median-unbiased estimators of minimum risk (with respect to an absolute loss function). Bias in the bootstrap distribution will lead to bias in the confidence interval.
Otherwise, if the bootstrap distribution is non-symmetric, then percentile confidence intervals are often inappropriate.
There are several methods for constructing confidence intervals from the bootstrap distribution of a real parameter:
(2\widehat{\theta}
* | |
-\theta | |
(1-\alpha/2) |
,2\widehat{\theta}
* | |
-\theta | |
(\alpha/2) |
)
* | |
\theta | |
(1-\alpha/2) |
1-\alpha/2
\theta*
* | |
(\theta | |
(\alpha/2) |
* | |
,\theta | |
(1-\alpha/2) |
)
* | |
\theta | |
(1-\alpha/2) |
1-\alpha/2
\theta*
See Davison and Hinkley (1997, equ. 5.18 p. 203) and Efron and Tibshirani (1993, equ 13.5 p. 171).
This method can be applied to any statistic. It will work well in cases where the bootstrap distribution is symmetrical and centered on the observed statistic[40] and where the sample statistic is median-unbiased and has maximum concentration (or minimum risk with respect to an absolute value loss function). When working with small sample sizes (i.e., less than 50), the basic / reversed percentile and percentile confidence intervals for (for example) the variance statistic will be too narrow. So that with a sample of 20 points, 90% confidence interval will include the true variance only 78% of the time.[41] The basic / reverse percentile confidence intervals are easier to justify mathematically[42] but they are less accurate in general than percentile confidence intervals, and some authors discourage their use.
(\widehat{\theta}-
* | |
t | |
(1-\alpha/2) |
⋅ \widehat{se
* | |
t | |
(1-\alpha/2) |
1-\alpha/2
t*=(\widehat{\theta}*-\widehat{\theta})/\widehat{se
\widehat{se
The studentized test enjoys optimal properties as the statistic that is bootstrapped is pivotal (i.e. it does not depend on nuisance parameters as the t-test follows asymptotically a N(0,1) distribution), unlike the percentile bootstrap.
Efron and Tibshirani suggest the following algorithm for comparing the means of two independent samples:Let
x1,\ldots,xn
\bar{x}
2 | |
\sigma | |
x |
y1,\ldots,ym
\bar{y}
2 | |
\sigma | |
y |
t=
\bar{x | |
-\bar{y}}{\sqrt{\sigma |
2/n | |
x |
+
2/m}} | |
\sigma | |
y |
xi'=xi-\bar{x}+\bar{z}
yi'=yi-\bar{y}+\bar{z},
\bar{z}
* | |
x | |
i |
n
xi'
* | |
y | |
i |
m
yi'
t*=
\bar{x* | |
-\bar{y |
*2 | |
x |
/n+
*2 | |
\sigma | |
y |
/m}}
B
B=1000
B
p=
| ||||||||||||||||
I\{condition\}=1
In 1878, Simon Newcomb took observations on the speed of light.[44] The data set contains two outliers, which greatly influence the sample mean. (The sample mean need not be a consistent estimator for any population mean, because no mean needs to exist for a heavy-tailed distribution.) A well-defined and robust statistic for the central tendency is the sample median, which is consistent and median-unbiased for the population median.
The bootstrap distribution for Newcomb's data appears below. We can reduce the discreteness of the bootstrap distribution by adding a small amount of random noise to each bootstrap sample. A conventional choice is to add noise with a standard deviation of
\sigma/\sqrtn
Histograms of the bootstrap distribution and the smooth bootstrap distribution appear below. The bootstrap distribution of the sample-median has only a small number of values. The smoothed bootstrap distribution has a richer support. However, note that whether the smoothed or standard bootstrap procedure is favorable is case-by-case and is shown to depend on both the underlying distribution function and on the quantity being estimated.[47]
In this example, the bootstrapped 95% (percentile) confidence-interval for the population median is (26, 28.5), which is close to the interval for (25.98, 28.46) for the smoothed bootstrap.
The bootstrap is distinguished from:
For more details see resampling.
Bootstrap aggregating (bagging) is a meta-algorithm based on averaging model predictions obtained from models trained on multiple bootstrap samples.
See main article: U-statistic. In situations where an obvious statistic can be devised to measure a required characteristic using only a small number, r, of data items, a corresponding statistic based on the entire sample can be formulated. Given an r-sample statistic, one can create an n-sample statistic by something similar to bootstrapping (taking the average of the statistic over all subsamples of size r). This procedure is known to have certain good properties and the result is a U-statistic. The sample mean and sample variance are of this form, for r = 1 and r = 2.
The bootstrap has under certain conditions desirable asymptotic properties. The asymptotic properties most often described are weak convergence / consistency of the sample paths of the bootstrap empirical process and the validity of confidence intervals derived from the bootstrap. This section describes the convergence of the empirical bootstrap.
This paragraph summarizes more complete descriptions of stochastic convergence in van der Vaart and Wellner[48] and Kosorok.[49] The bootstrap defines a stochastic process, a collection of random variables indexed by some set
T
T
R
\ellinfty(T)
T
R
\ellinfty(T)
T=R
\ellinfty(T)
C[0,1]
T
D[0,1]
T
C[0,1]
D[0,1]
\ellinfty(T)
C[0,1]
D[0,1]
Horowitz in a recent review[3] defines consistency as: the bootstrap estimator
Gn( ⋅ ,Fn)
F0
\sup\tau|Gn(\tau,Fn)-Ginfty(\tau,F0)|
n\toinfty
Fn
F0
Ginfty(\tau,F0)
Tn
\tau
P(Tn\leq\tau)=Gn(\tau,F0)
Horowitz goes on to recommend using a theorem from Mammen[51] that provides easier to check necessary and sufficient conditions for consistency for statistics of a certain common form. In particular, let
\{Xi:i=1,\ldots,n\}
Tn=
| ||||||||||
\sigman |
tn
\sigman
Tn
Convergence in (outer) probability as described above is also called weak consistency. It can also be shown with slightly stronger assumptions, that the bootstrap is strongly consistent, where convergence in (outer) probability is replaced by convergence (outer) almost surely. When only one type of consistency is described, it is typically weak consistency. This is adequate for most statistical applications since it implies confidence bands derived from the bootstrap are asymptotically valid.[49]
In simpler cases, it is possible to use the central limit theorem directly to show the consistency of the bootstrap procedure for estimating the distribution of the sample mean.
Specifically, let us consider
Xn1,\ldots,Xnn
E[Xn1]=\mu
Var[Xn1]=\sigma2<infty
n\ge1
\bar{X}n=n-1(Xn1+ … +Xnn)
n\ge1
Xn1,\ldots,Xnn
* | |
X | |
n1 |
,\ldots,
* | |
X | |
nn |
Xn1,\ldots,Xnn
Then it can be shown thatwhere
P*
Xn1,\ldots,Xnn
n\ge1
* | |
\bar{X} | |
n |
=n-1
* | |
(X | |
n1 |
+ … +
* | |
X | |
nn |
)
2 | |
\hat{\sigma} | |
n |
=n-1
n | |
\sum | |
i=1 |
(Xni-
2 | |
\bar{X} | |
n) |
To see this, note that
* | |
(X | |
ni |
-\barXn)/\sqrtn\hat{\sigma}n
The Glivenko–Cantelli theorem provides theoretical background for the bootstrap method.
Comment
. Statistical Science. 9. 3. 400-403. 10.1214/ss/1177010387. 0883-4237. free.