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:

enter image description here

And with the zeros removed:

enter image description here

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

  • 1
    $\begingroup$ You might also consider logspline density estimation, perhaps with constraints on the splines to reflect your knowledge. $\endgroup$
    – Glen_b
    Nov 22, 2013 at 9:09
  • 1
    $\begingroup$ 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. $\endgroup$
    – Nick Cox
    Nov 22, 2013 at 9:53
  • $\begingroup$ @Glen_b: I did actually try the R 'logspline' library, but it failed to converge. Might be worth taking a second look though. $\endgroup$ Nov 22, 2013 at 19:14
  • $\begingroup$ @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! $\endgroup$ Nov 22, 2013 at 19:16
  • 1
    $\begingroup$ Another possibility would perhaps be to consider a finite mixture. $\endgroup$
    – Glen_b
    Nov 22, 2013 at 21:12

1 Answer 1


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.

  • $\begingroup$ Thanks for that user603 - I'll have a look into that paper. $\endgroup$ Nov 22, 2013 at 19:17
  • $\begingroup$ 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. $\endgroup$ Nov 24, 2013 at 23:35
  • $\begingroup$ @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. $\endgroup$
    – user603
    Nov 25, 2013 at 10:21

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