# Bayesian hierarchical model - exercise

I have to solve a bayesian statistics problem like a follows

$$y_i$$ distr as $$Bin(n_i, \theta_i)$$ conditional on $$\theta_i$$

I observe several $$n_i$$ and $$y_i$$ and I’m interested in $$\pi(\theta_i|y)$$ for any $$i$$

Moreover I know that $$logit(\theta_i)= \alpha_i$$ and

$$\alpha_i$$ distr $$N(\mu, \sigma^2)$$

Moreover $$\mu$$ and $$\sigma^2$$ are not constant but r.vs. themselves (hierarchical model). The prior $$\pi(\mu, \sigma^2)$$ is proportional to $$1/ \sigma^2$$

It seem me that the main trick here is to discover the distribution of $$\alpha_i$$ given $$y_i$$ that probably have no usual form. So we have to simulate from it with MCMC procedure. So we have a chain for $$\alpha_i$$ and is easy to compute the related chain for $$\theta_i$$, so we have the posterior distribution of interest.

Is the correct procedure? What is the distribution/kernel for $$\alpha_i$$ given $$y_i$$ ?

• It may be easier to see the dependencies if you write the model in the usual levels form: top=likelihood, following lines=priors. This would help you to see the logical dependencies between the levels. – ping Aug 6 '20 at 10:16