Solved – Calculate posterior distribution (gamma-prior, poisson-likelihood)

bayesiandistributionsgamma distributionself-study

I want to calculate the posterior distribution given a gamma-prior and a poisson likelihood. The task is from a textbook and I just have the solutions (without a walkthrough). Please find all given information in the following:

Given information:

$m$ countries each with a population of $n_i$; $y_i$ is the number of people having a disease; $y_i$ is a poisson random variable with mean $\frac{n_i*\lambda}{100}$

The prior distribution for $\lambda$: $\lambda \sim Gamma(a_0,b_0)$

Task:

Show that the posterior distribution is also a gamma distribution with $a_m = a_0 + \sum_{i = 1}^{m}y_i$ and $b_m = b_0 + \sum_{i = 1}^{m} \frac{n_i}{100}$

My solution:

$Posterior \propto Likelihood \times Prior$

$p(\theta|y) \propto \prod_{i=1}^{m}(\theta^{y_i}e^{-\theta})\times
\theta^{a_0-1}e^{-b_0\theta}$

$p(\theta|y) \propto \theta^{\sum_{i = 1}^{m}y_i}e^{-m\theta}\times
\theta^{a_0-1}e^{-b_0\theta}$

$p(\theta|y) \propto \theta^{\sum_{i = 1}^{m}y_i+a_0-1}e^{-\theta(m+b_0)}$

$a_m = a_0 + \sum_{i = 1}^{m}y_i$

$b_m = b_0 + m \neq b_0 + \sum_{i = 1}^{m} \frac{n_i}{100}$

I think I am doing a mistake, because I don't know how to incorporate the information that the mean of $y_i$ is given as $\frac{n_i*\lambda}{100}$. Or do I just have to transform $b_m$ somehow? Can someone may give me a hint?

Thank you already in advance!

Edit 1: Considering first advices

$Likelihood: p(y | \theta) \propto \prod_{i=1}^{m}(\frac{n_i\lambda}{100})^{y_i}e^{-\frac{n_i\lambda}{100}}$

$\propto \prod_{i = 1}^{m} ((\frac{n_i}{100})^{y_i})\lambda^{\sum_{i=1}^{m}y_i}e^{-\lambda\sum_{i=1}^{m}\frac{n_i}{100}}$

$\propto \lambda^{\sum_{i=1}^{m}y_i}e^{-\lambda\sum_{i=1}^{m}\frac{n_i}{100}}$

Is the transformation of $\prod_{i=1}^{m}$ I did from the first to the second step correct?

Best Answer

The problem is in your usage of $\theta$. Each of the Poisson distributions have a different mean $$\theta_i = \dfrac{n_i \lambda}{100}. $$

The prior is placed on not $\theta_i$ but on the common parameter $\lambda$. Thus, when you write down the Likelihood you need to write it in terms of $\lambda$

\begin{align*} \text{Likelihood} & \propto \prod_{i=1}^{m} \theta_i^{y_i} e^{-\theta_i}\\ & = \prod_{i=}^{m} \left(\dfrac{n_i \lambda}{100}\right)^{y_i} e^{-\frac{n_i \lambda}{100}}\\ & \propto \lambda^{\sum_{i=1}^{m} y_i} e^{-\lambda \sum_{i=1}^{m} \frac{n_i}{100}}. \end{align*}

Related Question