June 26, 2017

# Re-sampling Pt.2: Jackknife and Bootstrap

Suppose we have a sample of data points and we want to estimate some parameter . We come up with – an estimator of . What do we know about ? How good an estimator of is it? Is it biased? How efficient is it?

We could answer these questions if we knew the distribution of the population from which came. More often than not however, we don’t know anything about the distribution of the underlying population, all we have is a sample and we want to figure out things about the population.

This is where re-sampling, such as

*jackknife*or

*bootstrapping*comes into play.

We generate multiple samples of the basis of our original data set and we use these multiple samples to compute multiple “versions” of . Having many versions of allows us to average and estimate the expected value of , as well as its bias and variance.

Let’s see how each of the two methods does this.

**The Jackknife**

__How it works:__

We take our original sample and generate sub-samples of size by leaving out one observation at a time:

For each such sub-sample we calculate its own estimator of , using the same method that we used to compute the original estimator from the entire sample .

We thus end up with separate estimators for .

The

*jackknife estimator*of a parameter is defined as:

and the

*jackknife estimator of variance*is defined as:Why it works:

OK, so far so good, we have come up with an alternative estimator of and an estimator of variance of . But why did we need to do that? We already had , why did we need – yet another estimator of and a rather exotic one? And, while we didn’t have any estimators of variance of , what makes us say that our is a decent estimator of variance of ?

The answer to the first question is to do with the fact that while was indeed an estimator of , we didn’t know whether it was biased or unbiased. However, now that in addition to we also have we can do some clever math and infer something about bias of . We can then, if necessary, correct the bias and derive an unbiased estimator of .

More concretely, if is an unbiased estimator of we have:

and therefore for each

which in turn implies that

i.e. the jackknife estimator is also unbiased.

However, if is biased so that

Then

NB: I have skipped a whole lot of math in this last part here and just jumped to the result, but those who are interested in the detailed proof can see it here:

Thus, we can estimate the bias of up to second order as:

Subsequently, the

*bias-corrected jackknife estimator*,is an

*unbiased*estimator of , again up to second order.Note that in the reasoning above we have assumed that the bias had a particular form:

This may seem like a strange assumption, but in fact it is usually justified. It’s a deep result in statistics that a lot of biased estimators do in fact have bias in this particular form. I won’t cover the detail here, but you can read up on it here. If, however, we were dealing with a rare case where the assumption wasn’t justified then we wouldn’t be able to use the jackknife bias correction meaningfully.

The answer to the second question is also quite mathematically involved (here are the details) but is essentially because , is a

*consistent estimator*of .

Note that this holds most of the times but not always, as witnessed by this Theorem by Efron: http://www.biostat.umn.edu/~johnh /pubh8422/notes/Jackknife_and_Bootstrap.pdf So again, in the rare cases where the assumption is not justified, we wouldn’t be able to use jackknifing properly.

Conclusion:

To recap, for a given sample and an estimator of , the jackknife method allows us to:

- test and, if necessary, correct for bias, rather than just blindly use the possibly biased
- obtain a consistent estimator of variance of , rather than just… well not have any variance estimator at all.

**Bootstrapping**

__How it works:__

Recall that with the jackknife method, we took sub-samples of by leaving out one element at a time and subsequently ended up with pre-determined sub-samples, each of size .

With bootstrapping, we take a different approach. We take samples of size from , but we sample

*with replacement*.

The exact algorithm is as follows:

- Observe a sample .
- Compute – a sample based estimator of some parameter of the model.
- For up to where is the number of bootstrap samples being generated:
- generate a bootstrap sample by sampling with replacement from the original observed data set
- compute in the same way that you calculated the original estimate .

Firstly, note that in each sub-sample we may have some members of missing and some occur multiple times. As it turns out, it can be shown that on average each such sample will contain 2/3 of members of and will be missing the other 1/3.

Secondly, note that, while with jackknifing we could only have the maximum of sub-samples of , with bootstrapping, thanks to sampling with replacement, we can go on forever and generate an arbitrarily large number of sub-samples.

Having a really large number of sub-samples in turn allows us to generate many estimates of – one for each . As we end up with many -s we are essentially approximating the distribution of these -s.

From here we can compute the sample mean and sample variance of -s:

So now things look better. We have started out with just one estimator of without knowing its bias or variance. We now have two estimators of – firstly the original , but also secondly the bootstrap estimator . We also have an estimator of variance of , given by .

Note that just like in the case of the jackknife, bootstrap allows us to test for bias. The math is detailed here: https://www.otexts.org/1470 and here http://www.ssc.wisc.edu/~xshi/econ715/Lecture_10_bootstrap.pdf

Also, bootstrap estimators of variance of have all sorts of good properties, as outlined here: http://www.ssc.wisc.edu/~xshi/econ715/Lecture_10_bootstrap.pdf

Thus, given a sample and an estimator of , just like in the case of jackknifing, bootstrapping allows us to:

- test and, if necessary, correct for bias, rather than just blindly use the possibly biased
- obtain a consistent estimator of variance of , rather than just… well not have any variance estimator at all.

however, unlike jackknife, bootstrap also allows us to:

- simulate the distribution of by generating an arbitrarily large number of -s, one for each of the arbitrary many bootstrap sub-samples.

__Why it works:__

When I first saw bootstrapping I was puzzled. How can one learn things about the distribution of a population simply by taking sub-samples of a sample again and again? I mean it literally does feel like lifting oneself by one’s boot straps – impossible.

It took me time to figure out that there is nothing magical about bootstrap and instead, it was my original “novice” interpretation of it that confused me. I also know that this is how pretty much everyone who sees bootstrap for the first time reacts, which is why I think it is important to address that source of confusion here.

First thing to note is that bootstrap works asymptotically. The larger the sample, the closer the empirical distribution is to the actual distribution. This is true because of the Dvoretzky Kiefer Wolfowitz inequality. Therefore, for a sufficiently large sample the difference between the empirical and the actual distributions is negligible and all conclusions we make for the empirical distribution are equally applicable to the actual distribution.

The second thing to note is that even if the sample size is small (which in reality happens often), if the sample was randomly chosen from the population then it will “look quite like the population” in the long run. By this I mean that any one particular small sample may be off due to skewness or imperfection of that particular sample, but

*on average, across many samplings*a random sample is a good representation of the population. Thus, the asymptotic property is not only from the “large sample perspective” as highlighted by the first point earlier, but also from a “long run perspective” as highlighted by the second point here.

Having made these two points, I will concede that they are a bit “theoretic”. In reality we don’t usually get large samples and don’t get to repeat many small samples again. Thus the two theoretical points are of limited use in a real life situation where we have just one not-so-large sample and need to infer population characteristics from it. In this case, we can still use bootstrap (especially if there is no other available alternatives), but bear in mind that our bootstrap estimates will likely inherit the imperfections that the sample had as a representative of the bigger population.