BDA3 Chapter 2 Exercise 6

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

Considering the negative binomial variable y as a gamma-Poisson variable, we derive expressions for the mean and variance.

From equation 1.6, E(y)=E(E(yθ)). Since yθPoisson(10nθ), it follows that E(yθ)=10nθ. The rate θgamma(α,β) so E(θ)=αβ. Thus, E(y)=10nE(θ)=10nαβ.

We also have V(θ)=αβ2 since θgamma(α,β), and V(yθ)=10nθ since yθPoisson(10nθ). Thus,

V(y)=E(V(yθ))+V(E(yθ))=E(10nθ)+V(10nθ)=10nαβ+(10n)2αβ2