Hope the question isn't too naive.

I've been playing around with examples from Doing Bayesian Data Analysis by Kruschke, and in the Therapeutic Touch data section there's this multi-level model example which follows this structure.

enter image description here

I do understand the fact, that the higher level priors are based of off the data, but I do not understand how it's done.
I understand how MCMC algorithm works in sampling from the posterior based off the prior and likelihood, especially in "flat" structures, but I'm having a hard time wrapping my head around hierarchical model process.
The model above has uninformative priors. That is the omega param is initialized as beta distribution $\alpha=1$ and $\beta=1$, and kappa is also quite vague (mean=1 and sd=1), and the theta one is based of off both omega and kappa.
So yeah, how is a model, such as the one above, interpreted by JAGS or pymc3 in a way that it can create posterior distribution for each parameter (omega, kappa and theta) while their all dependent on each other?

I'm just having difficulty understanding how the omega (and kappa) parameter, which was initialized as an uninformative prior, changes it's shape depending on the result of theta, which is dependent on omega (and kappa) itself.


1 Answer 1


The posterior is

$$p(\omega,\theta,\kappa_2 | y) \propto p(\theta | \omega, \kappa_2) p(\omega)p(\kappa_2)f(\kappa_2,\omega,\theta; y)$$

Individual or marginal posterior can be obtained by integrating out other parameters, which in MCMC case, comes down to "ignoring" the other samples, and looking at one variable in isolation. Try to work out the math, and you'll see marginalizing is equivalent to "ignoring" the other variables (again, this is in the case that you are looking at samples/empirical distributions).

  • 1
    $\begingroup$ +1 i think this answer could stress more the fact that one is modelling with joint priors and ending up with joint posteriors, and then can read off marginalised posteriors for each parameter.. $\endgroup$
    – seanv507
    Sep 24, 2019 at 7:52

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.