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?
Thanks for your attention,
Jorge
Did you look at the help? From ?rgamma:
<quote> Details:
If 'scale' is omitted, it assumes the default value of '1'.
The Gamma distribution with parameters 'shape' = a and 'scale' = s
has densityf(x)= 1/(s^a Gamma(a)) x^(a-1) e^-(x/s)
for x > 0, a > 0 and s > 0. The mean and variance are E(X) = a*s
and Var(X) = a*s^2.
</quote>Then, depending how you define "alpha" and "beta" use the above to figure out how to use rgamma.
-sundar
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
