2
$\begingroup$

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?

$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – aleshing Nov 26 '17 at 0:38
  • $\begingroup$ 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$. $\endgroup$ – tmrlvi Nov 26 '17 at 1:23
  • $\begingroup$ 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). $\endgroup$ – tmrlvi Nov 26 '17 at 1:29
  • $\begingroup$ 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)$? $\endgroup$ – Juho Kokkala Dec 9 '17 at 16:19
  • $\begingroup$ 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.) $\endgroup$ – Scortchi - Reinstate Monica Dec 13 '17 at 11:31
5
$\begingroup$

HINT:

\begin{align*} \exp\big(-\frac{\theta}{\kappa_0}-\frac{(\bar{t}-\theta)^2}{2\frac{\sigma^2}{n}}\big) &= \exp\big( -\frac{n}{2\sigma^2} \big((\bar{t}-\theta)^2 + 2\frac{\sigma^2 \theta}{n \kappa_0}\big) \big)\\ &= \exp\big( -\frac{n}{2\sigma^2} \big(\bar{t}^2+\theta^2-2\theta\bar{t} + 2\frac{\sigma^2 \theta}{n \kappa_0}\big) \big)\\ &= \exp\big( -\frac{n}{2\sigma^2} \big( \big(\theta-(\bar{t} - \frac{\sigma^2}{n\kappa_0})\big)^2 + \frac{2\sigma^2}{n\kappa_0} \big( \bar{t} - \frac{\sigma^2}{2n \kappa_0} \big) \big) \big)\\ &= \exp\big( -\frac{\big(\theta-(\bar{t} - \frac{\sigma^2}{n\kappa_0})\big)^2}{\frac{2\sigma^2}{n}} \big) \exp \big(\frac{2\sigma^2}{n\kappa_0} \big( \bar{t} - \frac{\sigma^2}{2n \kappa_0} \big)\big) \end{align*}

$\endgroup$
  • $\begingroup$ @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$ $\endgroup$ – rightskewed Nov 26 '17 at 20:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.