Let a prior distribution be $$ \pi(\lambda)=\begin{cases} \frac{2\lambda}{3} & 0 < \lambda \le 1 \\ \frac{2}{3\lambda^2} & \lambda > 1 \end{cases} $$ This distribution has a median at $\lambda=1$ but is very variable so the mean is infinite. (i) Show that the posterior of $\lambda$ given by $x_1 \dots x_n\stackrel{\text{iid}}{\sim}\mathcal{E}(\lambda)$ is, $$ \pi(\lambda|x_1 \dots x_n) \propto \begin{cases} \lambda^{n+1} e^{-n\lambda\bar{x}}& 0 < \lambda \le 1 \\ \lambda^{n-2} e^{-n\lambda\bar{x}} & \lambda > 1 \end{cases} $$
Since $$L(\lambda|x_1,\dots,x_n)= \lambda^n e^{-n \lambda \bar{x}}$$
Therefore the posterior is, $$\begin{align} \pi(\lambda|x_1 \dots x_n) & = \begin{cases} \frac{\frac{2\lambda}{3}\lambda^{n} e^{-n\lambda\bar{x}}}{\int^{1}_{0} \frac{2\lambda}{3}\lambda^{n} e^{-n\lambda\bar{x}}d\lambda}& 0 < \lambda \le 1 \\ \frac{\frac{2}{3\lambda^2}\lambda^{n} e^{-n\lambda\bar{x}}}{\int^{\infty}_{1}\frac{2}{3\lambda^2}\lambda^{n} e^{-n\lambda\bar{x}} d\lambda} & \lambda > 1 \end{cases}\\ & \propto \begin{cases} \lambda^{n+1} e^{-n\lambda\bar{x}}& 0 < \lambda \le 1 \\ \lambda^{n-2} e^{-n\lambda\bar{x}} & \lambda > 1 \end{cases}\\ & \propto \begin{cases} Gamma(\alpha*=n+2,\beta*=n\bar{x}) & 0 < \lambda \le 1 \\ Gamma(\alpha*=n-1,\beta*=n\bar{x}) & 1 > \lambda \\ \end{cases} \end{align} $$
(ii) Consider using the accept-reject algorithm to sample from this posterior distribution with a gamma candidate distribution with shape parameter equal to $n + 2$ and rate parameter equal to $n\bar{x}$. Show that the acceptance probability for a candidate $Y$ is equal to $$P(Y) = \begin{cases} 1 & 0 < Y \le 1\\ Y^{-3} & Y > 1 \end{cases}$$
Let $g(Y)$ := Candidate Density and $f(Y)$ := Target Density. Also define $h(Y)=\frac{f(Y)}{g(Y)}$. We need to show $P(U \le \frac{h(Y)}{M})$. Where M is a constant and U ~ uniform(0,1).
$$\begin{align} h(Y) & = \begin{cases} \frac{Gamma(\alpha=n+2, \beta=n\bar{x})}{Gamma(\alpha=n+2, \beta=n\bar{x})} & 0 < Y \le 1 \\ \frac{Gamma(\alpha=n-1, \beta=n\bar{x})}{Gamma(\alpha=n+2, \beta=n\bar{x})} & Y \ge 1 \\ \end{cases}\\ & = \begin{cases} 1 & 0 < Y \le 1\\ \frac{\frac{(n\bar{x})^{n-1}}{\Gamma(n-1)}Y^{n-2}e^{-Y n \bar{x}}}{\frac{(n\bar{x})^{n+2}}{\Gamma(n+2)}Y^{n+1}e^{-Y n \bar{x}}} & Y > 1 \end{cases}\\ &= \begin{cases} 1 & 0 < Y \le 1 \\ \frac{(n\bar{x})^{-3}}{(n+1)(n)(n-1)}Y^{-3} & Y> 1\\ \end{cases}\\ &= \begin{cases} 1 & 0 < Y \le 1 \\ \frac{1}{(n^6-n^4)\bar{x}^3Y^{3}} & Y > 1\\ \end{cases} \end{align} $$
I am having trouble finding a the right bound for $h(Y)$. So I can show the probability? Can anyone help?
self-study
tag. You may like to read the guidelines at its tag wiki to get an idea of the style of answer you might expect (I don't think you'll need to edit your question to follow them because it looks like you're already following that part of those guidelines). $\endgroup$