I am given the following sample:
$6.56, 6.39, 3.30, 3.03, 5.31, 5.62, 5.10, 2.45, 8.24, 3.71,\\ 4.14, 2.80, 7.43, 6.82, 4.75, 4.09, 7.95, 5.84, 8.44, 9.36$
which is a sample from a $N(μ, σ^2)$ distribution.
I am also give that:
- The prior $μ|σ^2 \stackrel{}{\sim} N(3, 4σ^2)$
- $σ^2 \stackrel{}{\sim} Gamma(1, 1)$
I am being asked to determine the posterior of $\large(\mu, \frac{1}{\sigma^2})$. How do I find that? Any help is much appreciated!
Let's set $\theta_1=\mu$ and $\theta_2=\frac{1}{\sigma^2}$ so that $\theta_2$ indicates the precision of a normal distribution.
Your model is the following
$$p(x|\theta_1,\theta_2)=\sqrt{\frac{\theta_2}{2\pi}}e^{-\frac{\theta_2}{2}(x-\theta_1)^2}$$
I think that the Gamma(1;1) is the prior distribution of $\theta_2$ thus the prior
$$h(\theta_1,\theta_2)=\sqrt{\frac{1}{2\pi}}\theta_2^{\frac{1}{2}}\cdot e^{-\frac{\theta_2}{2}(\theta_1-3.4)^2}\cdot e^{-\theta_2}$$
is a Normal Gamma distribution with the following parameters_
$\alpha=1$
$\beta=1$
$\lambda=1$
$\mu=3.4$
Now, as usual, multiplying the prior and the likelihood, after some algebraic manipulations, you will find that the posterior distribution is still a Normal Gamma with the following parameters:
$\mu_{post}=\frac{3.4+n\overline{X}_n}{n-1}$
$\lambda_{post}=n+1$
$\alpha_{post}=1+\frac{n}{2}$
$\beta_{post}=1+\frac{1}{2}\Sigma_i(X_i-\overline{X}_n)^2+\frac{n(\overline{X}_n-3.4)^2}{2(n+1)}$
Concluding, after seeing the sample you posted, the posterior is
$$ \bbox[5px,border:2px solid red] { h(\theta_1,\theta_2|\mathbf{x})=\sqrt{\frac{21}{2\pi}}\frac{43.14^{11}}{10!}\cdot \theta_2^{10.5}\cdot e^{-10.5\theta_2(\theta_1-8.70)^2}\cdot e^{-43.14\theta_2} \ } $$