Skip to content

rgamma question

5 messages · Icabalceta, Jorge L., Sundar Dorai-Raj, Peter Dalgaard +2 more

#
Icabalceta, Jorge L. wrote:

            
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 density

                f(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
#
"Icabalceta, Jorge L." <Icabalceta_j at wlf.state.la.us> writes:
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
theory.
#
On Thu, 5 Feb 2004, Icabalceta, Jorge L. wrote:

            
It depends on what you mean by gamma(alpha,beta). It could be
	rgamma(1,alpha,beta)
or
 	rgamma(1,alpha,1/beta)
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.

	-thomas
#
Jorge:  If I have trouble understanding documentation with 
something like this, I make plots, e.g., of dgamma vs. x for different 
values for shape and rate or scale. 
      hope this helps.  spencer graves
Peter Dalgaard wrote: