Description Usage Arguments Details Value Examples
Create a model function with gradient evaluation (and, optionally, Hessian evaluation) for a model according to the number of compartments, the form of administration and dosage of the drug after performing any substitutions given.
1 2 3 |
admin |
form of administration of the drug, one of
|
dosage |
type of dosage of the drug, one of
|
subst |
a list of formulas of substitutions to perform |
cpt |
scalar integer - the number of model compartments. |
hessian |
a logical value indicating whether the second derivatives should be calculated and incorporated in the return value. |
The substitutions are given as a list of formulas, such
as list(k ~ Cl/V, Cl ~ exp(lCl), V ~ exp(lV))
.
They are applied left to right.
a byte-compiled model function with gradient evaluation
1 2 |
function (dose, t, lCl, lV)
{
.expr1 <- exp(lCl)
.expr2 <- exp(lV)
.expr3 <- .expr1/.expr2
.expr6 <- exp(-.expr3 * t)
.expr7 <- dose * .expr6
.expr15 <- .expr2^2
.value <- .expr7/.expr2
.grad <- array(0, c(length(.value), 2L), list(NULL, c("lCl",
"lV")))
.grad[, "lCl"] <- -(dose * (.expr6 * (.expr3 * t))/.expr2)
.grad[, "lV"] <- dose * (.expr6 * (.expr1 * .expr2/.expr15 *
t))/.expr2 - .expr7 * .expr2/.expr15
attr(.value, "gradient") <- .grad
.value
}
<bytecode: 0x23b7e08>
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.