Re: [R] Density estimation when an end may not go to zero?

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Tue 08 Mar 2005 - 05:28:30 EST

On Mon, 7 Mar 2005, Spencer Graves wrote:

> All the density estimators I've found in R seem to force the ends to go
> to zero.

Which ones are those?

> 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?

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

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Tue Mar 08 05:45:16 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:41 EST