Posterior distribution based on the conjugate Gaussian-gamma prior: Exercise 2.44 from Bishop's book

158 Views Asked by At

I am not sure how to tag a question such that different communities in the stackexchange can see at the same time.

I have posted a question in the "cross validated" community. In order to avoid multiple copies of the same question in the different community, I hope it is acceptable to share the link to the question: https://stats.stackexchange.com/q/350030/204499. I would be happy to receive your feedback and comments therein.

Thank you so much in advance,

1

There are 1 best solutions below

0
On BEST ANSWER

The original post of this question gets you to the point $$ p(\tau, \mu | \mathbf{x}, \alpha, \beta ) \propto \tau^{\alpha + n/2 - 1}\exp\left\{-\tau(\beta + \frac{1}{2}\sum_i\left(x_i - \bar{x})^2 \right)\right\}\cdot \tau^{1/2}\exp\left\{-\frac{\tau}{2}(n_0(\mu-\mu_0)^2 + n(\bar{x}-\mu)^2\right\}. $$ Now the claim is that you can write this as $q(\mu|\tau)q(\tau)$ with $q(\mu|\tau)$ a Gaussian density and $q(\tau)$ a Gamma density. The involved part then is rearranging that quadratic exponential in $\mu$. Completing the square you have $$ \begin{align} n_0(\mu-\mu_0)^2+n(\mu-\bar{x})^2&=(n_0 + n)\mu^2 -2(n_0\mu_0+n\bar{x})\mu+n_0\mu_0^2+n\bar{x}^2 \\ &=(n_0+n)\left(\mu - \frac{n_0\mu_0 + n\bar{x}}{n_0 + n}\right)^2 +\frac{n_0 n (\mu_0 - \bar{x})^2}{n_0 + n}. \end{align} $$ And so we have \begin{align} p(\tau, \mu |\mathbf{x}, \alpha, \beta) \propto \; &\tau^{\alpha + n/2 - 1}\exp\left\{-\tau\left(\beta + \frac{1}{2}\sum_i(x_i-\bar{x})^2 + \frac{1}{2}\frac{n_0n(\mu_0-\bar{x})^2}{n_0 + n}\right)\right\} \\ &\times \tau^{1/2}\exp\left\{-\frac{\tau(n_0+n)}{2}\left(\mu - \frac{n_0\mu_0 + n\bar{x}}{n_0 + n}\right)^2\right\} \end{align} From which we read off \begin{align*} q(\mu | \tau) &=\mathcal{N}\left(\mu\;\bigg|\;\frac{n_0\mu_0+n\bar{x}}{n_0 + n}, \frac{1}{\tau(n_0+n)}\right), \end{align*} and \begin{align*} q(\tau)&=\mbox{Gamma}(\alpha_n, \beta_n) \end{align*} with \begin{align} \alpha_n &= \alpha + \frac{n}{2}, \\ \beta_n &= \beta + \frac{1}{2}\sum_i (x_i-\bar{x})^2+\frac{n_0 n}{2}\frac{(\mu_0-\bar{x})^2}{n_0 + n}. \end{align}