[R] density() integrates to 1?

Liaw, Andy andy_liaw at merck.com
Thu Sep 25 03:36:38 CEST 2003


There was a related thread on R-help, probably last year.  The question was
getting density() to numerically integrate to 1.  The answer is, "yes".  If
you do fine enough partitions, you will see that it integrates to one.  And
yes, a kernel density estimate is theoretically a true density (assuming the
kernel used is a pdf), because it is just a n-component mixture of the
kernel.

Andy

> -----Original Message-----
> From: Ross Boylan [mailto:ross at biostat.ucsf.edu] 
> Sent: Wednesday, September 24, 2003 5:36 PM
> To: r-help
> Subject: [R] density() integrates to 1?
> 
> 
> Visual inspection of the plot of a density() function vs a 
> normal with the same mean and variance suggests the area 
> under the density curve is bigger than under the normal 
> curve.  The two curves are very close over most of the 
> domain.  Assuming the normal curve does integrate to 1, this 
> implies the area under density() is > 1.
> 
> Is there any assurance that the density kernel smoother 
> produces something that integrates to 1?  Or am I seeing things?
> 
> I suppose an additional complexity is that density() produces 
> discrete output, but then I'm looking at the continuous curve 
> plot produced.
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list 
> https://www.stat.math.ethz.ch/mailman/listinfo> /r-help
>




More information about the R-help mailing list