Creates an rxode2 object from a model (either rxode2 function or a NONMEM file)
Arguments
- type
Type of supplied model can be "rxode2", "NONMEM"
- model
List containing the relevant information about the model. This will depend on the model types.
rxode2: The supplied model is in the rxode2 format.
fcn_def: Character string containing function definition.
fcn_obj: Name of the funciton object created in
fcn_def
.
NONMEM: The supplied model is in NONMEM format (either a control
model_file: Character string containing the NONMEM model file.
Value
Results of FM_tc()
when running the model. This will include
a field isgood
which is a boolean variable indicating success or
failure. See the documentation for FM_tc()
for the format returned
when evaluation results in a failure and how to address those. When
successful the capture
field will contain the following:
fcn_obj: The function name.
rx_obj: The built rxode2 object.
Examples
fcn_def = ' my_func = function ()
{
description <- "One compartment PK model with linear clearance"
ini({
lka <- 0.45
label("Absorption rate (Ka)")
lcl <- 1
label("Clearance (CL)")
lvc <- 3.45
label("Central volume of distribution (V)")
propSd <- c(0, 0.5)
label("Proportional residual error (fraction)")
})
model({
ka <- exp(lka)
cl <- exp(lcl)
vc <- exp(lvc)
cp <- linCmt()
cp ~ prop(propSd)
})
}'
fcn_obj = "my_func"
model = list(fcn_def = fcn_def,
fcn_obj = fcn_obj)
rx_res = mk_rx_obj("rxode2", model)
#>
#>
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments
# function object
rx_res[["capture"]][["fcn_obj"]]
#> function ()
#> {
#> description <- "One compartment PK model with linear clearance"
#> ini({
#> lka <- 0.45
#> label("Absorption rate (Ka)")
#> lcl <- 1
#> label("Clearance (CL)")
#> lvc <- 3.45
#> label("Central volume of distribution (V)")
#> propSd <- c(0, 0.5)
#> label("Proportional residual error (fraction)")
#> })
#> model({
#> ka <- exp(lka)
#> cl <- exp(lcl)
#> vc <- exp(lvc)
#> cp <- linCmt()
#> cp ~ prop(propSd)
#> })
#> }
#> <environment: 0x138ebd0b8>
# rxode2 object
rx_res[["capture"]][["rx_obj"]]
#> ── rxode2-based solved PK 1-compartment model with first-order absorption ──────
#> ── Initalization: ──
#> Fixed Effects ($theta):
#> lka lcl lvc propSd
#> 0.45 1.00 3.45 0.50
#> ── Model (Normalized Syntax): ──
#> function() {
#> description <- "One compartment PK model with linear clearance"
#> ini({
#> lka <- 0.45
#> label("Absorption rate (Ka)")
#> lcl <- 1
#> label("Clearance (CL)")
#> lvc <- 3.45
#> label("Central volume of distribution (V)")
#> propSd <- c(0, 0.5)
#> label("Proportional residual error (fraction)")
#> })
#> model({
#> ka <- exp(lka)
#> cl <- exp(lcl)
#> vc <- exp(lvc)
#> cp <- linCmt()
#> cp ~ prop(propSd)
#> })
#> }