Skip to content

Density estimation when an end may not go to zero?

2 messages · Spencer Graves, Brian Ripley

#
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
#
On Mon, 7 Mar 2005, Spencer Graves wrote:

            
Which ones are those?
This is covered in MASS, for example.  logspline() would be a good choice 
here: it allows a finite support.