One of the biggest embarrassments in statistics is that we don’t really have confidence bands for nonparametric functions estimation. This is a fact that we tend to sweep under the rug.

Consider, for example, estimating a density from a sample . The kernel estimator with kernel and bandwidth is

Let’s start with getting a confidence interval at a single point .

Let be the mean of the estimator and let be the standard deviation. (A consistent estimator of is where is the sample standard deviation of where .)

Now,

where is the bias. By the central limit theorem, the first term is approximately standard Normal,

This suggests the confidence interval, .

The problem is the second term . Recall that the optimal bandwidth balances the bias and the variance. This means that if we use the best bandwidth, then behaves like a constant, that is, for some (unknown) constant . The result is that, even as , the confidence interval is centered at instead of . As a result, the coverage will be less than the intended coverage .

We could in principle solve this problem by undersmoothing. If we choose a bandwidth smaller than the optimal bandwidth, then and the problem disappears. But this creates two new problems. First, the confidence interval is now centered around a non-optimal estimator. Second, and more importantly, we don’t have any practical, data-driven methods for choosing an undersmoothed bandwidth. There are some proposals in the theoretical literature but they are, frankly, not very practical

Of course, all of these problems are only worse when we consider simultaneous confidence band for the whole function.

The same problem arises if we use Bayesian inference. In short, the 95 percent Bayesian interval will not have 95 percent frequentist coverage. The reasons are the same as for the frequentist interval. (One can of course “declare” that coverage is not important and then there is no problem. But I am assuming that we do want correct frequentist coverage.)

The only good solution I know is to simply admit that we can’t create a confidence interval for . Instead, we simply interpret as a confidence interval for , which is a smoothed out (biased) version of :

where is an unknown constant. In other words, we just live with the bias. (Of course, the bias gets smaller as the sample size gets larger and gets smaller.)

Once we take this point of view, we can easily get a confidence band using the bootstrap. We draw from the empirical distribution and compute the density estimator . By repeating this many times, we can find the quantile defined by

The confidence band is then where

We then have that

as . Again, this is a confidence band for rather than for .

**Summary:** There really is no good, practical method for getting true confidence bands in nonparametric function estimation. The reason is that the bias does not disappear fast enough as the sample size increases. The solution, I believe, is to just acknowledge that the confidence bands have a slight bias. Then we can use the bootstrap (or other methods) to compute the band. Like Dr. Strangelove, we just learn to stop worrying and love the bias.