Boundary bias of a kernel density estimator (source code)

= Boundary bias of a kernel density estimator
{title2=$\int_{-\infty}^0\widehat f(x)\,dx=\frac1n\sum_i\Phi(-X_i/h)$}

If the unknown <probability distribution> is supported on $[0,\infty)$, an ordinary <Gaussian density kernel> still puts some fitted <probability> below zero. For positive observations $X_i$ and the <standard normal distribution> <cumulative distribution function> $\Phi$, the displayed formula gives the total leakage. For the <statistical sample> $(0.1,0.4,0.9)$ and <smoothing bandwidth> $h=0.5$, it is
$$
\frac{\Phi(-0.2)+\Phi(-0.8)+\Phi(-1.8)}3=\frac{0.42074029+0.21185540+0.03593032}{3}=0.22284200\ldots.
$$
Thus about $22.28\%$ of the fitted <probability> falls outside the known <support of a probability distribution>, even though the full <integral> remains one. The leakage panel in <smoothing bandwidth> shades this area. Simply deleting the negative part leaves area $0.777158\ldots$; renormalizing it makes another <probability density function> but does not by itself establish that the <bias of an estimator> has been corrected.

The issue also appears in the <expectation> of the <kernel density estimator>. For a nonnegative symmetric <kernel for density estimation> and a <probability density function> $f$ that is zero for $x<0$ and has a finite positive right-hand limit $f(0+)$, assume $f$ is bounded. Then, for fixed $K$ as $h\downarrow0$,
$$
\mathbb E\widehat f_h(0)=\int_0^\infty K(u)f(hu)\,du\longrightarrow\frac12 f(0+).
$$
Half the averaging window lies on the impossible side of the boundary. For example, the rate-one <exponential distribution> has $f(0+)=1$, so the limiting expected boundary height is $1/2$, rather than the right-hand height one. This refers to estimating the right-hand limit; changing a <probability density function> at a single point does not change its <probability distribution>. Decreasing the <smoothing bandwidth> narrows the affected region but does not remove this boundary-height error. This is why the interior <second-order pointwise bias bound for kernel density estimation> cannot be applied across a jump at the boundary.