On Wed, 2003-09-24 at 18:36, Liaw, Andy wrote: > 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
With this advice, and on reinspection, I think it's possible I was fooled in my visual integration. There is an area where the density() is under the normal. Vertically, it's actually quite a bit under, even though the two curves are horizontally very close. So perhaps that area is bigger than I thought, enough to account for the discrepancy. The other possibility is that even though the points on density are OK, the curve created by plot putting a line through them really is not OK (in the sense of integrating to 1). The issue for this is not the behavior of density when one increases the number of partitions, but the behavior at a fixed partition (the default 512 in my case). Or rather, that behavior plus that of plot's line. ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
