# Find the posterior density of theta, given prior with exponential density and samples from normal distribution

So the question was the following:

Let $t_1,...,t_n$ be a sample from a normal distribution with an mean that is unknown, $\kappa$, and a known variance $\sigma^2$.

We can assume that the prior density for $\kappa$ is an exp density with the mean of $\kappa_0$. The objective is to fin the posterior density of $\kappa$.

Now my first thought was to use:
\begin{align} p(\kappa|t) &= \frac{p(\kappa)p(t|\kappa)}{p(t)} \\[5pt] &\qquad\text{where} \\[5pt] \bar{t}|\kappa &\sim \mathcal{N}\bigg(\kappa,\ \frac{\sigma^2}{n}\bigg) \\[5pt] &\qquad\text{and} \\[5pt] \kappa &\sim \frac{1}{\kappa_0}e^{-\frac{\kappa}{\kappa_0}} \end{align} But this turned out to be very tricky to solve. I got the following: \begin{align} p(t) &= \int_{-\inf}^{+inf}p(t|\kappa)p(\kappa)d\kappa \\[5pt] &= \int_{0}^{\inf} \frac{1}{\kappa_0} e^{ -\frac{\kappa}{\kappa_0}}\prod_{i=1}^{n}e^{-\frac{(t_i-\kappa)^2}{2\frac{\kappa^2}{n}}}d\kappa \end{align}

I know that I can get rid of the product by simply putting a sum into the exponential but other than that I have no idea how solve this integral. Am I thinking about this problem the wrong way or is there a trick to solve the integral that I'm not seeing?

• I would try first working with the kernel of the joint $p(y,\theta)$, i.e. just get it down to the terms that involve $\theta$. Pretty sure this will jut be $e$ to some polynomial of $\theta$, which shouldn't be that hard to integrate. Nov 26, 2017 at 0:38
• Note that $y$ as a vector has variance of $\sigma^2$ in each coordinate, not $\frac{\sigma^2}{n}$. Also, a common trick is the transform the integrand into a known density function times something that does not depend on $\theta$. Nov 26, 2017 at 1:23
• Disregard my comment about the trick. You don't really need to calculate $p(y)$. For every function there is at most one density function (up to countably infinitely many points) that is proportional to it, so knowing $f\left(\theta, y\right)$ is enough (usually, you can figure out the distribution from it). Nov 26, 2017 at 1:29
• What is the purpose of the edit replacing $y$s by $t$s? is $p(y\mid \kappa)$ in the penultimate equation intentional or is it supposed to be $p(t\mid \kappa)$? Dec 9, 2017 at 16:19
• I rolled back your edit because the character you inserted for spacing doesn't render correctly in my browser (& doubtless some other people's browsers too) - spattering little boxes all over your post. (The spacing looks all right to me anyway.) Dec 13, 2017 at 11:31

• @user180984 The first term integration is like integrating a gaussian with mean $\bar{y} - \frac{\sigma^2}{n\kappa_0}$ while the second term is just a constant wrt $\theta$ Nov 26, 2017 at 20:27