Closed tpanum closed 6 years ago
Good question: in general, no.
A density function of a continuous distribution should integrate to 1. However what is stored in the density
array is not the function itself, but the values of the function at a set of regularly spaced points. If we double the resolution (i.e. halve the step of the range
object), then this sum should double.
The long story short, the property that should hold is that for any UnivariateKDE
object
sum(k.density)*step(k.x) == 1
(approximately, there will be some numeric rounding error), and for BivariateKDE
objects
sum(k.density)*step(k.x)*step(k.y) == 1
(I'm going to leave this issue open to remind myself to put this in the docs when I get around to them).
Thanks a ton for the clarification.
Hello,
I'm by no means a math-wizard, so this might just be dumb question.
But since Kernel Density Estimation is about estimating the probability density function, aren't all the returned densities supposed to sum to approximately 1?