hallowkm / RxODE

RxODE is an R package that facilitates easy simulations in R
20 stars 13 forks source link

RxODE and Berkeley Madonna gave different simulation results #15

Open UNCcrawler opened 7 years ago

UNCcrawler commented 7 years ago

Hi, has anyone noticed that RxODE and Berkeley gave different simulation results? Apparently, they use different stiff ode solvers. RxODE uses LSODA, and Berkeley uses Rosenbrock. I also noticed that the time step for RxODE is fixed to integer? I don't know the root reason and would like to know if this is specific to my case. Thanks.

Sibojang9 commented 7 years ago

That is really a good question but I haven't found any noticeable difference.

mattfidler commented 7 years ago

In theory, all ode solvers will give the correct solution, but in practice that may not be true, especially in stiff systems. LSODA allows switching between stiff and non-stiff.

I'm not sure what you mean by "the time step is fixed to an integer". Could you please explain?

Also the development of RxODE has moved to:

https://github.com/nlmixrdevelopment/RxODE

UNCcrawler commented 6 years ago

Thank you for the comments. I am a new user of R. I soon realized that the time step was set by me to be integers in $add.sampling and also realized that $add.sampling was the output time, not the actual time step in the solver. But I still have the simulation problem. I have a complex model, which has several stiff functions. I found the reason for RxODE gave different simulation results is that few variables were not changed and remained as the initial values. I couldn't figure out the reason why these variables were not changed. I greatly appreciate any suggestions. The ode equations were copied from Berkeley code, so the equations should be correct. I am using RxODE because it is easier to code complex dosing regimens and it can be coupled with ggplot. Thank you for developing such a great simulation tool.

UNCcrawler commented 6 years ago

Update: The initial values I mentioned above is 0. RxODE was running properly, but the returned results were small and therefore 0. I think the problem that RxODE and Berkerley gave different results is due to the ODE solver. I have multiple stiff equations. I will try to use calcJac=TRUE.

wwang-at-github commented 6 years ago

no, that can't be the case. the default option with rxode is stiff=T, hence using lsoda to solve the system.

i think you have other errors in your code.

On Tue, Mar 13, 2018 at 1:56 PM, UNCcrawler notifications@github.com wrote:

Update: The initial values I mentioned above is 0. RxODE was running properly, but the returned results were small and therefore 0. I think the problem that RxODE and Berkerley gave different results is due to the ODE solver. I have multiple stiff equations. I will try to use calcJac=TRUE.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/hallowkm/RxODE/issues/15#issuecomment-372759750, or mute the thread https://github.com/notifications/unsubscribe-auth/AMdZdsDpNznI0hiDBMHtnBeqKJNHjGBWks5teAg8gaJpZM4OxLNT .

UNCcrawler commented 6 years ago

Hi, thanks for your reply. I did set stiff = T. The equations were copied from Berkeley code. Except the settings for initials, I didn't find any difference. The dosing regimen is IV bolus, so I set initial in Berkeley as dose/volume and in RxODE as 0. The drug I am trying to simulate shows dose-dependent clearance. RxODE simulation results had no such traits, so I feel something is wrong with my RxODE simulation. I haven't tried calcJac = TRUE due to a installation problem with SnakecharmR.

Which part of the code would you suggest me to double-check? Any suggestions would be greatly appreciated.

On Tue, Mar 13, 2018 at 7:58 PM, wwang-at-github notifications@github.com wrote:

no, that can't be the case. the default option with rxode is stiff=T, hence using lsoda to solve the system.

i think you have other errors in your code.

On Tue, Mar 13, 2018 at 1:56 PM, UNCcrawler notifications@github.com wrote:

Update: The initial values I mentioned above is 0. RxODE was running properly, but the returned results were small and therefore 0. I think the problem that RxODE and Berkerley gave different results is due to the ODE solver. I have multiple stiff equations. I will try to use calcJac=TRUE.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/hallowkm/RxODE/issues/15#issuecomment-372759750, or mute the thread https://github.com/notifications/unsubscribe-auth/ AMdZdsDpNznI0hiDBMHtnBeqKJNHjGBWks5teAg8gaJpZM4OxLNT .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hallowkm/RxODE/issues/15#issuecomment-372859313, or mute the thread https://github.com/notifications/unsubscribe-auth/AcXgXsdQTmhY66xYATg1AMeyCf3XU2Erks5teF1CgaJpZM4OxLNT .

wwang-at-github commented 6 years ago

share your code then

UNCcrawler commented 6 years ago

If possible, can I share the code with you in private?

wwang-at-github commented 6 years ago

sure. wwang8198@gmail.com

On Wed, Mar 14, 2018 at 2:32 PM, UNCcrawler notifications@github.com wrote:

If possible, can I share the code with you in private?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/hallowkm/RxODE/issues/15#issuecomment-373129281, or mute the thread https://github.com/notifications/unsubscribe-auth/AMdZdlAS7O1tE9xjo7WaqZ_Yzme_qgm-ks5teWJHgaJpZM4OxLNT .