0
$\begingroup$

I'm new to Cross Validate, so sorry if I make any mistakes in my question. Any correction/advice would be welcome. My doubt is a rather basic one, but I'm strugling with this idea.

Supose I have some set of data and that I estimate a univariate nonparametric density estimation over some empirical variable Z, returning a PDF with two axis: x (the values of the variable) and y ( the probability density - which when integrated gives the probability of x happening).

Is it possible to recover with some degree of accuracy the moments of the original distribution Z (mean, variance, etc) using the bins of x and y returned from the PDF?

It seems that the median would be relatively straighfoward, since you would only have to integrate the area under the plot A and then find the first point which has area over 50% of A, but the others, if possible, are scaping me.

$\endgroup$
5
  • $\begingroup$ Sure, just evaluate $\int_{-\infty}^\infty x^mf(x)dx$ numerically. $\endgroup$
    – Alex R.
    Jul 15, 2017 at 21:53
  • $\begingroup$ Unless you intend "density" to encompass discrete probability functions, density is not probability, so if you have a continuous KDE what is on the y axis is not "probability of x happening". $\endgroup$
    – Glen_b
    Jul 15, 2017 at 22:42
  • $\begingroup$ Do you have the original kernel and bandwidth? Since a KDE is a mixture it's possible to compute the moments of the mixture (though they can get a bit unwieldy if you need a lot of moments) $\endgroup$
    – Glen_b
    Jul 15, 2017 at 22:43
  • $\begingroup$ Thanks for your inputs, guys! My question originated from the poor parametric fit that I was getting from evaluating numerically the moments of the distribution. I thought that I was doing something theoretically wrong. Now, it seems that what I was doing was correct, so I will double check my code with the guys from stack overflow. And @Glen_b, of course you are correct. The area under the graph would be correctly called probability, not the function by itself. Sorry for being imprecise. Edited my text to avoid confusion. $\endgroup$
    – Elijah
    Jul 17, 2017 at 22:58
  • $\begingroup$ I should add that estimating moments via a KDE won't necessarily give unbiased estimates; variance will be biased up (you'd end up estimating the sum of the population variance and the square of the bandwidth) and the 4th central moment would also be biased (though not consistently up or down -- toward that of the kernel, I suspect) $\endgroup$
    – Glen_b
    Jul 17, 2017 at 23:04

1 Answer 1

0
$\begingroup$

Probably more of a comment than answer, but I don't have enough rep.

  1. You could use method of moments: $E(X^m) \approx \frac1n \sum_{i=1}^n X_i^m $
  2. As Alex suggested, you could evaluate the integral numerically with your empirical CDF: $E(X^m) \approx \int x^m d\hat F(x)$ or use bootstrap.
$\endgroup$
1
  • 1
    $\begingroup$ These methods are biased. Since long ago datasets tended to be communicated as binned summaries, and calculations were painful to do, people early on developed practical, effective methods to correct such biases. They usually go under the name "Sheppard's correction." Although ordinarily these corrections assume a near-Normal distribution, the underlying methodology can be adapted to other distributional families. (The bootstrap bias can be quantified and corrected, too, if the bootstrapping is appropriately performed.) $\endgroup$
    – whuber
    Jul 18, 2017 at 12:59

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.