# Posterior density and posterior moments

I would be very grateful to get some help with the following problem.

Let $X_1, ..., X_n$ be independent and uniformly distributed on the interval $(0,\theta)$ with $\theta>0$. Let the prior density of $\theta$ be the log-normal distribution with parameters $(\mu,\sigma^2)$ where $\mu \in \mathbb{R}$ and $\sigma>0$ are known constants. I'm looking for

a) the posterior density of $\ln{\theta}$,

b) the k-th posterior moment of $\theta$,

c) the maximum of the posterior density of $\theta$.

I tried to solve a) as follows.

Let $p(\theta)$ be the prior density of $\theta$ and $L(x_1, ..., x_n|\theta)$ the likelihood function of $\theta$ given the outcome $X_1=x_1, ..., X_n=x_n$. Then the posterior density $f(\theta|X_1=x_1, ..., X_n=x_n)$ is given by $$\frac{L(x_1, ..., x_n|\theta)p(\theta)}{N}$$ where $$N=\int_0^\infty L(x_1, ..., x_n|\theta)p(\theta) d\theta$$ is a normalizing constant.

I have $$p(\theta)=\frac{1}{\sqrt{2\pi}\sigma\theta}\exp \left(-\frac{(\ln{\theta}-\mu)^2}{2\sigma^2}\right)$$ and $$L(x_1, ..., x_n|\theta)=1/\theta^n$$ where $x_1, ..., x_n \in (0,\theta)$ and $0$ otherwise.

Now I need to solve that integral, but I can't figure it out. Since we're asked to give the posterior density of $\ln{\theta}$, I tried to substitute $y=\ln{\theta}$ by using $$\theta^{-(n+1)}=\exp \left(\ln{\theta^{-(n+1)}}\right)=\exp \left(-(n+1)\ln{\theta}\right)$$ and simplifying the integral to $$N=\int_0^\infty \frac{1}{\sqrt{2\pi}\sigma}\exp \left(-(n+1)y+\frac{(y-\mu)^2}{2\sigma^2}\right)dy.$$

However, I still can't solve that integral and feeding it to Wolframalpha didn't yield a result as well.

Have I done something wrong or do I need to choose a completely different approach? So far I didn't care much about b) and c) since I need to solve a) in order to do them, I think.

• I think your range of integration in last integral should be $\int_{-\infty}^{\infty}$, just on grounds that log($\theta$) is normal, and if that's true, yo can do the integral. – mike May 5 '13 at 13:39
• I think I've made a mistake anyway. If I substitute $y=\ln{\theta}$, I have to apply $dz=1/ \theta d\theta$ and replace $d\theta$, too, right? Then I'd have the integral $$N=\int_?^\infty \frac{1}{\sqrt{2\pi}\sigma}\exp \left(-ny+\frac{(y-\mu)^2}{2\sigma^2}\right)dy.$$ I'm rather confused about the range though. If $y=\ln{\theta}$ and $\theta>0$, shouldn't I have $1$ as my lower bound for the integral with respect to $y$? Anyway, independent of the right range of integration, I can't find an antiderivative of the darned thing... How do I do it? – Amarus May 5 '13 at 23:44
• The integration should begin at $\theta=\max(x_1,\dotsc,x_n)$, since $L$ vanishes unless $x_i\le\theta$ for all $i$. – joriki May 6 '13 at 5:42