# Normal - Inv chi squared posterior calculation

Given that for a known mean $$\mu$$ and unknown variance $$\sigma^2$$ the normal distribution is

$$X_i|\sigma^2 \sim \mathcal{N}(\mu, \sigma^2) = \frac{1}{\displaystyle\sigma\sqrt{2\pi}}\exp\left[-\displaystyle\frac{1}{2}\left(\frac{x_i - \mu}{\sigma}\right)^2\right]$$

$$\sigma^2 \sim \text{Inv-}\chi^2(\nu_p, \sigma_p^2).$$

Since it is a double parameter $$\chi^2$$ distribution, I used the one given below for calculations.

$$\text{Inv-}\chi^2(x;\nu_p,\sigma_p^2) = \frac{(\sigma_p^2\ \nu_p/2)^{\nu_p/2}}{\Gamma(\nu_p/2)}x^{-(\nu_p/2\ \ + \ \ 1)}\exp\left[-\frac{\nu_p\sigma^2}{2x}\right].$$

Here's what I've done so far,

Calculated the likelihood as,

$$L(x|\mu, \sigma^2) \propto (\sigma^2)^{-n/2}\exp\left[-\displaystyle\frac{ns^2}{2\sigma^2}\right]$$

and

$$p(\sigma^2) \propto (\sigma^2)^{-(\nu_p/2\ \ +\ \ 1)}\exp\left[-\displaystyle\frac{\nu_p\sigma_p^2}{2\sigma^2}\right]$$

which should give me a posterior of

$$posterior \propto (\sigma^2)^{-(\nu_p/2\ \ +\ \ 1\ \ +\ \ n/2)}\exp\left[-\displaystyle\frac{ns^2 + \nu_p\sigma_p^2}{2\sigma^2}\right]$$

Which should close to $$\text{Inv-}\chi^2(\nu_p+\frac{n}{2},\frac{ns^2 + \nu_p\sigma_p^2}{2\sigma^2})$$ if I'm not wrong. But, what I'm asked for is

$$\sigma^2 | x_1, x_2, \cdots, x_n \sim \text{Inv-}\chi^2 \sim \text{Inv-}\chi^2\left(\nu_p + n, \frac{\nu_p\sigma_p^2 + ns^2}{\nu_p+n}\right),$$

where $$ns^2 = \sum_i^n (x_i - \mu)^2$$.

I've tried multiple times, but I get to the same closed form as I've discussed, not the one I'm asked for. So I'd like to know where am I going wrong or doing wrong. Also, I'm not quite comfortable with the exact signs/notations used with posterior/prior/likelihood so if that can also be cleared out, that would be an added benefit for me.

Got it done, the problem was that I wasn't comparing the end terms with the standard $$\text{Inv}-\chi^2$$ distribution, which in the end yields, $$\nu_0 = \nu_p + n$$ $$\nu_0\sigma_0^2 = ns^2 + \nu_p\sigma_p^2$$ which simplifies down to $$\sigma_0^2 = \displaystyle\frac{ns^2 + \nu_p\sigma_p^2}{\nu_p + n}$$