Normal–inverse-\chi^2 conjugacy
A pair (r,s) has a normal–inverse-\chi^2 distribution, written (r,s)\sim N\text{-}\chi^{-2}(\alpha,\beta,\gamma,\delta), if
p(r,s)\propto s^{-(\gamma+3)/2} \exp\!\left[-\frac{\beta(r-\alpha)^2+\gamma\delta}{2s}\right], \qquad r\in\mathbb{R},\quad s>0,
where \beta,\gamma,\delta>0. Let X_i\mid\mu,\sigma^2\stackrel{\mathrm{iid}}{\sim} \operatorname{N}(\mu,\sigma^2) for i=1,\ldots,n and put the prior
(\mu,\sigma^2)\sim N\text{-}\chi^{-2}(\alpha,\beta,\gamma,\delta).
Show that the joint posterior has the same family and identify all four updated parameters. Your derivation should explicitly complete the two weighted squares in \mu.
Question. A pair (r,s) has a normal–inverse-\chi^2 distribution, written (r,s)\sim N\text{-}\chi^{-2}(\alpha,\beta,\gamma,\delta), if
p(r,s)\propto s^{-(\gamma+3)/2} \exp\!\left[-\frac{\beta(r-\alpha)^2+\gamma\delta}{2s}\right], \qquad r\in\mathbb{R},\quad s>0,
where \beta,\gamma,\delta>0. Let X_i\mid\mu,\sigma^2\stackrel{\mathrm{iid}}{\sim} \operatorname{N}(\mu,\sigma^2) for i=1,\ldots,n and put the prior
(\mu,\sigma^2)\sim N\text{-}\chi^{-2}(\alpha,\beta,\gamma,\delta).
Show that the joint posterior has the same family and identify all four updated parameters. Your derivation should explicitly complete the two weighted squares in \mu.
Solution. Write
\overline x=\frac1n\sum_{i=1}^n x_i, \qquad s_x^2=\frac1{n-1}\sum_{i=1}^n(x_i-\overline x)^2.
The sum-of-squares decomposition is
\sum_{i=1}^n(x_i-\mu)^2 =(n-1)s_x^2+n(\overline x-\mu)^2.
Hence the likelihood kernel is \begin{align*} p({\boldsymbol{x}}\mid\mu,\sigma^2) &\propto(\sigma^2)^{-n/2} \exp\!\left[-\frac{1}{2\sigma^2} \sum_{i=1}^n(x_i-\mu)^2\right]\\ &=(\sigma^2)^{-n/2} \exp\!\left[-\frac{(n-1)s_x^2+n(\overline x-\mu)^2} {2\sigma^2}\right]. \end{align*} Multiplication by the prior gives \begin{align*} p(\mu,\sigma^2\mid{\boldsymbol{x}}) &\propto (\sigma^2)^{-n/2} \exp\!\left[-\frac{(n-1)s_x^2+n(\overline x-\mu)^2} {2\sigma^2}\right]\\ &\quad\times (\sigma^2)^{-(\gamma+3)/2} \exp\!\left[-\frac{\beta(\mu-\alpha)^2+\gamma\delta} {2\sigma^2}\right]\\ &=(\sigma^2)^{-(n+\gamma+3)/2} \exp\!\left[-\frac{ (n-1)s_x^2+n(\mu-\overline x)^2+ \beta(\mu-\alpha)^2+\gamma\delta} {2\sigma^2}\right]. \end{align*}
For positive u,v, direct expansion verifies
u(z-r)^2+v(z-t)^2 =(u+v)\left(z-\frac{ur+vt}{u+v}\right)^2 +\frac{uv}{u+v}(r-t)^2.
Taking u=n, v=\beta, z=\mu, r=\overline x, and t=\alpha yields \begin{align*} n(\mu-\overline x)^2+\beta(\mu-\alpha)^2 &=(n+\beta)(\mu-\alpha^\ast)^2 +\frac{n\beta}{n+\beta}(\overline x-\alpha)^2, \end{align*} where
\alpha^\ast=\frac{n\overline x+\beta\alpha}{n+\beta}.
Define \begin{align*} \beta^\ast&=\beta+n,\\ \gamma^\ast&=\gamma+n,\\ \delta^\ast &=\frac1{\gamma^\ast}\left[ \gamma\delta+(n-1)s_x^2 +\frac{n\beta}{n+\beta}(\overline x-\alpha)^2 \right]. \end{align*} Then the posterior kernel becomes
p(\mu,\sigma^2\mid{\boldsymbol{x}}) \propto (\sigma^2)^{-(\gamma^\ast+3)/2} \exp\!\left[-\frac{ \beta^\ast(\mu-\alpha^\ast)^2+\gamma^\ast\delta^\ast} {2\sigma^2}\right].
Thus
\boxed{(\mu,\sigma^2)\mid{\boldsymbol{x}} \sim N\text{-}\chi^{-2} (\alpha^\ast,\beta^\ast,\gamma^\ast,\delta^\ast)}.