Diagonal correction for a quadratic density derivative estimate (source code)

= Diagonal correction for a quadratic density derivative estimate
{title2=$\widehat J_{2,b}=\frac1{n(n-1)b^5}\sum_{i\ne j}A((X_i-X_j)/b)$}

Let $X_i$ be an <independent and identically distributed> <statistical sample>[sample] from <probability density function> $f$, take $n\geq2$ and $b>0$, and write $L_b(x)=b^{-1}L(x/b)$. Assume the <kernel for density estimation> $L$ has square-integrable <second derivative>. Define
$$
A(v)=\int L''(t)L''(t+v)\,dt,\qquad
\widehat J_{2,b}=\frac1{n(n-1)b^5}\sum_{i\ne j}A((X_i-X_j)/b).
$$
This <U-statistic> obeys $\mathbb E\widehat J_{2,b}=\|(L_b*f)''\|_2^2$ whenever differentiation and the displayed <integrals> are justified. Under the usual <convolution> regularity this is $\|L_b*f''\|_2^2$.

The exact relation to the <second derivative kernel density estimator> is
$$
\widehat J_{2,b}=\frac n{n-1}\left[\int(\widehat f_b''(x))^2dx-\frac{\|L''\|_2^2}{nb^5}\right].
$$
Indeed, expand the square into ordered pairs; its diagonal terms are all $A(0)=\|L''\|_2^2$. Both subtracting this diagonal and changing the normalization from $n^2$ to $n(n-1)$ are needed for the displayed <U-statistic>. This removes the diagonal sampling contribution, while retaining smoothing <bias of an estimator> relative to $\int(f'')^2$. The corrected value can be negative in a finite <statistical sample>[sample] even though its target is nonnegative.