I am trying out some methods for finding the optimal bandwith for a kernel density estimation in R. Now I stumbled across a post on R-bloggers

If I compute the Silvermann's rule of thumb bandwith for my data I get the following

[1] 2.171556

Now if I use the cross validation method I get complete different results

        fdachi=Vectorize(function(i) density(kurseu[-i],from=kurseu[i],to=kurseu[i],n=1,bw=h)$y)
        return(integrate(function(x) fdach(x)^2,-Inf,Inf)$value-2*mean(F))}
    [1] 0.6299948

I have no idea why the results are so much different from each other


1 Answer 1


You should consider that Silvermann's rule of thumb assumes that the underlying density to be modeled is Gaussian, so if the density of your data is not distributed like that it might lead to very poor results.

Have you evaluated the fit that results from these two bandwidths? I'd assume that the one you found via cross-validation will perform better.

  • $\begingroup$ there was my mistake. I didn't take into account that the Silvermann bandwith only works for normal distributed data. So the cross validation works for all type of data and also for every kernel used? $\endgroup$ Mar 13, 2018 at 14:48
  • $\begingroup$ given that you have data available to use for crossvalidation aswell as that you have a parameter space you want to check and don't mind the computational effort, yes. A rule of thumb like Silvermann's is so attractive, because one can save the time it'd take to evaluate several models on the data, which might be expensive depending on the volume of the data and the parameter space one wants to search. $\endgroup$
    – deemel
    Mar 13, 2018 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.