# determine the posterior distribution of $\lambda$

Suppose that $$(x_1,..., x_n)$$ is a sample from a Poisson($$λ$$) distribution with $$λ ≥ 0$$ unknown. If we use the prior distribution for $$\lambda$$ given by the $$Gamma(a,b)$$ distribution, then determine the posterior distribution of $$\lambda$$.

I believe I need $$\pi(\lambda | s) = L(\lambda | \bar{x}) \times \pi(\lambda)$$

likelihood function times prior

likelihood of poisson is given by

$$L(\lambda | \bar{x}) = \prod_{x=1}^{n} \frac{\lambda^x e^{-\lambda}}{x!} = \frac{1}{(nx!)} \lambda^{\sum_{x=1}^{n} x} e^{-n\lambda} = \frac{1}{(nx!)}\lambda^{n \bar{x}}e^{-n\lambda}$$

prior is given by

$$\pi (\lambda)$$ ~ $$Gamma(a, b)$$

$$= \frac{b^a \lambda^{a-1} e^{-b\lambda}}{\Gamma (a)}$$ which is the probability density function

so finally

$$\pi(\lambda | s) = L(\lambda | \bar{x}) \times \pi(\lambda)$$

not sure how to compute this.

Any help appreciated !

The posterior density is given by $$f_{\lambda\mid x}(\lambda\mid x)\propto L(\lambda)\times f_{\lambda}(\lambda)$$ where $$f_{\lambda}$$ is the prior for $$\lambda$$ and $$L$$ is the likelihood. In our case $$L(\lambda)\times f_{\lambda}(\lambda)\propto\lambda^{\sum_{i=1}^n x_i}e^{-n\lambda}\times \lambda^{a-1}e^{-b\lambda}=\lambda^{a-1+\sum_{i=1}^n x_i}e^{-\lambda(n+b)}$$ where we dropped all the constants (including those that depend solely on $$x$$). Hence $$f_{\lambda\mid x}(\lambda\mid x)=C\lambda^{a-1+\sum_{i=1}^n x_i}e^{-\lambda(n+b)}$$ where $$C$$ is a function of $$x$$. By inspection $$\lambda\mid x$$ is a Gamma distributed random variable i.e. $$\lambda\mid x \sim \text{Gamma}(a+\sum_{i=1}^n x_i, n+b)$$ as desired.