# change of variable for integral to calculate posterior distribution

I'm working through an example which can be found here (p. 36), if someone is interested.

I have an integral of the form: $$P(x|\mu)=\int d\sigma P(x|\mu, \sigma)P(\sigma)=\int d\sigma \frac{1}{\sqrt{2\pi}\sigma}\exp(-\frac{(x-\mu)^2}{2\sigma^2})P(\sigma)$$

where $$P(x|\mu, \sigma)$$ is a likelihood and $$P(\sigma)$$ a prior distribution.

Now $$\beta=\frac{1}{\sigma^2}$$ is defined and the distribution over $$\beta$$ is defined to be a Gamma distribution of the form: $$f(\beta) = \frac{a^v}{\Gamma(v)} \beta^{v-1} e^{-a\beta}$$

When substituting $$\sigma$$ for $$\beta$$ the following expression is obtained, which I am struggling to derive myself: $$\int d\beta \frac{a^v}{\sqrt{2\pi}\Gamma(v)} \exp(-\beta\frac{(x-\mu)^2}{2}) \beta^{v-\frac{1}{2}} e^{-a\beta}$$

I tried converting $$P(\sigma)$$ to $$P(\beta)$$ using the change of variable technique and used u-substitution to change the variable of integration to no avail. Can someone lead me through the individual steps?

• At which page is the example? – callculus Mar 4 at 16:00
• @callculus p.36 (edited the question) – Dahlai Mar 4 at 16:02

Since $$\sigma = \beta^{-1/2}$$, we have $$d\sigma = -\frac{1}{2} \beta^{-3/2} \, d\beta$$ and $$f_\sigma (\sigma) = f_\beta (\sigma^{-2}) \cdot 2 \sigma^{-3} = \frac{a^v}{\Gamma(v)} (\sigma^{-2})^{v-1} e^{-a \sigma^{-2}} (2\sigma^{-3});$$ it follows that \begin{align*} \int_{\sigma = 0}^\infty \frac{1}{\sqrt{2\pi} \sigma} e^{-(x-\mu)^2/(2\sigma^2)} f_\sigma(\sigma) \, d\sigma &= \int_{\beta = \infty}^0 \frac{a^v}{\Gamma(v)} \frac{\beta^{1/2}}{\sqrt{2\pi}} e^{-(x-\mu)^2 \beta/2} \beta^{v-1} e^{-a \beta} 2\beta^{3/2} \cdot \frac{1}{2} \beta^{-3/2} \, d\beta \\ &= \frac{a^v}{\Gamma(v) \sqrt{2\pi}}\int_{\beta=0}^\infty e^{-((x-\mu)^2/2 + a)\beta} \beta^{v-1/2} \, d\beta \end{align*}