[R] density ranges for uniform law
Ott Toomet
otoomet at econ.dk
Tue Apr 8 10:41:58 CEST 2003
Hi,
| From: ZABALZA-MEZGHANI Isabelle <Isabelle.ZABALZA-MEZGHANI at ifp.fr>
| Date: Tue, 8 Apr 2003 10:21:45 +0200
| Hello,
|
| I would have some details and explanations about the results I get.
| In fact, I start with a uniform sample between -1 and 1, and then plot its
| density.
| My problem is that the density ranges are much more longer than I expected :
|
| samp <- runif(10000,-1,1)
| plot(density(samp))
|
| Instead of varying between -1 and 1, the density varies between approximaly
| -1.5 and 1.5
The density is positive in the interval about (-1.3, 1.3) using the
default bandwidth. Its value is around 0.5. I guess you should try
to change bandwidth. Try
> plot(density(samp, bw=0.1))
> lines(density(samp, bw=0.03), col=2)
> lines(density(samp, bw=0.01), col=3)
best wishes,
Ott
| Could someone explain me what is happening ? Maybe some arguments for
| density estimation need to be set ?
|
| Isabelle.
More information about the R-help
mailing list