# How do I calculate a posterior distribution for a Poisson model with exponential prior distribution for the parameter?

Suppose:

• $N \sim {\rm Poisson}(\lambda)$
• $\lambda$ is unknown, but we believe that it can be assumed $\sim \exp(1)$

If I want to calculate $N | X$, i.e., $P(model | data)$, I need to use the Bayes theorem in the following way:

$P(model|data) \propto P(data|model)*P(model)$

• $P(data|model)$ is the likelihood function
• $P(model)$ is my prior distribution density

So:

$P(data|model) = L(\lambda) = \exp\{-n\lambda + \log\lambda \sum k_i - \sum \log (k_i!)\}$

And

$P(model) = g(\lambda = 1) = e^{-\lambda}$

Therefore

$P(model|data) = \exp\{-n\lambda + \log\lambda \sum k_i - \sum \log(k_i!)\} e^{-\lambda}$

And if I had a sample of $k_1 = j$, then

$P(\lambda|k_1 = j) = \exp(-\lambda + \log \lambda j - \log j!) e^{-\lambda}$

Is it correct? How do I calculate an expected value for the parameter?

• Your statement of Bayes' theorem $$P(\text{model}|\text{data})=P(\text{data}|\text{model})∗P(\text{model})$$ is not correct. Your definition of the likelihood function is incorrect: you seem to be using the log-likelihood. Fix all that first and maybe the calculations will make more sense. Commented Apr 10, 2012 at 15:43
• Indeed, you are confusing likelihood and log-likelihood. Commented Apr 10, 2012 at 16:12

$\Pr(\text{data}|\text{model}) =\Pr(N=n|\lambda) = \frac{\lambda^n}{n!}e^{-\lambda}$.
$p(\text{model}) = p(\lambda) = e^{-\lambda}$.
$p(\lambda|N=n) = \dfrac{\frac{\lambda^n}{n!}e^{-\lambda}\cdot e^{-\lambda}}{\int_0^\infty \frac{\lambda^n}{n!}e^{-\lambda} \cdot e^{-\lambda}\, d\lambda} = 2^{n+1}\frac{\lambda^n}{n!} e^{-2\lambda}$
which is a Gamma distribution with parameters $n+1$ and $2$.