Find a posterior mean estimator Assume $ X_1, X_2,... X_N$ are IID Gamma($r$ , $ \lambda$). Where r is constant. Find the posterior mean estimator of $\lambda$ for the $ \Gamma(l,k)$ prior.
So I know I need to find
$E[\lambda|X] = \lambda *\Pi(\lambda|X) d\lambda)$
I believe that $\Pi(\lambda|X) = (\Pi(\lambda))*F(X|\lambda))/m(x))$
And $f(x|\lambda)= \frac{(\lambda)^r}{\Gamma(r)}*x^{r-1}*e^{-\lambda*x} $ and $\Pi(\lambda)= \frac{\lambda^{L-1}*k^L*e^{-k\lambda}}{\Gamma(L)}$
I then tried to plug this back into the above formula hoping I would get some conjugate prior but with little to no luck. I'm still not convinced my setup is right as well however and any help would be appreciated!
 A: Suppose $X_i|\Lambda=\lambda \sim \Gamma(r,\lambda)$ and $\Lambda \sim \Gamma(l,k)$ where $l,k,$ and $r$ are constant. Notice how $$\begin{eqnarray*}f(x_1,...,x_n|\lambda)f_{\Lambda}(\lambda)&=&\frac{\lambda^r}{\Gamma(r)}x_1^{r-1}e^{-\lambda x_1}\times \dots \times \frac{\lambda^r}{\Gamma(r)}x_n^{r-1}e^{-\lambda x_n} \times \frac{k^l}{\Gamma(l)}\lambda^{l-1}e^{-kl} \\ &=& \frac{(x_1 \dots x_n)^{r-1}k^l \lambda ^{nr+l-1}e^{-\lambda(x_1+\dots +x_n+k)}}{\big(\Gamma(r)\big)^n \Gamma (l)}\end{eqnarray*}$$ Using $\int_0^{\infty}t^ae^{-bt}\mathrm{d}t=\frac{\Gamma(a+1)}{b^{a+1}}$ we get $$\int_0^{\infty}f(x_1,...,x_n|\lambda)f_{\Lambda}(\lambda)\mathrm{d}\lambda=\frac{(x_1...x_n)^{r-1}k^l \Gamma (nr+l)}{\big(\Gamma(r)\big)^n \Gamma(l) (x_1 + \dots +x_n +k)^{nr+l}}$$
Dividing these two expressions yields our posterior distribution for $\lambda$. $$\begin{eqnarray*}f(\lambda|x_1,...,x_n) &=& \frac{f(x_1,...,x_n|\lambda)f_{\Lambda}(\lambda)}{\int_{0}^\infty f(x_1,...,x_n|\lambda)f_{\Lambda}(\lambda)\mathrm{d}\lambda} \\ &=& \frac{(x_1 + \dots + x_n +k)^{nr+l}}{\Gamma(nr+l)}\lambda^{nr+l-1}e^{-\lambda(x_1 + \dots + x_n + k)}\end{eqnarray*}$$ This shows $$\Lambda|X_1=x_1,...,X_n=x_n \sim \Gamma(nr+l,x_1+\dots +x_n+k)$$ Hence our posterior mean is $\frac{nr+l}{x_1 + \dots + x_n +k}$.
