[Math] Find posterior mean

bayesianstatistics

I have this problem,

Let $X\sim U(0,\theta)$ with $\theta>0$. Assume a signal random sample $X$, the squared error loss, and the prior $\pi(\theta) = \exp(1)$ i.e.

$\pi(\theta) = \theta e^{-\theta}$ for $\theta>0$

(a) Find the posterior distribution of $\theta$.

(b) Show that the posterior risk of an estimate of $\hat{\theta}$ is given by
$e^{x}\int_{x}^{\infty}(\hat{\theta}-\theta)^{2}e^{-\theta}\, d\theta$

(c) Find the posterior mean.

(d) Show that the result in (c) is the minimizer of posterior risk.

I've now completed parts (a) and (b), got that the prior distribution is $e^{x-\theta}$. Now when I go to find the posterior mean I get $e^{x}$, but when I compute the integral in part (b) and take derivative with respect to $x$, set to 0 and solve for $x$ I get an expression that is in terms of $\theta$ and $\hat{\theta}$. Obviously I'm getting radically different sorts of answers and so there's something very fundamental in what I'm doing wrong but I can't see it.

Best Answer

Given $X=x,$ the likelihood is $$ L(\theta) = \begin{cases} 1/\theta & \text{for } \theta\ge x, \\ 0 & \text{for } 0\le\theta<x. \end{cases} $$ The prior is $$ e^{-\theta} \, d\theta \quad \text{for } \theta \ge 0. $$ Your prior is wrong. I'm guessing you have in mind things like $e^{-\eta x} (\eta \, dx)$ for $x\ge0,$ where the density with respect to the measure $dx$ is $x\mapsto \eta e^{-\eta x}.$ The factor of $\eta$ in front needs to be there when the exponent is $\eta x.$ But in the present problem, the exponent in $e^{\displaystyle-1\cdot\theta} \, d\theta$ is $1\cdot\theta,$ so the thing that needs where the $\eta$ is, is $1.$ The distribution $\theta e^{-\theta} \, d\theta$ for $\theta\ge0$ is a gamma distribution other than an exponential distribution.

The posterior is $$ \text{constant} \times \frac 1 \theta e^{-\theta} \, d\theta \quad \text{for } \theta\ge x. $$

At this point I wonder if you were given the prior distribution $\theta e^{-\theta} \, d\theta$ for $\theta>0$ and you leapt to the conclusion that it's an exponential distribution? It is not. But with that distribution, the problem becomes tractable without numerical methods. Otherwise, the "constant" referred to above is the reciprocal of $$ \int_x^\infty \frac 1 \theta e^{-\theta} \,d\theta $$ and that lacks a closed form.

Assuming the prior is NOT exponential but is $\theta e^{-\theta} \,d\theta,$ the posterior is $$ \text{constant}\times e^{-\theta} \, d\theta \quad \text{for }\theta\ge x. $$ And now the "constant" is $e^x.$ The posterior expected value is then $$ \int_x^\infty \theta e^{x-\theta} \,d\theta = x+1. $$