11
$\begingroup$

I have some data which is clearly truncated on the left. I wish to fit it with a density estimation that will handle it in some way instead of trying to smooth it down.

What known methods (as usual, in R) can address this?

Sample code:

set.seed(1341)
x <- c(runif(30, 0, 0.01), rnorm(100,3))
hist(x, br = 10, freq = F)
lines(density(x), col = 3, lwd = 3)

enter image description here

Thanks :)

$\endgroup$
3
  • 6
    $\begingroup$ This is a nice example of something that has been occasionally called a "delta lognormal distribution" (where the x-axis is interpreted as logarithms). You can consider it to be a mixture of one continuous distribution (which looks almost Normal--but its precise identification is up to you) and a point distribution supported near 0. A mixture model should do a good job. In this particular case the separation between the atom near 0 and the rest of the data is so good you would be well off just removing the data at the left (less than 0.5) and estimating the density of the rest. $\endgroup$
    – whuber
    Commented Jun 18, 2011 at 21:29
  • 3
    $\begingroup$ In some contexts something like this might be called a Tweedie distribution, in case that helps as you explore this. $\endgroup$
    – cardinal
    Commented Jun 18, 2011 at 21:57
  • $\begingroup$ Cardinal - thank you for the reference! Whuber, I am more interested in the near 0 part, so Greg's answer below is great. Thank you both. $\endgroup$
    – Tal Galili
    Commented Jun 19, 2011 at 5:33

2 Answers 2

6
$\begingroup$

The logspline package for R has the oldlogspline function which will estimate densities using a mixture of observed and censored data.

$\endgroup$
0
5
$\begingroup$

The density function also has a from parameter to indicate the left-most side "of the grid at which the density is to be estimated". Continuing from the above example:

lines(density(x, from = 0), col = 4, lwd = 3)

However, as you can see this is exactly the same distribution without the from parameter as above. It just starts from 0, that's all.

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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