Skip to content
Prev 58975 / 398502 Next

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

Dear R users,

This is a KDE beginner's question. 
I have this distribution:
[1] 200
Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  459.9   802.3   991.6  1066.0  1242.0  2382.0 
I need to compute the sum of the values times their probability of
occurence.

The graph is fine,
den <- density(cap, from=min(cap), 
       to=max(cap), give.Rkern=F)
plot(den)

However, how do I compute sum(values*probabilities)? The
probabilities produced by the density function sum to only 26%:
[1] 0.2611142

Would it perhaps be ok to simply do
[1] 1073.22
?

Thank you,
b.