I have a question to the following: Let $\lambda$ ~ $Exp(1)$ and for a given $\lambda$ the $X_1, \ldots, X_n$ are i.i.d. with $X_i \mid \lambda$ ~ $Exp(\lambda)$. What is the a-posteriori distribution of $\lambda$ and what is the a-posteriori probability for $\lambda \geq 2$ if $n = 5$ and the mean value of the $X_i$ is given by $1.2$?
Ma idea was the following:
The likelihood is given by:
$$ l(\lambda \mid \underline{x}) = \prod_{i=1}^n \lambda \exp(-\lambda x_i) = \lambda^n\exp(-\lambda \sum_{i=1}^n x_i)$$
The a-priori is given by $\pi(\lambda)=\exp(-\lambda)$. Therefore the a-posteriori is given by:
$$ \pi(\lambda \mid \underline{x}) \propto l(\lambda \mid \underline{x})\pi(\lambda) = \lambda^n \exp(-\lambda(\sum_{i=1}^n x_i+1))$$
Therefore $\pi(\lambda \mid \underline{x})$ ~ $Ga(n+1, 1+n\overline{x})$ where $\overline{x} = \frac{1}{n} \sum_{i=1}^n x_i$.
Now for the probabilty my idea was to calculate
$$ P(\lambda \geq 2 \mid \underline{x}) = 1-P(\lambda \leq 1 \mid \underline{x}) = 1-\int_0^1 \frac{(1+5*1,2)^6}{\Gamma(6)}\lambda^5\exp(-\lambda(1+5*1,2)) d\lambda $$
but is this approach the correct one?
Because $\lambda$ is continuous, $P(\lambda \ge 2|\mathsf{x}) = 1-P(\lambda < 2|\mathsf{x}),$ so you'd need to integrate from 0 to 2.
In R statistical software:
Intuitively, this makes sense. Your prior mean for $\lambda$ is $1$ and the average of your data is $1.2,$ so it seems unlikely the posterior would assign much probability to $\lambda \ge 2.$