[Math] Statistics: Finding posterior distribution given prior distribution & R.Vs distribution

bayesianstatistics

I'm now learning Bayesian inference.This is one of the questions I'm doing.

Suppose we have R.V.s $X_1,X_2,\ldots,X_n$ each have an Exponential distribution with parameter $\theta$.
and prior for $\theta$ is an Exponential distribution with parameter $\lambda$.
So what would you do to find posterior?

Attempts:
Prior should be PDF of exponential with parameter $\lambda$.
Likelihood should be product of PDF of exponential of each $X_i$, with parameter $\theta$.

Then what would you do next?

Many thanks.

Best Answer

By definition, for every $x=(x_1,\ldots,x_n)$, $$f(\theta\mid x)\propto f(x\mid\theta)f(\theta)=\theta^n\mathrm e^{-s\theta}\cdot\lambda\mathrm e^{-\lambda\theta}\propto\theta^n\mathrm e^{-(s+\lambda)\theta},$$ where $s=x_1+\cdots+x_n$. For every positive $z$, $$ \int_0^{+\infty}\theta^n\mathrm e^{-z\theta}\mathrm d\theta=\frac{n!}{z^{n+1}}, $$ hence $$ f(\theta\mid x)=\frac1{n!}(s+\lambda)^{n+1}\theta^n\mathrm e^{-(s+\lambda)\theta}, $$ that is, $f(\ \mid x)$ is the Gamma $(n+1,s+\lambda)$ distribution.