Weekly hours spent on homework for students sampled from eight different schools. Obtain posterior distributions for the true means for the eight different schools using a hierarchical normal model with the following prior parameters:
µ0 = 7 , (γ0)^2= 5, (τ0)^2= 10, η0= 2, (σ0)^2 = 15, ν0= 2.
a) Run a Gibbs sampling algorithm to approximate the posterior distribution of {θ,σ2, µ, τ^2}. Assess the convergence of the Markov chain, and ?nd the effective sample size for {σ^2, µ, τ^2}. Run the chain long enough so that the effective sample sizes are all above 1,000.
b) Compute posterior means and 95% con?dence regions for {σ^2, µ, τ^2}. Also, compare the posterior densities to the prior densities, and discuss what was learned from the data.
c) Plot the posterior density of R =(τ^2)/(σ^2+τ^2) and compare it to a plot of the prior density of R. Describe the evidence for between-school variation.
d) Obtain the posterior probability that θ7 is smaller than θ6, as well as the posterior probability that θ7 is the smallest of all the θ's.
e) Plot the sample averages ¯y1,...,y¯8 against the posterior expectations of θ1,...,θ8, and describe the relationship. Also compute the sample mean of all observations and compare it to the posterior mean of µ.