[R] problems with rexp ?
Uwe Ligges
ligges at statistik.uni-dortmund.de
Fri May 3 16:07:47 CEST 2002
Juan Ramon Gonzalez wrote:
>
> Does anyone know if R have any problems with the exponential random number
> generation (function rexp)?
>
> I comment it because I executed
>
> data<-sort(rexp(100))
> plot(data,dexp(data)/(1-pexp(data)),type="l")
>
> and the graphic isn't constant.
>
> (Note: exponential distribution have a constant hazard failure rate).
Well, plot() scales the "y"-values to fit best into the area:
data <- sort(rexp(100))
dexp(data)/(1-pexp(data)) # all 1 ???
dexp(data)/(1-pexp(data)) - 1 # almost !!
>From the computational point of view everything is looking very well,
isn't it?
Maybe you would like to set a ylim as in
plot(data,dexp(data)/(1-pexp(data)),type="l", ylim =c(0,2))
Uwe
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list