Post · 6 min read· pp. 175–178

Bootstrapping and Subsampling: Part I

BOOTSTRAPPING AND SUBSAMPLING: PART I

Bootstrapping and subsampling are in the “amazing” category in statistics. They seem much more popular in statistics than machine learning for some reason.

1. The Bootstrap

The bootstrap (a.k.a. the shotgun) was invented by Brad Efron. Here is how it works. We have data X1,…,Xn∼P{X_1,\ldots, X_n \sim P} and we want a confidence interval for θ=T(P){\theta = T(P)}. For example, θ{\theta} could be the median of P{P} or the mean of P{P} or something more complicated like, the largest eigenvalue of the covariance matrix of P{P}.

The 1−α{1-\alpha} bootstrap confidence interval is

Cn=[θ^−t^1−α/2n, θ^−t^α/2n]\displaystyle C_n = \left[ \hat\theta - \frac{\hat t_{1-\alpha/2}}{\sqrt{n}},\ \hat\theta - \frac{\hat t_{\alpha/2}}{\sqrt{n}}\right]

where θ^{\hat\theta} is an estimator of θ{\theta} and t^α/2{\hat t_{\alpha/2}} and t^1−α/2{\hat t_{1-\alpha/2}} are sample bootstrap quantiles that I will describe below. Before I explain this in more detail, notice two things. First, there is a minus sign in both the lower and upper endpoint. Second, the α/2{\alpha/2} and 1−α/2{1-\alpha/2} quantiles are in the upper and lower endpoints, the reverse of what you might expect. The reason for the strange looking interval will be clear when we derive the interval.

Now for some details. Think of the parameter of interest θ{\theta} as a function of the unknown distribution, which is why we write it as θ=T(P){\theta = T(P)}. Let Pn{P_n} denote the empirical distribution:

Pn(A)=1n∑i=1nIA(Xi).\displaystyle P_n(A) = \frac{1}{n}\sum_{i=1}^n I_A(X_i).

In other words, Pn{P_n} is the distribution that puts mass 1/n{1/n} at each Xi{X_i}.

The estimator is just the function T{T} applied to Pn{P_n}, that is, θ^=T(Pn){\hat\theta = T(P_n)}. For example, if θ{\theta} is the median of P{P} then θ^{\hat\theta} is the median of Pn{P_n} which is just the sample median.

Now let

Rn=n(θ^−θ).\displaystyle R_n = \sqrt{n}(\hat\theta - \theta).

We use Rn{R_n} because typically it converges in distribution to some well-defined distribution (such as a Normal). Now let Hn{H_n} denote the (unknown) distribution of Rn{R_n}:

Hn(t)=P(Rn≤t).\displaystyle H_n(t) = \mathbb{P}(R_n \leq t).

Suppose, for a moment, that we did know Hn{H_n}. We could then find the α/2{\alpha/2} quantile tα/2{t_{\alpha/2}} and the 1−α/2{1-\alpha/2} quantile t1−α/2{t_{1-\alpha/2}}, namely,

tα/2=Hn−1(α/2)   \mboxand   t1−α/2=Hn−1(1−α/2).\displaystyle t_{\alpha/2} = H_n^{-1}(\alpha/2)\ \ \ \mbox{and}\ \ \ t_{1-\alpha/2} = H_n^{-1}(1-\alpha/2).

It follows that

P(tα/2≤Rn≤t1−α/2)=1−α.\displaystyle \mathbb{P}( t_{\alpha/2} \leq R_n \leq t_{1-\alpha/2}) = 1- \alpha.

Continuing with the fantasy that we know Hn{H_n}, define

Ωn=[θ^−t1−α/2n, θ^−tα/2n].\displaystyle \Omega_n = \left[ \hat\theta - \frac{t_{1-\alpha/2}}{\sqrt{n}},\ \hat\theta - \frac{t_{\alpha/2}}{\sqrt{n}}\right].

Now I will show you that Ωn{\Omega_n} is an exact 1−α{1-\alpha} confidence interval. This follows since

P(θ∈Ωn)=P(θ^−t1−α/2n≤θ≤θ^−tα/2n)=P(tα/2≤Rn≤t1−α/2)=Hn(t1−α/2)−Hn(tα/2)=(1−α/2)−α/2=1−α.\displaystyle \mathbb{P}(\theta \in \Omega_n) = \mathbb{P}\left(\hat\theta - \frac{t_{1-\alpha/2}}{\sqrt{n}} \leq \theta \leq \hat\theta - \frac{t_{\alpha/2}}{\sqrt{n}}\right)= \mathbb{P}(t_{\alpha/2} \leq R_n \leq t_{1-\alpha/2}) = H_n(t_{1-\alpha/2}) - H_n(t_{\alpha/2})= (1-\alpha/2) - \alpha/2 = 1-\alpha.

We engineered Ωn{\Omega_n} so that the last line would be exactly 1−α{1-\alpha}. The strange form of Ωn{\Omega_n} is explained by the fact that we really have a probability statement for Rn{R_n} which we then manipulate into the form of an interval for θ{\theta}. (You can check that if Hn{H_n} were standard Gaussian, then using the symmetry of the Gaussian, the interval could be re-written in the more familiar looking form θ^±zα/2/n{\hat\theta\pm z_{\alpha/2}/\sqrt{n}} where zα/2{z_{\alpha/2}} is the upper-tail quantile of a Normal.)

