I am working on R for kernel density estimation. I am testing different kernels and I need to evaluate them. I use next code for density estimation:
set.seed(1)
x1 <- rnorm(250)
#Computing of bandwidth
h1 <- bw.ucv(x1)
#Estimate
est <- density(x1,kernel = "gaussian",bw = h1)
#Values
est$y
I am using the function density
with gaussian kernel and bandwidth computed from unbiased crossvalidation. The est$y
values are the estimations from kernel. I have to evaluate these estimations with Integrated Squared Error. This is expressed as $ISE=\int\{\hat{f}(x)-f(x)\}^2$. I know $\hat{f}(x)$ is y
from est
but I have to compute all $ISE$. Is there any way to compute this on R or any package? I have to test this for multiple kernels. Many thanks for your help.