# marginal distribution of normal $\mu$ with inverse gamma prior on $\sigma^2$

(From Bayesian Essentials with R by Marin & Robert)

Given that $$\mu | \sigma^2 \sim N(\epsilon, \sigma^2 / \lambda_\mu)\,,$$ and $$\sigma^2 \sim IG(\lambda_\sigma /2, \alpha /2)\,,$$ we want to show that the marginal of $$\mu$$ is a T distribution.

In solution, setting $$\tau = \sigma^2$$ as shortcut, \begin{align} f(\mu | \lambda_\mu, \lambda_\sigma, \epsilon, \alpha) &\propto \int_0^\infty \frac{1}{\tau^{1/2}} exp{\Big\{-\frac{\lambda_\mu(\mu-\epsilon)^2}{2\tau}}\Big\} \tau^{-\lambda_\sigma/2-1}exp{\{-\alpha/2\tau\}} d\tau \\ & \propto \int_0^\infty \tau^{-\lambda_\sigma/2-3/2}exp{\Big\{-\frac{\lambda_\mu(\mu-\epsilon)^2 + \alpha}{2\tau}}\Big\} d\tau \\ & \propto \Big\{ \lambda_\mu(\mu-\epsilon)^2 + \alpha \Big\}^{-(\lambda_\sigma+1)/2} (*) \end{align}

I cannot figure out how to go from the integration to eq (*). Any hints or suggestions would be much appreciated.

This is a mere change of variable. When considering $$\mathfrak{I}=\int_0^\infty \tau^{-\lambda_\sigma/2-3/2}\exp{\Big\{-\frac{\lambda_\mu(\mu-\epsilon)^2 + \alpha}{2\tau}}\Big\} \text{d}\tau$$ define the change of variable from $$\tau$$ to$$\xi=\frac{\lambda_\mu(\mu-\epsilon)^2 + \alpha}{2\tau}$$with associated Jacobian $$\frac{\text{d}\tau}{\text{d}\xi}=-\frac{\lambda_\mu(\mu-\epsilon)^2 + \alpha}{2\tau²}$$and rewrite \begin{align}\mathfrak{I}&=\int_0^\infty \frac{\{2\xi\}^{\lambda_\sigma/2+3/2}}{[\lambda_\mu(\mu-\epsilon)^2 + \alpha]^{\lambda_\sigma/2+3/2}}\exp\{-\xi\} \frac{\lambda_\mu(\mu-\epsilon)^2 + \alpha}{2\xi^2}\,\text{d}\xi\\ &=[\lambda_\mu(\mu-\epsilon)^2 + \alpha]^{-(\lambda_\sigma+1)/2}\underbrace{\int_0^\infty \{2\xi\}^{\lambda_\sigma/2-1/2}\exp\{-\xi\}\,\text{d}\xi}_\text{constant in \mu}\\ \end{align}
Inverse Gamma PDF is $$f(x)=\frac{\beta^\alpha}{\Gamma(\alpha)}x^{-\alpha-1}exp(-\beta / x)$$ The integral of this should be $$1$$ from $$0$$ to $$\infty$$. So, $$\int_0^{\infty}{x^{-\alpha-1}exp(-\beta / x)}\text{dx}=\Gamma(\alpha)\beta^{-\alpha}$$ You'll obtain the exact same integral if you apply the changes: $$\beta\leftarrow\frac{\lambda_\mu (\mu-\epsilon)^2+\alpha}{2},\ \ \ \ \ \alpha\leftarrow\frac{\lambda_\alpha+1}{2}$$ So, the integral you're stuck with yields $$\Gamma(\alpha)\beta^{-\alpha}$$ and it is proportional to $$\beta^{-\alpha}$$ because $$\Gamma(\alpha)$$ term is constant with respect to $$\mu$$. So, the integral we have, call it $$I$$, will be proportional to: $$I \propto \left(\frac{\lambda_\mu (\mu-\epsilon)^2+\alpha}{2}\right)^{-(\lambda_\alpha+1)/2}\propto \left(\lambda_\mu (\mu-\epsilon)^2+\alpha\right)^{-(\lambda_\alpha+1)/2}$$
because $$2^{(\lambda_\alpha+1)/2}$$ is also constant wrt $$\mu$$.