0

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.

Andre Silva
  • 4,782
  • 9
  • 52
  • 65
  • This isn't really a question about R, this is a stats question about how to use the weibull distribution. You should try asking this over at http://stats.stackexchange.com/ – David Marx May 31 '13 at 15:31
  • 1
    You need to work out what arrival rate corresponds to; it's probably the scale (or 1/scale). – huon May 31 '13 at 15:55

1 Answers1

2

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

IRTFM
  • 258,963
  • 21
  • 364
  • 487
  • Thanks guys. What I am trying to do is generating random numbers as a arrival time of web traffic, this follow Wiebull. I know the arrival rate for web traffic/s. Dwin for scale=1/rate. do you mean by rate is the inter-arrival time or the arrival rate? I only have the arrival rate so can I say scale=1/arrival rate? So the function works like this: rweibull(n, shape=1, scale = 1/arrival rate)? – user2440912 May 31 '13 at 17:08
  • What I meant was that the `rweibull` 'scale' parameter was equivalent to an `rexp` 1/'rate' parameter, in the case where the rweibull:shape = 1. My example used an "inter-arrival time" of 8 (in unspecified units) and was intended to demonstrate (modulo random draws) that equivalence. – IRTFM May 31 '13 at 17:26