# Calculate posterior distribution (gamma-prior, poisson-likelihood)

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

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?

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

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$
• I edited the likelihood. Could you may have a look if I did it correct? Could it be possible that you 'lost' the $y_i$ in the second step somehow? – Rchieve Apr 15 '16 at 14:59
You are missing $\frac {n_i}{100}$ in the poisson likelihood. You should have $\exp (-\frac {n_i\theta}{100})$ (I presume you have replaced $\lambda$ with $\theta$ in your solution).
Multiplicative constants in the power of something do not get absorbed into the proportionality constant! That is $\exp (-\frac {n_i\theta}{100}) \neq \exp (-\frac {n_i}{100}) \exp (-\theta)$