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?
 A: 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").
For a gentle introdutcion into this topic, see

M. C. Jones, J. S. Marron, S. J. Sheather:
"A Brief Survey of Bandwidth Selection for Density Estimation.
Journal of the American Statistical Association
91,433, pp. 401-407 (1996)

or for a not so gentle, but more recent overview

SJ. Sheather: "Density Estimation."
Statistical Science 19,4, pp. 588–597 (2004)

