[R] Density estimate with bounds

Greg Snow Greg.Snow at imail.org
Thu Nov 5 19:11:31 CET 2009


You may be interested in the logspline package.  It uses a different method from kernel density estimation, but it estimates densities from data and allows the specification of lower and/or upper bounds.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Justine Rochon
> Sent: Thursday, November 05, 2009 2:38 AM
> To: r-help at r-project.org
> Subject: [R] Density estimate with bounds
> 
> Dear R users,
> 
> I would like to show the estimated density of a (0, 1) uniformly
> distributed random variable. The density curve, however, goes beyond 0
> and 1 because of the kernel smoothing.
> 
> Example:
> 
> x = runif(10000)
> plot(density(x))
> 
> Is there a way to estimate the density curve strictly within (0, 1) and
> still use some sort of smoothing?
> 
> Any help would be greatly appreciated.
> 
> Best regards,
> 
> Justine Rochon
> 
> --
> GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list