Skip to content
Prev 23069 / 398502 Next

User error (was [R] density() returns a density function that does not add up to 1)

On Fri, 30 Aug 2002, Jonathan Li wrote:

            
(or, I did something silly)
(and got a nonsensical answer)
I think you intended

sum( unique(diff(d.density$x)) * d.density$y )

Your sum is 512x the estimate of E(X).