ode_nonmem | R Documentation |
Create a NONMEM code with a deSolve model.
ode_nonmem(func = Lorenz, parms = parameters, y = state,
output = "", add_param = "", mu_referencig = T, BLQ = F,
datafile = "", outputcat = T, ...)
func |
Function (same as deSolve in functions) |
parms |
Parameters (same as deSolve in functions) |
y |
same as the ode |
output |
vector of the output names. In case of several outputs, use the format c("name1 = X", "name2 = Y",...), with X/Y being the YTYPE number. |
add_param |
vector of parameter names to add, mostly usefull for adding baseline parameters. If it has the format "X1_0", with X1 being the name of a cmt, add it as a baseline for the concerned cmt. If the format is "Z = 21", add a new parameter with the name Z and initial value 21. |
mu_referencig |
booléen, declaration of parameters with/without mu referencing. |
datafile |
Either a .tab or an other cfl |
Thibaud Derippe
## Not run:
ODE<-function(t,y,p){
#parameters
V <- p[1]
k <- p[2]
k12 <- p[3]
k21 <- p[4]
k13 <- p[5]
k31 <- p[6]
ku <- p[7]
#--- ODE system - start ---#
A1 <- y[1]
A2 <- y[2]
A3 <- y[3]
A4 <- y[4]
yd1 <- k21 * A2 + k31 * A3 - k12 * A1 - k13 * A1 - k * A1 - ku * A1
yd2 <- k12 * A1 - k21 * A2
yd3 <- k13 * A1 - k31 * A3
yd4 <- ku * A1
Cc <- A1/V
#Output: list(c(initial conditions), c(output variable))
list(c(yd1, yd2, yd3, yd4),
c(Cc = A1/V, A_urine = y[4]))
}
params <- c(V = 3,
k = 0.281,
k12 = 0.467,
k21 = 6.23e-05,
k13 = 0.00666,
k31 = 0.116,
ku = 0.6)
dose <- 1.5 * 70 * 1000
init <- c(231, 0, 0, 0)
time <- seq(0, 24, 0.1)
out <- lsoda(y = eval(init), times = time, func = ODE, parms = params)
ode_nonmem( BLQ = T, add_param = "X1_0", output = c("A(1)/V = 1", "A(4) = 2") , y = init, times = time, func = ODE, parms = params, mu_referencig = T)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.