# State of the art: Non-parametric density estimation with a boundary and data clumped near zero [duplicate]

I have some data which I wish to estimate the marginal distribution of. I have no real idea what parametric distribution would be suitable, so was planning on fitting a non-parametric (probably kernel) density estimate to the data.

However, there are two complications

1) The data has a hard threshold at $0$

2) The data is mostly clumped around zero -- it is probably fair to say that it is a mix of two distributions, one being almost a delta at $0$, and the other being a strictly positive distribution with a long tail.

I know of some methods to deal with 1), but the simple methods I have used (reflection kernels) lead to unsatisfactory results near zero. I don't really know what to do about 2).

What is the state of the art for this kind of problem? Maybe an R-package that implements something I could try out?

Happy to give an example of the data, but I'm not sure the best way to do this. Let me know and I can edit the question.

EDIT: I tried the logspline idea - with and without removing the zeros (I actually removed all values very close to zero, $<0.05$). For interest sake, the result without removing the zeros is:

And with the zeros removed:

It looks like that with the zeros removed, an exponential distribution might fit fairly well.

• You might also consider logspline density estimation, perhaps with constraints on the splines to reflect your knowledge. – Glen_b Nov 22 '13 at 9:09
• Density estimation involving any kind of smoothing presupposes a smooth density to estimate. Given any strong evidence for a spike and no method is guaranteed to work well. Spikes at the bound(s) are worst of all. In addition to what you know about, removing the spike, smoothing the rest and putting back the spike might be one strategy. – Nick Cox Nov 22 '13 at 9:53
• @Glen_b: I did actually try the R 'logspline' library, but it failed to converge. Might be worth taking a second look though. – thebigdog Nov 22 '13 at 19:14
• @NickCox: Well you certainly make a good point... modelling it as a 'switching process' was in the back of my mind, but I was a little weary of an approach that seemed more complicated than it needed to be. Simply removing and then adding back the spike is a good idea, I'll give it a go! – thebigdog Nov 22 '13 at 19:16
• Another possibility would perhaps be to consider a finite mixture. – Glen_b Nov 22 '13 at 21:12

## 1 Answer

If you know the range of your data, you can use the inverse probit transformation. On a couple of examples, the fit looked very satisfying visually. This approach is explained in more detail in a clear paper[1]. I think there should be an R implementation but I couldn't find it (perhaps you can contact the author).

The approach can also be adapted to the case you where your random variable is distributed in $[0,+\infty)$

[1] G. Geenens, Probit transformation for kernel density estimation on the unit interval.

• Thanks for that user603 - I'll have a look into that paper. – thebigdog Nov 22 '13 at 19:17
• I appreciate this answer, but I can't find an easy implementation of this either, and so given that the question is about existing software, I probably shouldn't 'accept this'. I do appreciate the help though user603. – thebigdog Nov 24 '13 at 23:35
• @thebigdog: There are simulations and examples in the paper, so probably the author has some R code (the plots look like R ones). If I were you, I would contact him. – user603 Nov 25 '13 at 10:21