Calculating Marginal Posterior Distribution for Normal Data

170 Views Asked by At

In case of normal data with non informative prior distribution, the joint posterior distribution is given by;

$$p(\mu,\sigma^{2} |y)=\sigma^{-n-2}exp(\frac{-1}{2\sigma^{2}}[(n-1)s^{2}+n(\bar{y}-\mu)^{2}])$$

Refer to page no. 75 in Second Edition, Bayesian Data Analysis(Gelman et al.). My question is regarding calculation of marginal posterior distribution, $p(\sigma^{2}|y)$. Since we already have joint posterior above, it makes sense to marginalize it as shown;

$$p(\sigma^{2}|y) \propto \int \sigma^{-n-2}exp(-\frac{1}{2\sigma^{2}}[(n-1)s^{2}+n(\bar{y}-\mu)^{2}]d\mu$$

Ignoring the constants, we need to find the integral of $exp(-\frac{1}{2\sigma^{2}}n(\bar{y}-\mu)^{2})$. I am aware of the fact that being a distribution we have;

$$\int \frac{1}{\sqrt{2\pi \sigma^{2}}}exp(\frac{-(y-\theta)^{2}}{2\sigma^{2}})d\theta=1$$

In the book, it says that hence $\int exp(-\frac{1}{2\sigma^{2}}n(\bar{y}-\mu)^{2}) d\mu=\sqrt{\frac{2\pi \sigma^{2}}{n}}$

Can I kindly get help why is this last relation true? Help is appreciated.