Q2
This question may be typed, or hand written and submitted as a pdf.
The aim of this question is to learn how to implement a Gibbs sampler on a Bayesian model
for the number of days absent of high school students. The model will describe individual
students with index $i$ and link all students with hyper-parameter $\beta$.
Consider the model
$x_i | \theta_i, \beta \sim \text{Po}(\theta_i)$ independently for $i = 1, 2, \dots, n$;
$\theta_i | \beta \sim \text{Exp}(\beta)$ independently for $i = 1, 2, \dots, n$;
$\beta \sim p(\beta) \propto 1/\beta$
a) Use the factorisation of Bayes law
$p(\theta, \beta | x) \propto p(x | \theta, \beta)p(\theta | \beta)p(\beta)$
to obtain an expression for the joint posterior density, $p(\theta, \beta | x)$, up to a constant of proportionality.
[2 marks]
b) Show that the $\theta_1, \theta_2, \dots, \theta_n$ are independent in the conditional posterior density, $p(\theta | \beta, x)$ and calculate
$p(\theta_i | \beta, x)$.
[2 marks]
c) Hence, state the conditional posterior for
$\theta_i | \theta_1, \dots, \theta_{i-1}, \theta_{i+1}, \dots, \theta_n, \beta, x$.
[2 marks]