# Problem using previous samples to new inference in new model context

**URL:** <https://discourse.pymc.io/t/problem-using-previous-samples-to-new-inference-in-new-model-context/14711>\
**Category:** v5\
**Created:** [July 1, 2024, 8:50pm UTC](https://discourse.pymc.io/t/problem-using-previous-samples-to-new-inference-in-new-model-context/14711 "2024-07-01T20:50:53Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![iavicenna](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/iavicenna/32/7923_2.png) [@iavicenna](https://discourse.pymc.io/u/iavicenna)\
**Post date:** [July 3, 2024, 7:29am UTC](https://discourse.pymc.io/t/problem-using-previous-samples-to-new-inference-in-new-model-context/14711/5 "2024-07-03T07:29:10Z")

</div>

There are some topics where I think this was discussed extensively. I am aware of the following two for instance:

> [@How best to use a posterior sample as a prior for a future integration in another model?](https://discourse.pymc.io/t/how-best-to-use-a-posterior-sample-as-a-prior-for-a-future-integration-in-another-model/8650/13):
>
> PS: I actually just tried the example above (well I had to fixed a few typos), with the lastest 5.12.0 pymc version, and it does not work (shape mismatch). Looking at the latest doc, and the shapes in the error message, it is clear that it cannot work because pmx.distributions.histogram\_approximation operates on the first dimension only → it returns univariate histograms for each obs. It does not account for correlations. The issue is probably best described with [copulas](https://www.pymc.io/projects/examples/en/latest/howto/copula-estimation.html). However, the linked no…

> [@How to use the posterior distribution of one model as a prior distribution for another model](https://discourse.pymc.io/t/how-to-use-the-posterior-distribution-of-one-model-as-a-prior-distribution-for-another-model/13956/10):
>
> @ferrine implemented prior\_from\_idata, perhaps he could help

I think in both cases, the discussion is around how to build a distribution that approximates best the posterior sampled from the “previous model” so that it can be used as the prior for another model and train on new data with those priors from posteriors. And it will rely on certain assumptions sometimes about the shape of the posterior (for instance that it is sufficiently normal etc). If posteriors for A\_ and B\_ don’t seem to be correlated, you could perhaps simply model them as pair of normals with estimated mean and sd of the posterior sample. Note however in your new model A\_ and B\_ will also be updated to new posteriors with the presence of new data.

---

_[View the full topic](https://discourse.pymc.io/t/problem-using-previous-samples-to-new-inference-in-new-model-context/14711)._
