# Kernel density estimation on asymmetric distributions

Let $\{x_1,\ldots,x_N\}$ be observations drawn from an unknown (but certainly asymmetric) probability distribution.

I would like to find the probability distribution by using the KDE approach: $$\hat{f}(x) = \frac{1}{Nh}\sum_{i=1}^{N} K\bigl(\frac{x-x_i}{h}\bigr)$$ However, I tried to use a Gaussian kernel, but it performed badly, since it is symmetric. Thus, I have seen that some work about the Gamma and Beta kernels have been released, although I did not understand how to operate with them.

My question is: how to handle this asymmetric case, supposing that the support of the underlying distribution is not in the interval $[0,1]$?

• In the case of densities that are close to lognormal (which I encounter a lot in some particular applications), I simply transform (by taking logs) and then do KDE, and then transform the KDE back (you need to remember the Jacobian when transforming the estimate back). It works quite well in that case. Feb 15, 2013 at 15:27
• @Glen_b do you have any reference or material where this method is described? (Calculating the KDE on a transformation of the original variable and then transforming the KDE back) May 25, 2013 at 8:19
• Not that I know of - I'm sure they exist, since it's a rather trivial idea, and easily implemented. It's the sort of thing I'd expect a stats undergrad to be able to derive. In practice it works very well. May 25, 2013 at 9:20
• @glen_b thanks. So if I was to use it in a technical report/publication do you think it would be ok to not give any references? May 25, 2013 at 14:00
• @guy It's certainly possible to have problems, especially with some transformations and some kinds of data. The situations I've used it tend to be pretty close to lognormal, and there the change in bandwidth that you see as a problem is exactly what's needed; it does a great deal better than KDE on the raw data does. From the OP's description it sounded pretty similar, but it's not like I was suggesting it was a panacea. May 25, 2013 at 15:18

First of all, KDE with symmetric kernels can also work very well when you data is asymmetric. Otherwise, it would be completely useless in practice, actually.

Secondly, have you considered rescaling your data to fix the asymmetry, if you believe this is causing the problem. For example, it may be a good idea to try going to $\log(x)$, as this is known to help in many problems.

• If you rescale to log(x), do you also need to account for a jacobian? May 10, 2019 at 16:16

Hmm. You might want a kernel width that changes as a function of location.

If I were looking at the problem in eCDF then I might try and make a numeric slope of the CDF relate to the Kernel size.

I think that if you are going to do a coordinate transform, then you need to have a pretty good idea of the start and end points. If you know the target distribution that well, then you don't need the Kernel approximation.

• I could very easily know my RVs are nonnegative but still want a KDE.
– guy
May 25, 2013 at 14:53