hallowkm / RxODE

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

Coding zero order absorption or lag time #18

Open amitvtaneja opened 6 years ago

amitvtaneja commented 6 years ago

Hello

How can zero order abrosrption or lag time be coded in RxODE. In NONMEM these can be specified as thetas. Is there a way to do this in RxODE?

Thanks in advance

Amit Taneja

wwang-at-github commented 6 years ago

Hi Amit:

Below is an example of 0-order absorption with lag.

Best, Wenping

library(RxODE) ode <- " C2 = centr/V2; C3 = peri/V3; d/dt(depot) =-KAdepot; d/dt(centr) = KAdepot - CLC2 - QC2 + QC3; d/dt(peri) = QC2 - QC3; d/dt(eff) = Kin - Kout(1-C2/(EC50+C2))*eff; " m1 <- RxODE(model = ode, modName = "m1")

system parameters

theta <- c(KA=2.94E-01, CL=1.86E+01, V2=4.02E+01, # central Q=1.05E+01, V3=2.97E+02, # peripheral Kin=1, Kout=1, EC50=200) # effects

init values

inits <- c(0, 0, 0, 1)

simulation & plot

simu_plot = function() { x <- m1$run(theta, ev, inits) matplot(x[,"C2"], type="l") }

0-order absorption with a lag time=2

ev <- eventTable() ev$add.dosing( dose=10000, nbr.doses=5, dosing.to=1, rate=5000, start.time=2, dosing.interval = 24 ) ev$add.sampling(0:120) simu_plot()

head(ev$get.EventTable(), 20) time evid amt 122 0 0 NA 210 1 0 NA 1 2 10101 5000 310 2 0 NA 410 3 0 NA 6 4 10101 -5000 510 4 0 NA 610 5 0 NA 710 6 0 NA 810 7 0 NA 910 8 0 NA 1010 9 0 NA 11 10 0 NA 12 11 0 NA 13 12 0 NA x <- m1$run(theta, ev, inits) head(x) time depot centr peri eff C2 C3 [1,] 0 0.000 0.0000 0.00000 1.000000 0.00000 0.0000000 [2,] 1 0.000 0.0000 0.00000 1.000000 0.00000 0.0000000 [3,] 2 0.000 0.0000 0.00000 1.000000 0.00000 0.0000000 [4,] 3 4332.032 529.6767 49.60395 1.018089 13.17604 0.1670167 [5,] 4 7560.594 1562.0282 312.68505 1.087570 38.85642 1.0528116 [6,] 5 5634.734 2118.2943 794.59232 1.173531 52.69389 2.6753950

On Sun, Feb 25, 2018 at 8:29 AM, amitvtaneja notifications@github.com wrote:

Hello

How can zero order abrosrption or lag time be coded in RxODE. In NONMEM these can be specified as thetas. Is there a way to do this in RxODE?

Thanks in advance

Amit Taneja

— 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/18, or mute the thread https://github.com/notifications/unsubscribe-auth/AMdZdtkw55sajbGIyVVbtkzUog6tmRGMks5tYWAigaJpZM4SSS4n .