Pedro wrote:

> I have made a simple kernel density estimation by
> 
> x <- c(2,1,3,2,3,0,4,5,10,11,12,11,10)
> kde <- density(x,n=100)
> 
> Now I would like to know the estimated probability that a
> new observation falls into the interval 0<x<3.
> 
> How can I integrate over the corresponding interval?
> In several R-packages for kernel density estimation I did
> not found a corresponding function. I could apply
> Simpson's Rule for integrating, but perhaps somebody
> knows a better solution.

        One possibility is to use splinefun():

        > spiffy <- splinefun(kde$x,kde$y)
        > integrate(spiffy,0,3)
        0.2353400 with absolute error < 2e-09

                cheers,

                        Rolf Turner
                        [EMAIL PROTECTED]

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to