I am using R
, and would like to generate a number of observations using rweibull(n, shape, scale = 1)
.
I have the arrival rate (i.e. 1/interarrival time), but I do not know how to use it in rweibull
function.
I am using R
, and would like to generate a number of observations using rweibull(n, shape, scale = 1)
.
I have the arrival rate (i.e. 1/interarrival time), but I do not know how to use it in rweibull
function.
The scale parameter is what you need to be working with and the shape parameter is what needs to be set to 1 to create an exponential distribution. The scale parameter is 1/rate:
interT = 8
plot( density(rexp(100, rate=1/interT)) )
with( density(rweibull(100, scale=interT, shape=1)),
lines(x,y, col="red"))
(But if you are using the survival package you need to be aware that the parameters are different.)