Skip to contents

To convert from Infusion/intravenous administration to first order oral absorption

Usage

addDepot(
  model,
  central = "central",
  depot = "depot",
  absRate = "ka",
  lag = FALSE,
  tlag = "lagD"
)

Arguments

model

The model as a function

central

central compartment name

depot

depot name

absRate

absorption rate

lag

A boolean representing if you are going to add a lag to this compartment

tlag

a character vector representing the lag time

Value

a model with the depot added

Examples

# most of the examples in the model library already have a depot.
# for this example we will remove the depot and then add it back
readModelDb("PK_1cmt_des") |>
  removeDepot() |>
  addDepot()
#>  
#>  
#> ! remove population parameter `lka`
#>  promote `lka` to population parameter with initial estimate 0.02
#>  change initial estimate of `lka` to `0.02`
#>  promote `lfdepot` to population parameter with initial estimate 0.04
#>  change initial estimate of `lfdepot` to `0.04`
#>  ── rxode2-based free-form 2-cmt ODE model ────────────────────────────────────── 
#>  ── Initalization: ──  
#> Fixed Effects ($theta): 
#>     lka     lcl     lvc  propSd lfdepot 
#>    0.02    1.00    3.45    0.50    0.04 
#> 
#> States ($state or $stateDf): 
#>   Compartment Number Compartment Name
#> 1                  1            depot
#> 2                  2          central
#>  ── Model (Normalized Syntax): ── 
#> function() {
#>     description <- "One compartment PK model with linear clearance using differential equations"
#>     ini({
#>         lka <- 0.02
#>         label("First order 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)")
#>         lfdepot <- 0.04
#>         label("Bioavailability (F)")
#>     })
#>     model({
#>         ka <- exp(lka)
#>         fdepot <- exp(lfdepot)
#>         cl <- exp(lcl)
#>         vc <- exp(lvc)
#>         kel <- cl/vc
#>         d/dt(depot) <- -ka * depot
#>         f(depot) <- fdepot
#>         d/dt(central) <- ka * depot + -kel * central
#>         Cc <- central/vc
#>         Cc ~ prop(propSd)
#>     })
#> }