FelicienLL / mapbayr

Easy Maximum A Posteriori Bayesian Estimation of PK parameters in R.
21 stars 2 forks source link

use_posterior() only works if the estimation is done with only one ID? #218

Open Martin-Umpierrez opened 8 months ago

Martin-Umpierrez commented 8 months ago

Dear Felicien,

I would like to inquire about the use_posterior() function. I've been attempting to run estimation and simulation cycles for multiple IDs simultaneously with multiple OCCs. Specifically, I aim to estimate ETAs for the first OCC, then simulate the second OCC using these estimated ETAs and compare them with the true values. When utilizing the mapbayest() function, I encounter no issues in estimating multiple ETAs for multiple IDs. However, trouble arises when I attempt to use the use_posterior() function to simulate with the estimated ETAs for each ID. This results in errors.

To troubleshoot, I removed all IDs and worked with just one, repeating the process. Surprisingly, the problem was resolved, indicating that the issue does not lie with the data or the model itself. I also tried mutiple models and data set

Is it not feasible to achieve what I described? If not, do you have any alternative suggestions?

Thank you.

FelicienLL commented 8 months ago

Hi Martin, If you have n IDs, use_posterior() returns a list of n mrgsolve models, with the ETAs in $PARAM updated with the estimated values. Thus, you can simulate from each mrgsolve model. Would this explain your issue? I agree this is suboptimal. Modifications in most recent versions of mrgsolve would enable to modify mapbayr so that multiple IDs would be handle as you expected, but I have not implemented that yet.

Martin-Umpierrez commented 8 months ago

Felicien, thank you very much. I've managed to solve the problem I was having by splitting each of the models generated by use_posterior() and then assigning the corresponding treatment. Thank you very much again, and I remain attentive to the mentioned update.