The confusing gamma parameter

Boris from Ottawa sent me this email about Introducing Monte Carlo Methods with R:

As I went through the exercises and examples, I believe I found a typo in exercise 6.4 on page 176 that is not in the list of typos posted on  your website.  For simulation of Gamma(a,1) random variables with  candidate distribution Gamma([a],b), the optimal choice of b seems to be  a/[a] rather than [a]/a as suggested in the book.  Since the ratio dgamma(x,a,1)/dgamma(x,a,[a]/a) is unbounded, simulations with candidate distribution Gamma([a],[a]/a) yields poor approximation to the target distribution.

The problem with this exercise and the gamma distribution

f(x|a,b)=\dfrac{x^{a-1}e^{-bx}}{b^a\Gamma(a)}

in general is that it can be parameterised in terms of the scale or in terms of the rate, as recognised by the R [d/p/q/r]gamma functions:


GammaDist                package:stats                 R Documentation

The Gamma Distribution

Description:

Density, distribution function, quantile function and random
generation for the Gamma distribution with parameters ‘shape’ and
‘scale’.

Usage:

dgamma(x, shape, rate = 1, scale = 1/rate, log = FALSE)
pgamma(q, shape, rate = 1, scale = 1/rate, lower.tail = TRUE,
log.p = FALSE)
qgamma(p, shape, rate = 1, scale = 1/rate, lower.tail = TRUE,
log.p = FALSE)
rgamma(n, shape, rate = 1, scale = 1/rate)

Arguments:

x, q: vector of quantiles.

p: vector of probabilities.

n: number of observations. If ‘length(n) > 1’, the length is
taken to be the number required.

rate: an alternative way to specify the scale.

shape, scale: shape and scale parameters.  Must be positive, ‘scale’
strictly.

Thus, Boris understood b to be the scale parameter, while we meant b to be the rate parameter, meaning we are in fine in agreement about the solution! The deeper question is, why use a duplicated and hence confusing parameterisation?! The reason for doing so is that, while the scale is the natural parameter, the rate has the nicer (Bayesian) property of enjoying a gamma conjugate prior (rather than an inverse gamma conjugate prior). This is why the gamma distribution is implicitly calibrated by the rate, instead of the scale, in most of the Bayesian literature.

2 Responses to “The confusing gamma parameter”

  1. But why didn’t we [statisticians] come up with a better convention, e.g. using $\gamma$ for the scale so that, for the uninitiated, the notation suggests something is different here. Or, better yet, utilize the notation we use for the normal distribution, i.e. $N(0,\tau^{-1})$?

    • There is actually the same difficulty with the normal, \sigma could mean the standard deviation, the variance or even the older “probable error” or “modulus” \mathbb{E}[|X-\mathbb{E}[X]|]… Because standard distributions have been introduced and used in many fields, it is somehow hopeless to try to impose a unique notation ex-post…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.