| odeToLin | R Documentation |
Detects whether a model's ODE equations form a standard 1-3 compartment PK
system and, if so, replaces the d/dt() equations and the central
output assignment (e.g. cp <- central/v) with cp <- linCmt(),
preserving all other model lines. Detection requires linear ODE
right-hand sides, 1-4 compartments in a standard depot/central/peripheral
topology, and one output line of the form var <- central_cmt / v_expr.
Named parameter assignments are retained so linCmt() can infer the
parameterization.
odeToLin(ui)
ui |
rxUi-like model object (function, rxUi, or anything accepted by
|
An rxUi model with ODE equations replaced by linCmt(), or
(with a message) the original model unchanged if conversion is not possible.
Matthew Fidler
linToOde for the inverse transformation.
oneCmtOde <- function() {
ini({
tka <- 0.45
tcl <- log(2.7)
tv <- 3.45
add.sd <- 0.7
})
model({
ka <- exp(tka)
cl <- exp(tcl)
v <- exp(tv)
d/dt(depot) <- -ka * depot
d/dt(central) <- ka * depot - cl/v * central
cp <- central / v
cp ~ add(add.sd)
})
}
linCmtModel <- odeToLin(oneCmtOde)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.