[R] rgamma question

Peter Dalgaard p.dalgaard at biostat.ku.dk
Thu Feb 5 23:54:08 CET 2004

"Icabalceta, Jorge L." <Icabalceta_j at wlf.state.la.us> writes:

> I was trying to generate random numbers with a gamma distribution. In R the
> function is: 
> rgamma(n, shape, rate = 1, scale = 1/rate). My question is that if
> X~gamma(alpha, beta) and I want to generate one random number where do I
> plug alpha and beta in rgamma? and, what is the meaning and use of rate?

Well, it depends on your definition of alpha and beta.... You need to
match up your notation for the gamma density with that given on
help(rgamma), which will also tell you what to do with them.

The "rate" argument just allows you to specify the scale as its
inverse. A large rate corresponds to a narrow distribution. I suspect
this is popular notation for interarrival distributions in queuing

   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907

More information about the R-help mailing list