# Obtain the conditional distributions from the full posterior distribution

by Danny   Last Updated January 14, 2018 13:20 PM

From the Posterior distribution below I would like to obtain the distributions $\mu|\sigma^2,x$ and $\sigma^2|\mu,x$

The likelihood is given by

$\prod L(x_i|\mu,\sigma^2) \propto \sigma^{-20}\prod_{i=1}^{20} exp(- \frac{(x_i-\mu)^2}{2\sigma^2 \cdot u_i})$ (A)

Where $X_i \sim N(\mu,\sigma^2 \cdot u_i^2)$ and where $i$ denotes the element in vector: $u = (0.5, 0.5, 0.5, 0.5, 0.5, 1, 1, 1, 1, 1, 1.5, 1.5, 1.5, 1.5, 1.5, 2, 2, 2, 2, 2)$

The prior is proportional to:

$f(\mu,\sigma^2)\propto \sigma^{-22}exp(\frac{(\mu-2)^2 + 20\cdot 2\cdot 1.7^2}{2\sigma^2 \cdot 1.7^2})$ (B)

And the posterior is therefore given by

$f(\mu,\sigma^2|x) \propto \sigma^{-22}exp(\frac{(\mu-2)^2 + 20\cdot 2\cdot 1.7^2}{2\sigma^2 \cdot 1.7^2})\cdot \sigma^{-20}\cdot exp(- \frac{\sum_{i=1}^{i=5} (x_i-\mu)^2}{\sigma^2 \cdot }) \cdot exp(- \frac{\sum_{i=6}^{i=10} (x_i-\mu)^2}{2\sigma^2 \cdot }) \cdot exp(- \frac{\sum_{i=11}^{i=15} (x_i-\mu)^2}{3\sigma^2 \cdot }) \cdot exp(- \frac{\sum_{i=16}^{i=20} (x_i-\mu)^2}{4\sigma^2 \cdot }.).$

But to get eg. $f(\mu|\sigma^2,x)= \frac{f(\mu,\sigma^2|x)}{f(\sigma^2|x)}$ I need to obtain $f(\sigma^2|x)$. I guess that I have to integrate out $\mu$ but how that is going to be done I am not sure

Tags :