[R] Gamma parametrization

G. Jay Kerns gkerns at ysu.edu
Fri Mar 19 17:01:36 CET 2010


Dear Randall,

On Fri, Mar 19, 2010 at 10:24 AM, Randall Wrong <randall.wrong at gmail.com> wrote:
> Dear R users,
>
> ?rgamma gives me :
>
>               rgamma(n, shape, rate = 1, scale = 1/rate)
>
>               rate: an alternative way to specify the scale.
>
>               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)
>
> Should I understand that scale=1/rate ? Is it written somewhere ?

You are kidding, right?  It is written 8 lines above your question, by
my count.  :-)

Perhaps you meant rate = 1/scale.

>
> Then rgamma(n, shape=a, scale = s) should be equivalent to rgamma(n,
> shape=a, rate =1/s).

Yep:
dgamma(2, shape = 3, scale = 4)
dgamma(2, shape = 3, rate = 1/4)

>
> I don't find this very clear.
>
> Thanks for your help.
>
> Randall
>

The point is that some books (and software) parameterize by the
'scale', and a whole other bunch parameterize by the 'rate'.  The
reader (and user) always needs to be careful that the version used is
the one expected. And the help file says that S doesn't have a 'scale'
parameter at all.

Just be careful, and you should be fine.  And IMHO, given that the PDF
of the density is shown it is reasonably clear as-is.

Best,
Jay





***************************************************
G. Jay Kerns, Ph.D.
Associate Professor
Department of Mathematics & Statistics
Youngstown State University
Youngstown, OH 44555-0002 USA
Office: 1035 Cushwa Hall
Phone: (330) 941-3310 Office (voice mail)
-3302 Department
-3170 FAX
VoIP: gjkerns at ekiga.net
E-mail: gkerns at ysu.edu
http://people.ysu.edu/~gkerns/



More information about the R-help mailing list