# Updating the posteriors in the bayesian analysis

**URL:** <https://discourse.pumas.ai/t/updating-the-posteriors-in-the-bayesian-analysis/943>\
**Category:** bayesian\
**Created:** [September 21, 2023, 4:02pm UTC](https://discourse.pumas.ai/t/updating-the-posteriors-in-the-bayesian-analysis/943 "2023-09-21T16:02:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahmed.salem](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@ahmed.salem](https://discourse.pumas.ai/u/ahmed.salem)\
**Post date:** [September 21, 2023, 4:02pm UTC](https://discourse.pumas.ai/t/updating-the-posteriors-in-the-bayesian-analysis/943/1 "2023-09-21T16:02:42Z")

</div>

Hello, I developed a Bayesian PKPD model based using one data set. I collected another data set and I want to test the capability of the model to predict the new data set using two scenarios: 1- predicting the new data set using the parameters already estimated from the first data set (i.e. similar to using `predict` function for maximum likelihood estimation method or `BIONLY=1` in `$METHOD` of `NONMEM` which will create new samples of individual parameters only, but will keep the population parameters fixed.), 2- show a case study for updating the posteriors of PKPD parameters once new observations for certain patient are collected (ie therapeutic drug monitoring or dose individualization). I am aware that one possibility is to append the new data set (or observations) to the first data set and rerun the bayesian analysis. I am wondering if the new version of Pumas 2.4 has a more time efficient way. Thanks!

---

<div class="post-metadata">

**Author:** ![mohamed82008](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/mohamed82008/32/127_2.png) [@mohamed82008](https://discourse.pumas.ai/u/mohamed82008)\
**Post date:** [September 22, 2023, 12:12pm UTC](https://discourse.pumas.ai/t/updating-the-posteriors-in-the-bayesian-analysis/943/2 "2023-09-22T12:12:46Z")

</div>

> [@ahmed.salem](#):
>
> I am wondering if the new version of Pumas 2.4 has a more time efficient way.

It doesn’t. We currently have no way to update the individual parameters only but not the population parameters. It should be possible though, just not implemented. If you want to do future simulation/prediction, you can do that using

```julia
simobs (tres, new_subj, subject = i, samples = 100)

```

where `tres` is output from `fit` or `discard`, `new_subj` is the subject struct with future time points and `i`is the index of the subject in the population passed to fit.

An alternative approach if you only care about updating the individual paramters is to use the mean of the posterior of the population parameters and re-sample only the individual parameters of the subject with new data using MCMC. You can use `constantcoef` to fix the population parameters when using MCMC. To get the mean of the population parameters, use `Pumas.param_mean(tres)`.
