I am trying to learn Kernel density estimation, I need help to understand how the bandwidth $h$ affects the Kernel density estimator. Consider a Gaussian Kernel $k(x)~=~\frac{1}{\sqrt{2 \pi}} e^{-x^2}$. The Kernel density estimator is given by ${\hat{f}}_h (x) ~=~ \frac{1}{n} \sum_{i=1}^{n} K_h(x-X_i)$.

Clearly, $k(x)$ is independent of $h$, where does $h$ come in? What would be ${\hat{f}}_h (x)$? How does $h$ affect the Kernel?

Thank you!

  • $\begingroup$ It should be e^(-0,5x^2). $\endgroup$ – shenflow Feb 16 '18 at 15:53
  • $\begingroup$ An illustrated explanation for the case of two-component $x$ is posted at gis.stackexchange.com/a/14376/664. $\endgroup$ – whuber Feb 16 '18 at 17:42

I guess the problem is that you are using the wrong formula for the Gaussian kernel. The Gaussian kernel uses normal probability density function that has the following form

$$ f(x) = \frac{1}{\sqrt{2\pi\sigma^2}} e^{-\tfrac{(x-\mu)^2}{2\sigma^2}} $$

where the distribution with parameters $\mu=0$ and $\sigma^2 = 1$ is called standard normal distribution. The formula you quote resembles it. Gaussian kernel is based on normal density function centered at mean $\mu=0$ and has variance $\sigma^2 = h^2$. So $h$ is the scale parameter (standard deviation) of the kernel, so it serves similar purpose as bandwidth in other kernels, where it controls the "width" of the kernel.

As Dan said, kernels are often defined in terms of "standard" kernel, e.g. standard triangular kernel is $K(x) = (1 - |x|)$ and the scaled kernel $K_h(x) = K(x\,/\,h)\,/\,h$. The standard form of the Gaussian kernel, is the standard normal distribution.

See also the Why does definition of kernel include bandwidth? thread.


Based on the first equation on the wikipedia kde article, (and then written explicitly in the first paragraph following it)



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.