[R] Density estimate with bounds

Justine Rochon Justine.Rochon at klinik.uni-regensburg.de
Thu Nov 5 10:35:21 CET 2009


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



________________________
Justine Rochon
- Biostatistician -
Center for Clinical Studies
University Hospital Regensburg 
Franz-Josef-Strauß-Allee 11
D-93053 Regensburg
Phone: ++49-(0)941-944-5626
Fax: ++49-(0)941-944-5632
Email: justine.rochon at klinik.uni-regensburg.de




More information about the R-help mailing list