# How does bandwidth selection work for low-variance dimensions with KernelMixtureDistribution?

I am puzzled because this toy example (in Mathematica 8)

dist = KernelMixtureDistribution[{{0, 1}, {0.0, 0}, {0, -1}},"Silverman",
MaxMixtureKernels -> All];
DensityPlot[PDF[dist, {x1, x2}], {x1, -3, 3}, {x2, -3, 3}]


produces a density estimate with quite a large extent in x-direction although it has zero standard deviation. I would not have been surprised if that had produced an error because it should be a delta impulse in x-direction and I don't know if that can be represented by Mathematica. But this result does not make sense.

If I change it to

dist = KernelMixtureDistribution[{{0, 1}, {0.01, 0}, {0, -1}},"Silverman",
MaxMixtureKernels -> All];
DensityPlot[PDF[dist, {x1, x2}], {x1, -3, 3}, {x2, -3, 3}]


the result is a very thin distribution as expected. The behaviour is similar for Silverman's and Scott's rules of thumb.

Can someone shed some light on how the standard deviations are interpreted here? Is this a bug maybe ?

-
Thanks for your comment! I do not think it has to do with ColorFunctionScaling. My main issue is with the bandwidth of the kernels in x-direction which is nicely visible in the plot you proposed. The datapoints from which the distributions are estimated do not have a standard deviation of ~1 (in x-direction). Thus, I think the results of the automatic bandwidth selection methods are wrong here. – Kai Petersburg Jul 30 '12 at 14:32

The short answer is that when the standard deviation is zero it is treated as 1.

The benefit of this approach is that a single data point can be used to examine a sort of "standard" kernel.

For example:

ContourPlot[Evaluate@
PDF[KernelMixtureDistribution[{{0, 0}}, Automatic, "Epanechnikov"],{x,y}],
{x, -2, 2}, {y, -2, 2}
]


Now whether this is the correct or desired behavior is certainly up for debate.

Keep in mind that automatic bandwidth selection is nice but after some initial exploration one can (and probably should) always set the bandwidth manually in practice based on some intuition and understanding about the data.

-
"Now whether this is the correct or desired behavior is certainly up for debate." Well, then it should at least be documented somewhere, no? Or is it? – R. M. Jul 30 '12 at 15:42
@R.M unless it were decided that this is a bug. In which case the behavior should be "fixed". – Andy Ross Jul 30 '12 at 15:52
Thanks. I was hoping I could get away with automatic bandwidth selection because there are too many distributions in my data to even visualize them. Maybe I will give it a shot and implement my own Scott or Silverman method with a different treatment of 0 stddev... – Kai Petersburg Jul 30 '12 at 16:23