Feed a posterior as an input random variable in another model

Hi,
I’d like to ask a question about how to define a posterior inferred in model_1 as an input random variable in model_2.
This might be pretty simple, but I don’t know how.

For example, a parameter “a” is estimated in model_1.
Then, I’d like to use the posterior “a” estimated from model_1 as the input random variable in model_2, where another parameters b and c are estimated (“a” is not estimated but it is an input of model_2).
In this case, how can I define posterior “a” as a random variable in model_2?

Should I conduct a kernel density estimation that approximates the posterior of “a” and then define it in model_2 using a built-in distribution in PyMC3?
Or is there a direct method that enables users to use inferred posteriors as a prior in another model without approximating a posterior to a built-in distribution in PyMC3?

Thank you in advance.

My understanding is that constructing the KDE of the approximated posterior of a is a (the?) conventional approach in these cases. An example is illustrated here. Alternatively, you could consider fusing the two models into a single, overarching model which will allow you to pipe model 1’s parameter a directly into/through model 2. The only way that I know of to use samples directly as a prior (that I am aware of) is in the context of approximate Bayesian computation, though I’m not sure pymc3’s ABC interface (which is under heavy development, FYI) allows for that in any simple manner.

2 Likes