# What do the options of SmoothKernelDistribution do?

The function SmoothKernelDistribution has three options that are not described in too much detail in the Mathematica's help window.

InterpolationPoints: What is interpolated by Mathematica in function SmoothKernelDistribution?

MaxMixtureKernels: As far as my limited knowledge of kernel estimates goes, there will be as many kernels as grid points on my discretized domain. If my data lives on $x$, and I am attempting to approximate probability density function $f(x)$ then I may choose to do so at N evenly-spaced discrete points along $x$, e.g. $x_i, i=1,2,...,N$.

MaxRecursion: What recursion does this option pertain to?

-

You can click on each of these variables in the help for further explanation.

MaxMixtureKernels: the maximum number of kernels to generate the estimate from. The example in the help file makes this quite clear:

As you can increase the number of kernels (tent poles, if you will) from 10, 15, 25, to 100, the smoother the estimate becomes, at the expense of complexity (more parameters to estimate).

InterpolationPoints: How many points the interpolation function (kernel density estimate) is to be evaluated at.

10 points on the left, 100 on the right. First you fix the number of kernels (consider the previous diagram), then you select where to sample the interpolant.

MaxRecursion: An option for the Plot function to achieve better results in places where more samples are needed. Again, the help file provides some illuminating illustrations:

Here the levels of recursion runs from 0,1,2,4.

-
Thank you for your explanations! What I am still a little puzzled about is the fact that Mathematica does all this and gives you the opportunity to change some numbers, yet there are still things that you as a user might want to have control over: MaxMixtureKernels: Each (symmetric) kernel is going to be centred on some value. While this option allows you to change the total number of kernels, we still don't know where these are actually placed (I know the help function says uniformly spaced but what exactly does that mean for your specific set of data?). – Name Apr 29 '12 at 21:52
InterpolationPoints: This option seems to pertain to how often each individual kernel is evaluated, i.e. each kernel is interpolated (somehow ... possibly with splines?) and then the "y-value" where two neighboring kernels overlap are somehow averaged? MaxRecursion: I don't understand why we need to further smoothen the resulting interpolation function ... I mean we already specified everything by saying where we want kernels to centered and how finely we want to interpolate those individually? – Name Apr 29 '12 at 21:56
Forget what I said about overlapping kernels ... of course that shouldn't happen. However, if I choose a simple kernel such as "Rectangular", why would I want those to be interpolated individually with some polynomial? – Name Apr 29 '12 at 22:11

@Emre described the options quite well. Worth mentioning here is KernelMixtureDistribution which is a parametric equivalent to SmoothKernelDistribution. The goal of SmoothKernelDistribution is to interpolate the PDF (using linear interpolation) given by KernelMixtureDistribution.

In my work I use KernelMixtureDistribution when speed is less of an issue than quality since it is always a more accurate representation of a kernel density estimator and is capable of handling symbolic inputs. I use SmoothKernelDistribution when I want a quick, numeric and usually visual approximation to some density.

It is also worth pointing out the setting MaxMixtureKernels -> All guarantees that a kernel will be placed at each data point rather than on a uniform grid. This is a good setting to use whenever the number of data points is not astronomically large.

-
Thanks very much for pointing out this other function and the thing about placing a kernel at each data point. Using the latter option clarified things for me a little and I'll make sure to check out what this other function does. – Name Apr 29 '12 at 22:03