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$
8
  • 2
    $\begingroup$ Can you list the formula you are using? $\endgroup$ Commented Sep 18, 2015 at 16:42
  • 1
    $\begingroup$ $x_i$ is a data value and the function is being evaluated at $x$. $\endgroup$
    – Glen_b
    Commented Sep 19, 2015 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$ Commented Sep 19, 2015 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
    Commented Sep 19, 2015 at 12:03
  • $\begingroup$ But if, for example, my xi are: 2, 4, 6, 8... etc what is my correspondinf x value? $\endgroup$ Commented Sep 19, 2015 at 20:52

1 Answer 1

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 and acknowledge you have read our privacy policy.

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