Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.A41.4.58.0402051524010.55686@homer25.u.washington.edu>
Date: 2004-02-05T23:26:05Z
From: Thomas Lumley
Subject: rgamma question
In-Reply-To: <FF01C406D3A336489C58B9D0AE8E8E3702A0B0B0@wlfnt1.wlf.state.la.us>

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
	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