[R] rgamma question
tlumley at u.washington.edu
Fri Feb 6 00:26:05 CET 2004
On Thu, 5 Feb 2004, Icabalceta, Jorge L. wrote:
> 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?
It depends on what you mean by gamma(alpha,beta). It could be
since both of these parameterisations are used.
If you think the mean of gamma(alpha,beta) is alpha*beta, use the second
one, if you think it is alpha/beta use the first one.
More information about the R-help