Skip to content
Prev 58985 / 398502 Next

density estimation: compute sum(value * probability) for given distribution

First thing you probably should realize is that density is _not_
probability.  A probability density function _integrates_ to one, not _sum_
to one.  If X is an absolutely continuous RV with density f, then Pr(X=x)=0
for all x, and Pr(a < X < b) = \int_a^b f(x) dx.

sum x*Pr(X=x) (over all possible values of x) for a discrete distribution is
just the expectation, or mean, of the distribution.  The expectation for a
continuous distribution is \int x f(x) dx, where the integral is over the
support of f.  This is all elementary math stat that you can find in any
textbook.

Could you tell us exactly what you are trying to compute, or why you're
computing it?

HTH,
Andy