Skip to content
Prev 65519 / 398506 Next

Density estimation when an end may not go to zero?

All the density estimators I've found in R seem to force the ends 
to go to zero.  What can we do if we don't believe that, e.g., with 
something that might be a uniform distribution or a truncated normal 
with only observations above mu+sigma observed?  

      The closest I could come to this was to artificially extend the 
numbers beyond the range, thereby forcing the density estimator to 
continue outside the range of the numbers, then plot only the part that 
I wanted.  The following example supposes simulates observations from a 
truncated normal with mean 0, standard deviation 1, and only 
observations above 1.5 are observed and we faked numbers between 1 and 
1.5: 

set.seed(1)
tst <- rnorm(1000)
tst1 <- tst[tst>1]
knl <- density(tst1)
sel <- knl$x>1.5
plot(knl$x[sel], knl$y[sel], type="l")

      Are there any convenient methods for handling this kind of thing 
currently available in R? 

      Thanks,
      Spencer Graves