Skip to content
Prev 206036 / 398513 Next

2 parameter exponential distribution

John Westbury wrote:
Presumably P(x)=0 for x<theta?  In which case

dexp2 <- function(x,rate=1,loc=0,log=FALSE) {
   dexp(x-loc,rate=rate,log=log)
}

rexp2 <- function(n,rate=1,loc=0) {
   rexp(n,rate=rate)+loc
}


 etc.

  It turns out that dexp(x) gives 0/-Inf for x<0 (I thought it would
give a warning, but it doesn't), so this is relatively simple.

  Of course the next question is what you actually want to do with this
distribution ...