The problem is that we don’t know Hn{H_n} and hence we don’t know tα/2{t_{\alpha/2}} or t1−α/2{t_{1-\alpha/2}}. The bootstrap is a method for approximating Hn{H_n}. Let B{B} be a large number (for example, B=100,000{B=100,000}.) Now do this:

  1. Draw n{n} observations X1∗,…,Xn∗{X_1^*,\ldots, X_n^*} from Pn{P_n} and compute θ^∗{\hat\theta^*} from these new data.

  2. Repeat step 1 B{B} times yielding values θ^1∗,…,θ^B∗{\hat\theta_1^*,\ldots, \hat\theta_B^*}.

  3. Approximate Hn{H_n} with

    H^n(t)=1B∑j=1BI(n(θ^j∗−θ^)≤t)\displaystyle \hat H_n(t) = \frac{1}{B}\sum_{j=1}^B I\Bigl( \sqrt{n}(\hat\theta_j^* - \hat\theta)\leq t\Bigr)

    where I{I} denotes the indicator function.

  4. Find the quantiles t^α/2{\hat t_{\alpha/2}} and t^1−α/2{\hat t_{1-\alpha/2}} of H^n{\hat H_n} and construct Cn{C_n} as defined earlier.

The interval Cn{C_n} is the same as Ωn{\Omega_n} except we use the estimated quantiles for Cn{C_n}. What we are doing here is estimating Hn{H_n} by using Pn{P_n} as an estimate of P{P}. (That’s why we draw X1∗,…,Xn∗{X_1^*,\ldots, X_n^*} from Pn{P_n}.) If H^n{\hat H_n} is close to Hn{H_n} then t^α/2≈tα/2{\hat t_{\alpha/2} \approx t_{\alpha/2}} and t^1−α/2≈t1−α/2{\hat t_{1-\alpha/2} \approx t_{1-\alpha/2}} and then Cn≈Ωn{C_n \approx \Omega_n}.

There are two sources of error. First we approximate

Hn(t)=P(n(θ^−θ))\displaystyle H_n(t)=\mathbb{P}(\sqrt{n} (\hat\theta - \theta))

with

Hn∗(t)=Pn(n(θ^∗−θ^)).\displaystyle H_n^*(t)=\mathbb{P}_n(\sqrt{n} (\hat\theta^* - \hat\theta)).

Essentially, we are replacing P{P} with Pn{P_n}. Second, we are approximating Hn∗(t){H_n^*(t)} with

H^n(t)=1B∑j=1BI(n(θ^j∗−θ^)≤t).\displaystyle \hat H_n(t) = \frac{1}{B}\sum_{j=1}^B I\Bigl( \sqrt{n}(\hat\theta_j^* - \hat\theta)\leq t\Bigr).

This second source of error is negligible because we can make B{B} as large as we want.

Remark: A moment’s reflection should convince you that drawing a sample of size n{n} from Pn{P_n} is the same as drawing n{n} points with replacement from the original data. This is how the bootstrap is often described but I think it is clearer to describe it as drawing n{n} observations from Pn{P_n}.

2. Why Does It Work?

If H^n{\hat H_n} is close to Hn{H_n} then the bootstrap confidence interval will have coverage close to 1−α{1-\alpha}. Formally, one has to show that

sup⁡t∣H^n(t)−Hn(t)∣→P0\displaystyle \sup_t |\hat H_n(t) - H_n(t)| \stackrel{P}{\rightarrow} 0

in which case

P(θ∈Cn)→1−α\displaystyle \mathbb{P}(\theta\in C_n) \rightarrow 1-\alpha

as n→∞{n\rightarrow\infty}.

It is non-trivial to show that sup⁡t∣H^n(t)−Hn(t)∣→P0{\sup_t |\hat H_n(t) - H_n(t)| \stackrel{P}{\rightarrow} 0} but it has been shown in some generality. See Chapter 23 of van der Vaart (1998) for example.

3. Why Does It Fail?

The bootstrap does not always work. It can fail for a variety of reasons such as when the dimension is high or when T{T} is poorly behaved.

An example of a bootstrap failure is in the problem of estimating phylogenetic trees. The problem here is that T(P){T(P)} is an extremely complex object and the regularity conditions needed to make the bootstrap work are unlikely to hold.

In fact, this is a general problem with the bootstrap: it is most useful in complex situations, but these are often the situations where the theory breaks down.

4. What Do We Do?

So what do we do when the bootstrap fails? One answer is: subsampling. This is a variant of the bootstrap that works under much weaker conditions than the bootstrap. Interestingly, the theory behind subsampling is much simpler than the theory behind the bootstrap. The former involves little more than a simple concentration inequality while the latter uses high-powered techniques from empirical process theory.

So what is subsampling?

Stay tuned. I will describe it in my next post. In the meantime, I’d be interested to hear about your experiences with the bootstrap. Also, why do you think the bootstrap is not more popular in machine learning?

References

Efron, Bradley. (1979). Bootstrap methods: Another look at the jackknife. The Annals of Statistics, 1-26.

Efron, Bradley, and Tibshirani, R. (1994). An Introduction to the Bootstrap. Chapman and Hall.

Holmes, Susan. (2003). Bootstrapping phylogenetic trees: Theory and methods. Statistical Science, 241-255.

van der Vaart, A. (1996). Asymptotic Statistics. Cambridge.

P.S. See also Cosma’s post: here