I have that $Y_i$ has distribution $N(\beta x_i^2, 1)$, $i=1 \dotsc n$ where $\beta$ has a prior distribution $N(0, \sigma^2)$. I need to calculate the posterior density of $\beta$, find its mean and variance.

My approach was to say that $p(\beta, y) \propto f(y|\beta)p(\beta) \propto \exp \left\{ -\frac{(y_i - \beta x_i^2)^2}{2}\right\} \exp \left\{ -\frac{\beta^2}{2\sigma^2}\right\}$.

To make the maths less messy, I omit the summation notation (but I do not forget about it!). I get that:

$p(\beta|y) \propto \exp \left\{ - \frac{1}{2} (\beta^2 (x_i^4 - \sigma^{-2}) - 2\beta (x_i^2 y_i) + y_i^2)\right\}$

Now, if I understand the question correctly I should be able to get a normal distribution-like expression inside the brackets. However, I fail to see how to make that happen.

The hint is that the variance of posterior density of $\beta$ is supposed to be $(x_i^4 - \sigma^{-2})^{-1}$ which tells me I should be quite close to getting the right answer.


1 Answer 1


The exponent term should be in the form (let $s$ be the deviation of the posterior): $$-(\beta-\mu)^2/2s^2=-\beta^2/2s^2+\beta\mu/s^2+C$$

If you match the terms, $\beta^2/2s^2=\beta^2(x_i^4-\sigma^{-2})/2$, so the variance, $s^2$, is as mentioned. Matching the other term yields $$\beta x_i^2y_i=\beta\mu/s^2\rightarrow\mu=s^2x_i^2y_i$$

  • $\begingroup$ So it does not have to make a perfect fit when completing the square since the last bit can be a constant? When I was trying to complete the square, the last term was $y_i^2$ but yours would be $s^2 x_i^4 y_i^2$. $\endgroup$
    – bajun65537
    Nov 8, 2020 at 13:53
  • 1
    $\begingroup$ No, it doesn't, because constant terms can be part of the proportional operator. $\endgroup$
    – gunes
    Nov 8, 2020 at 13:56

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.