[R] problems with rexp ?

Göran Broström gb at stat.umu.se
Fri May 3 16:19:24 CEST 2002


On Fri, 3 May 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.

Try

> data<-sort(rexp(100))
> plot(data,dexp(data)/(1-pexp(data)),type="l", ylim = c(0, 2))

and you may guess what's going on. (Has nothing to do with random 
number generation!)

Göran

> (Note: exponential distribution have a constant hazard failure rate).
> 
> Thank you,
> 
> Juan
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> 

-- 
 Göran Broström                      tel: +46 90 786 5223
 professor                           fax: +46 90 786 6614
 Department of Statistics            http://www.stat.umu.se/egna/gb/
 Umeå University
 SE-90187 Umeå, Sweden             e-mail: gb at stat.umu.se

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