Nonparametric bootstrap
Julia Fukuyama
Simulation-Based Inference · Lecture 21
Recall: the parametric bootstrap
We have used the parametric bootstrap to estimate sampling
distributions and construct confidence intervals.
The procedure is:
- Fit a probability model to the observed data.
- Simulate new datasets from the fitted model.
- Recompute the estimate on each simulated dataset.
The resulting estimates describe the sampling distribution of the
estimator under the fitted model.
To construct confidence intervals, we used this strategy to get the
distribution of a pivot/approximate pivot.
This lecture will describe sampling distributions of estimators.
Confidence intervals can be constructed using the same ideas, modulo
some wrinkles about the target when you’re using a nonparametric
model.
What if we fit the wrong model?
We have seen examples where the fitted model isn’t a good match to
the true data-generating process.
This makes the bootstrap sampling distribution potentially
misleading.
One fix: use a much more flexible model class.
The nonparametric bootstrap: algorithm
Suppose our observed data are \(x_1,\ldots,x_n\), and our estimate is
\[
\hat\theta = T(x_1,\ldots,x_n).
\]
For each bootstrap replicate \(b=1,\ldots,B\):
- Sample \(n\) observations
with replacement from \(x_1,\ldots,x_n\).
- Compute \(\hat\theta^{*(b)}=T(X_1^{*(b)},\ldots,X_n^{*(b)})\).
The collection \(\hat
\theta^{*(b)}\) is an approximation of the sampling distribution
of \(\hat \theta\).
Why might this make sense/another interpretation
We can write this as estimating a data model and then bootstrapping
from that estimate.
Suppose we think that \[
X_1,\ldots, X_n \overset{iid}{\sim} P
\]
We need an estimate of \(\hat P\) of
\(P\).
The procedure on the previous slide takes \(\hat P\) to be the “empirical
distribution”.
The empirical distribution is a categorical distribution with
\[
\hat p(x)
=
\frac{\text{number of times }x\text{ appears in the observed data}}{n}.
\]
This assigns probability zero to values we did not observe and
positive probability to values we did observe in proportion to how many
times we saw tham.
For example, if our data are \((2,3,3,7,10)\), then
\[
\hat p(x)=
\begin{cases}
1/5 & x=2,7,10,\\
2/5 & x=3,\\
0 & \text{otherwise}.
\end{cases}
\]
Sampling from this estimated distribution is exactly the same as
choosing an observed data point uniformly at random.
Is this a good idea?
Informally: what distribution will make observed and simulated data
most similar?
- Suppose we can choose any distribution \(P\), without restricting it to a particular
parametric family.
- As at the beginning of the course, we need to define “similar.”
- Recall MMD, which compares datasets using a kernel (similarity)
function \(k\). We will use a slightly
modified version:
\[
\widehat{\operatorname{MMD}}_u^2(\mathbf x,\mathbf y)
=
\underbrace{\frac{1}{n^2}\sum_{i,i'}k(x_i,x_{i'})}_{\text{within
observed}}
+
\underbrace{\frac{1}{m(m-1)}\sum_{j\ne
j'}k(y_j,y_{j'})}_{\text{within simulated}}
-
\underbrace{\frac{2}{nm}\sum_{i,j}k(x_i,y_j)}_{\text{between observed
and simulated}}.
\]
Compared with our earlier formula, we exclude simulated self-pairs
and adjust the denominator. This removes a finite-simulation bias.
Hold the observed data \(x_1,\ldots,x_n\) fixed and let
\[
Y_1,\ldots,Y_m \overset{\mathrm{iid}}{\sim} \hat P,
\qquad m\ge2.
\]
Suppose we choose \(\hat P\) so that
it minimizes expected squared MMD
\[
E_{\hat P}\!\left[\widehat{\operatorname{MMD}}_u^2(\mathbf x,\mathbf
Y)\right]
=
E_{\hat P} \left[\frac{1}{n^2}\sum_{i,i'}k(x_i,x_{i'})
+
\frac{1}{m(m-1)}\sum_{j\ne j'}k(Y_j,Y_{j'})
-
\frac{2}{nm}\sum_{i,j}k(x_i,Y_j) \right].
\]
Then for any “characteristic kernel” (basically anything reasonable,
doesn’t depend much on the form) the unique minimizing distribution is
the empirical distribution described above.
Is this a good idea? Take two.
- Maximum likelihood interpretations of \(\hat P\) exist.
- Technical difficulties comparing continuous and discrete probability
distributions.
Is this a free lunch?
Why would we ever use a parametric bootstrap?
The basic tradeoff is:
- We are trying to estimate the true distribution.
- If we build assumptions about what form the distribution can take
into our model, we have fewer things to estimate (and therefore will can
less variable estimates).
- If those assumptions are incorrect, they can make it so that the
estimated model systematically differs from the truth (our estimate is
biased).
Bias-variance tradeoff
There is a general sort of class of results in statistics that take
the form of a “bias-variance tradeoff”. For a numerical quantity we want
to estimate,
\[
\text{expected squared error}
=
\text{squared bias}+\text{variance}.
\]
- Bias: how far the average estimate across repeated
datasets is from the truth.
- Variance: how much the estimate changes across
repeated datasets.
Stronger assumptions can reduce variance at the cost of introducing
bias. More flexibility can reduce bias at the cost of increasing
variance.
Which aspects of \(P\) do we need
to estimate well?
Different estimators depend on different aspects of \(P\) being estimated correctly. For
example:
- For an upper quantile, it is especially important to match the upper
part of the distribution: both how much probability is there and how the
values are spread out.
- For a lower quantile, the lower part matters most.
- For the median, the concentration of probability around the
population median matters.
- For the mean, matching the population variance gives us the correct
variance of the sampling distribution. Its shape can depend on other
features, including the tails.
For more complicated estimators, the important features may be harder
to identify.
A better overall estimate of \(P\)
does not necessarily give a better estimate of the sampling distribution
of a particular estimator.
Examples
To give you some intuition about how well this works, we’ll look at
some examples in the notebook 21-bootstrap-examples.ipynb.
For a true distribution, a sample size, a parametric family, and an
estimator of your choice, it shows:
- the true distribution, datasets simulated from it, and the true
sampling distribution of the estimate
- the same three things for the nonparametric bootstrap (the empirical
distribution)
- the same three things for the parametric bootstrap (the fitted
model)
Cases to try:
- True model is normal, small sample (\(n =
10\))
- True model is normal, large sample (\(n =
200\))
- True model has some funny distribution (smoothed gfr data from
CASI), \(n = 20\) and \(n = 200\), log-polynomial fits of degree 2,
4, 8
- In each case: the sample mean, and an upper quantile or the
maximum
Main points
- The nonparametric bootstrap simulates from the empirical
distribution.
- It avoids choosing a parametric family for the distribution of each
iid unit.
- As with the parametric bootstrap, the fitted model must reproduce
the features that matter for sampling variability.
- How much the choice of fitted model matters depends on the
estimator: very little for a mean, a lot for a maximum or a
density.
The confidence-interval questions we discussed earlier still
apply.
We’ll talk about dependence next time.