as.model {rxode2} | R Documentation |
Turn into a model expression
Description
Turn into a model expression
Usage
as.model(x)
## S3 method for class 'character'
as.model(x)
## S3 method for class 'call'
as.model(x)
## S3 method for class 'list'
as.model(x)
## Default S3 method:
as.model(x)
Arguments
x |
item to convert to a |
Value
model expression
Author(s)
Matthew L. Fidler
Examples
model <- quote(model({
ka <- exp(tka + eta.ka)
cl <- exp(tcl + eta.cl)
v <- exp(tv + eta.v)
d/dt(depot) = -ka * depot
d/dt(center) = ka * depot - cl / v * center
cp = center / v
cp ~ add(add.sd)
}))
as.model(model)
one.compartment <- function() {
ini({
tka <- log(1.57)
tcl <- log(2.72)
tv <- log(31.5)
eta.ka ~ 0.6
eta.cl ~ 0.3
eta.v ~ 0.1
add.sd <- 0.7
})
model({
ka <- exp(tka + eta.ka)
cl <- exp(tcl + eta.cl)
v <- exp(tv + eta.v)
d/dt(depot) = -ka * depot
d/dt(center) = ka * depot - cl / v * center
cp = center / v
cp ~ add(add.sd)
})
}
as.model(one.compartment)
ui <- one.compartment()
as.model(ui)
model <- c("model({",
"ka <- exp(tka + eta.ka)",
"cl <- exp(tcl + eta.cl)",
"v <- exp(tv + eta.v)",
"d/dt(depot) = -ka * depot",
"d/dt(center) = ka * depot - cl / v * center",
"cp = center / v",
"cp ~ add(add.sd)",
"})")
as.model(model)
model <- paste(model, collapse="\n")
as.model(model)
[Package rxode2 version 2.1.3 Index]