I am trying to solve the following problem:

Given $n$ independent observations $Y_i$ from a Normal$(\theta, \tau^{-1})$ distribution with unknown mean $\theta$ and unknown precision $\tau$, i.e

$$Y_i \approx Normal(\theta, \tau^{-1}) \ , \ i = {1, ..., n}$$

Assume for $\theta$ and $\tau$ the following non-informative priors:

$$\theta \approx Normal(0,10^6) $$ $$\tau \approx Gamma(0.001,0.001) $$

Given $\textbf{y}$ is the observations $(y_1, ...,y_n)$. Derive two conditional distributions $p(\theta|\tau, y)$ and $p(\tau|\theta, y)$. One should be written as a normal distribution and the other as a Gamma distribution.

I have started by calculating $p(\theta|\tau, y)$ as:

$$ p(\theta|\tau, y) = p(\theta,\tau) \prod^{n}_{i=1} p(y_{i}|\theta, \tau) = \tau^{-1} \overbrace{\tau^{n/2}\exp[\frac{-\tau}{2} \sum^{n}_{i=1}(y_i - \theta)^2]}^{L(\theta,\tau;\textbf{y})} \\ = \tau^{\frac{n}{2} - 1} \exp [-\frac{\tau}{2} \sum^{n}_{i=1} (y_i - \bar{y} + \bar{y} -\theta)^2] \\ = \tau^{\frac{n}{2} - 1} \exp [-\frac{\tau(n-1)}{2} s^2 -\frac{\tau n}{2}(\bar{y} - \theta)^2 ] $$

In the last step $s = \frac{1}{n-1} \sum^{n}_{i=1} (y_{i} -\bar{y})^2$

I am new to Bayesian, not sure whether this is correct/best way to approach this question. Also I am unsure how could I find the other conditional distribution as Gamma Distribution.

My attempt at the derivation for the Gamma distribution is:

$$p(\tau|\theta,y) = p(\theta,\tau) p(y_{i}|\tau, \theta) \\ = \tau^{-1} \frac{y^{\theta}}{\Gamma(\theta)} \tau^{\theta -1} \exp^{-y \tau} $$


  • $\begingroup$ @Xian, Sorry I am not very experience and may be confused, for the conditional posterior on $\theta$, I am not sure if it is correct but I assumed the joint prior distribution to be $\tau ^{-1} $ given as $p(\theta|\tau) = p(\theta|\tau)p(\tau)$. Could you please clarify of how to find this joint prior ? $\endgroup$
    – CandiCC99
    Commented Mar 30, 2020 at 9:46
  • $\begingroup$ @Xian for the conditional posterior om $\tau$, so the likelihood becomes $p(y_i|\tau, \theta) = Exp[\frac{\theta}{2} \sum^{n}_{i=1} (y_{i} - \tau)^2]$ ? I am a bit confused given we are asked to calculate one as a Normal Distribution and the other as a Gamma Distribution hence my choice for the likelihood here. I am very confused at this moment any clarifications are welcomed. $\endgroup$
    – CandiCC99
    Commented Mar 30, 2020 at 9:49
  • $\begingroup$ @Xi'an OK. I still don't understand what is wrong with my joint prior as you have mentioned above and by writing the likelihood exactly the same as for $\theta$ I am not answering the question that requires one to be given as normal and the other as a gamma distribution. Thanks for your pointers. $\endgroup$
    – CandiCC99
    Commented Mar 30, 2020 at 11:36

1 Answer 1



For $\theta$, \begin{align*} p(\theta|\tau,\textbf{y}) &\propto \overbrace{\tau^{\frac{n}{2} - 1} \exp [-\frac{\tau(n-1)}{2} s^2}^\text{does not depend on $\theta$} -\frac{\tau n}{2}(\bar{y} - \theta)^2 ]\\ &\propto \exp[-\frac{\tau n}{2}(\bar{y} - \theta)^2 ] \end{align*} and spot the Normal density in $\theta$

For $\tau$, \begin{align*} p(\tau|\theta,\textbf{y}) &\propto p(\theta,\tau|\textbf{y})\\ &\propto \tau^{-1} \underbrace{\tau^{n/2}\exp[\frac{-\tau}{2} \sum^{n}_{i=1}(y_i - \theta)^2]}_{L(\theta,\tau;\textbf{y})} \end{align*} and spot the Gamma density in $\tau$.

  • $\begingroup$ So my joint prior $p(\theta|\tau)$ and the powers in $\tau$ are correct? I am sorry but I am still confused given the requirement that one of the distros must be a Gamma distribution, they both look like normal distributions and effectively the same to me :/ Sorry for the confusion. $\endgroup$
    – CandiCC99
    Commented Mar 30, 2020 at 13:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.