Skip to content
Prev 172301 / 398506 Next

density > 1?

On Mon, 2009-03-02 at 13:27 +0100, Johannes Elias wrote:
Johannes,

Well density is not like probability

In histogram with density the area is equal de probability 

in you example

set.seed(123)
hist(rnorm(1000,sd=.1),freq=FALSE)

The interval of -0.05 and 0 have density=4 but a probability of number
in this interval is 4*.05=.2

the fact 

set.seed(123)
hist(rnorm(1000,sd=.1),freq=FALSE)$density
[1] 0.09999998 0.28000000 0.94000000 1.98000000 2.60000000 4.00000000
[7] 4.04000000 2.92000000 1.66000000 0.92000000 0.44000000 0.10000000
[13] 0.02000000

set.seed(123)
sum(hist(rnorm(1000,sd=.1),freq=FALSE)$density)
[1] 1


So the sum of probability is 1 but the sum of density 20