2
$\begingroup$

In the Kernel density estimation formula below (from Wikipedia), what do the values of $x$ and $x_i$ represent?

$$ \hat f_h(x) = \frac{1}{n}\sum_{i=1}^n K_h(x-x_i) = \frac{1}{nh}\sum_{i=1}^n K\bigg(\frac{x-x_i}{h}\bigg) $$

I am implementing this formula but I am not sure about what they really represent. I know what values use for $x_i$, but I don't know what I'm passing in for $x$.

$\endgroup$
  • 2
    $\begingroup$ Can you list the formula you are using? $\endgroup$ – gung - Reinstate Monica Sep 18 '15 at 16:42
  • 1
    $\begingroup$ $x_i$ is a data value and the function is being evaluated at $x$. $\endgroup$ – Glen_b -Reinstate Monica Sep 19 '15 at 0:33
  • $\begingroup$ The formula is in this link: en.wikipedia.org/wiki/Kernel_density_estimation. I know what to use for xi, but i don't know what passing in x $\endgroup$ – Catia Cannata Sep 19 '15 at 7:38
  • $\begingroup$ Typically, $x$ would be one of a grid of points on a range that at least covers that of your data set. $\endgroup$ – user603 Sep 19 '15 at 12:03
  • $\begingroup$ But if, for example, my xi are: 2, 4, 6, 8... etc what is my correspondinf x value? $\endgroup$ – Catia Cannata Sep 19 '15 at 20:52
3
$\begingroup$

Since this doesn't have an answer yet, I'll expand my comment a little:

$x$ is the argument you're evaluating (calculating) the function (the density estimate) at.

$x_i$ the value of the $i$-th data point.

To draw the density, you'd normally evaluate $x$ across some reasonably fine grid of values.

But if, for example, my $x_i$ are: 2, 4, 6, 8... etc what is my corresponding x value?

$x$ will be whatever value you want to know $\hat{f}(x)$ at. This is like any other function -- If I said "here's a parabola, $g(x) = 3x^2-8x+5$" you're basically asking "but what value is $x$?". The answer is whatever value(s) you want to know $g$ at.

$\endgroup$

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.