# Optimal Smoothing parameter for Uniform Kernel density function

Given an n-dimensional sample $$\left\lbrace X_{i}\right\rbrace$$ of i.i.d. observations, let's consider a kernel density function $$\hat{f}_{h_{n},n}(x)=\dfrac{1}{nh_{n}}\cdot\sum_{i=1}^n K\left(\dfrac{X_{i}-x}{h_{n}}\right)$$ where:

• $$h_{n}$$ is a smoothing parmeter
• $$K(u)=\mathbb{1}\left( u\in\left\lbrace -1/2,1/2\right\rbrace \right)$$ is an indicator function

Question:

what's the optimal smoothing parameter $$h_{n}$$ in this case?

The answer will depend on your criterion for "optimal" and on the true density $$f$$ that is to be estimated. A common criterion is the Mean Integrated Square Error $$MISE = E\left( \int \left(f- \hat{f}\right)^2 dx\right)$$ where $$\hat{f}$$ is the kernel density estimate of $$f$$. One approach for finding an optimal $$h$$ is by means of "AMISE", which is an asymptotic epxansion (for small $$h$$) of MISE, and then analytically finding its minimum through $$AMISE'(h) = 0$$. This yields $$h_{AMISE} = \left[\frac{\int K^2 dx}{n \int \left(f''\right)^2 dx \int x^2 K^2 dx}\right]^2$$ This is the startng points for most choices of $$h$$, e.g., by inserting a Gaussian for $$f$$, or by inserting the estimate $$\hat{f}$$ for $$f$$ and solving the resulting implicit equation for $$h$$ ("plug-in method").
• thank you @cdalitz ! Could you explain to me how to replace $f$ with $\hat{f}$, in this case, please? Since the uniform kernel density is not differentiable we cannot compute the second-order derivative of $\hat{f}$. Is there a way to obtain a pseudo derivative? thank you – Almostsurely Jul 3 '20 at 23:21
• @Almostsurely: You are right that$\hat{f}$ is twice differentientiable only if $K$ is twice differentiable (the derivative can be pulled under the sum in the kernel density estimator). Obviously, this fails for your kernel representing a uniform distribution. In this case, you can use "Silverman's rule of thumb" instead, as described in the above articles. – cdalitz Jul 4 '20 at 8:14