# Density estimation with a truncated distribution?

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)


Thanks :)

• 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.
– whuber
Jun 18, 2011 at 21:29
• In some contexts something like this might be called a Tweedie distribution, in case that helps as you explore this. Jun 18, 2011 at 21:57
• 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. Jun 19, 2011 at 5:33

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.