I am using PyMC, the probabilistic programming library of Python to implement a hierarchical bayesian model.
Consider a two-level Bayesian hierarchical model. Level-1 has a parameter m1 and level-2 has parameters m1 and n1. I want to infer m1 in the first level, and then use the entire inferred distribution of this parameter in the second level to infer just n1.
I do not want to use just the posterior mean of m1 after level-1 of inference, since that would be quite deterministic. Additionally, it will not propagate the uncertainty of parameter m1 into the second level. So my question is: What would be the recommended approach to do this in pymc?
So far from my limited understanding of pymc, what I can think of are:
- Shared variables
- Data containers
But both these seem to be intended for different purposes. Any comments on the issue or a recommendation of a better approach would be very helpful. Thanks to all the very nice people here.