Normal - Inv chi squared posterior calculation - Cross Validated most recent 30 from stats.stackexchange.com 2019-06-26T08:01:16Z https://stats.stackexchange.com/feeds/question/374645 http://www.creativecommons.org/licenses/by-sa/3.0/rdf https://stats.stackexchange.com/q/374645 1 Normal - Inv chi squared posterior calculation Syed Ali https://stats.stackexchange.com/users/203145 2018-10-31T14:29:47Z 2018-11-04T12:08:21Z <p>Given that for a known mean <span class="math-container">$\mu$</span> and unknown variance <span class="math-container">$\sigma^2$</span> the normal distribution is </p> <p><span class="math-container">$$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]$$</span></p> <p><span class="math-container">$$\sigma^2 \sim \text{Inv-}\chi^2(\nu_p, \sigma_p^2).$$</span></p> <p>Since it is a double parameter <span class="math-container">$\chi^2$</span> distribution, I used the one given below for calculations.</p> <p><span class="math-container">$$\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].$$</span></p> <p>Here's what I've done so far,</p> <p>Calculated the likelihood as,</p> <p><span class="math-container">$L(x|\mu, \sigma^2) \propto (\sigma^2)^{-n/2}\exp\left[-\displaystyle\frac{ns^2}{2\sigma^2}\right]$</span></p> <p>and</p> <p><span class="math-container">$p(\sigma^2) \propto (\sigma^2)^{-(\nu_p/2\ \ +\ \ 1)}\exp\left[-\displaystyle\frac{\nu_p\sigma_p^2}{2\sigma^2}\right]$</span></p> <p>which should give me a posterior of</p> <p><span class="math-container">$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]$</span></p> <p>Which should close to <span class="math-container">$\text{Inv-}\chi^2(\nu_p+\frac{n}{2},\frac{ns^2 + \nu_p\sigma_p^2}{2\sigma^2})$</span> if I'm not wrong. But, what I'm asked for is</p> <p><span class="math-container">$$\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),$$</span></p> <p>where <span class="math-container">$ns^2 = \sum_i^n (x_i - \mu)^2$</span>.</p> <p>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.</p> https://stats.stackexchange.com/questions/374645/-/375264#375264 0 Answer by Syed Ali for Normal - Inv chi squared posterior calculation Syed Ali https://stats.stackexchange.com/users/203145 2018-11-04T12:08:21Z 2018-11-04T12:08:21Z <p>Got it done, the problem was that I wasn't comparing the end terms with the standard <span class="math-container">$\text{Inv}-\chi^2$</span> distribution, which in the end yields, <span class="math-container">$$\nu_0 = \nu_p + n$$</span> <span class="math-container">$$\nu_0\sigma_0^2 = ns^2 + \nu_p\sigma_p^2$$</span> which simplifies down to <span class="math-container">$$\sigma_0^2 = \displaystyle\frac{ns^2 + \nu_p\sigma_p^2}{\nu_p + n}$$</span></p>