# Posterior distribution of function of a parameter

The question

Given independent random variables $$X_1,\cdots,X_n \sim N(\theta,\phi)$$

with joint prior density $$\pi(\theta,\phi)\propto \frac1\phi$$

Show that the posterior distribution of $t(\theta)=\frac{\sqrt n}{s}(\theta - \bar x)$ follows a $t$-distribution

What I have done so far

I have found the posterior density to be

$$\pi(\theta,\phi | \vec x ) \propto \phi^{-\frac n2-1} \exp \biggl [-\frac{1}{2\phi}\biggl((n-1)s^2+n(\bar x-\theta)^2\biggr)\biggr]$$

where $$s^2=\frac{1}{n-1}\sum_{i=1}^{n}(x_i-\bar x)^2$$

Integrating over $\phi \in (0,\infty)$ with reference to the Inverse Gamma distribution, we get the marginal distribution of $\theta$

$$\pi(\theta|\vec x) \propto \biggl(\frac{2}{(n-1)s^2+n(\bar x-\theta)^2}\biggr)^{n/2}$$

And then I am stuck...

For reference

The posterior density $\pi(\theta,\phi|\vec x)$ is certainly correct because it was given in the question.

Inverse gamma distribution with parameters $(\alpha,\beta)$:

$$f(y)=\frac{\beta^\alpha}{\Gamma(\alpha)y^{\alpha+1}}e^{-\beta/y} \; \; \; \; \; y>0$$

$t$-distribution with parameter $r$:

$$f(y) \propto \biggl(1+\frac{y^2}{r}\biggr)^{-\frac{r+1}{2}} \; \; \; \; y \in \Bbb R$$

• Don't you want to use $\propto$ instead of $\alpha$? – Przemysław Scherwentke Mar 30 '18 at 13:49
• How did u make that symbol? – glowstonetrees Mar 30 '18 at 13:50
• You may want to consider using propto ($\propto$) or varpropto ($\varpropto$). detexify is useful in these matters. – user228113 Mar 30 '18 at 13:50
• @glowstonetrees Backslash propto. – Przemysław Scherwentke Mar 30 '18 at 13:50

Suppose we know the density function $f_x$ of a random variable $X$, we can work out the density function of $Y = a(X - b)$ for constants $a$ and $b$. If $F_X$ denotes the distribution function of $X$, i.e. $F(x) = P(X \leq x)$ then $$F_Y(y) = P(a(X - b) \leq y) = P\left(X \leq \frac{1}{a}y + b\right) = F_X\left(\frac{1}{a}y + b\right)$$ Then $f_X(x) = F'_X(x)$ therefore $f_y(y) = \frac{1}{a} f_x\left(\frac{1}{a} y + b \right)$
In your case $X = \theta$ and $Y = t(\theta) = \frac{\sqrt{n}}{s}(X - \bar{x})$. So plugging $\frac{s}{\sqrt{n}}y + \theta$ into $\pi(\theta \mid \vec{x})$ and simplifying gives $$f_{Y}(y \mid \vec{x}) \propto \left( \frac{(n-1)s^2 + n(\bar{x} - \frac{s}{\sqrt{n}} y - \bar{x})^2 }{2} \right)^{\frac{-n}{2}} \propto \left( 1 + \frac{y^2}{n-1} \right)^{\frac{-n}{2}}$$ So in fact $t(\theta)$ follows a $t$ distribution on $n - 1$ degrees of freedom.