BDA3 Chapter 2 Exercise 18

Here’s my solution to exercise 18, chapter 2, of Gelman’s Bayesian Data Analysis (BDA), 3rd edition. There are solutions to some of the exercises on the book’s webpage.

Suppose we have n observations from a Poisson likelihood, yiθPoisson(xiθ), with rate θ and exposure xi. We show that with a gamma prior, θgamma(α,β), the posterior also has a gamma distribution.

As shown in the book, the likelihood and prior are

p(yθ)θn1yieθnixip(θ)θα1eβθ.

Thus the posterior is

p(θy)θn1yieθnixiθα1eβθ=θα1+n1yieθ(β+n1xi),

which shows that p(θy)gamma(α+n1yi,β+n1xi).