Skip to contents

To convert from infusion/intravenous administration to first-order oral absorption

Usage

addDepot(ui, central = "central", depot = "depot", ka = "ka", model)

Arguments

ui

The model as a function (or something convertible to an rxUi object)

central

central compartment name

depot

depot compartment name

ka

absorption rate parameter name

model

Deprecated alias for ui. Supplying model instead of ui still works but emits a deprecation warning.

Value

a model with the depot added

Examples

pk2cmtNoDepot <- function() {
  ini({
    lcl <- 1; label("Clearance (CL)")
    lvc <- 3; label("Central volume of distribution (V)")
    lvp <- 5; label("Peripheral volume of distribution (Vp)")
    lq <- 0.1; label("Intercompartmental clearance (Q)")
    propSd <- 0.5; label("Proportional residual error (fraction)")
  })
  model({
    cl <- exp(lcl)
    vc <- exp(lvc)
    vp <- exp(lvp)
    q <- exp(lq)
    kel <- cl / vc
    k12 <- q / vc
    k21 <- q / vp
    d/dt(central) <- -kel * central - k12 * central + k21 * peripheral1
    d/dt(peripheral1) <- k12 * central - k21 * peripheral1
    Cc <- central / vc
    Cc ~ prop(propSd)
  })
}

# most of the examples in the model library already have a depot
# the PK_2cmt_no_depot is an exception
pk2cmtNoDepot |> addDepot()
#>  
#>  
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments
#>  ── rxode2-based free-form 3-cmt ODE model ────────────────────────────────────── 
#>  ── Initalization: ──  
#> Fixed Effects ($theta): 
#>    lcl    lvc    lvp     lq propSd    lka 
#>    1.0    3.0    5.0    0.1    0.5    0.1 
#> 
#> States ($state or $stateDf): 
#>   Compartment Number Compartment Name
#> 1                  1            depot
#> 2                  2          central
#> 3                  3      peripheral1
#>  ── Model (Normalized Syntax): ── 
#> function() {
#>     ini({
#>         lcl <- 1
#>         label("Clearance (CL)")
#>         lvc <- 3
#>         label("Central volume of distribution (V)")
#>         lvp <- 5
#>         label("Peripheral volume of distribution (Vp)")
#>         lq <- 0.1
#>         label("Intercompartmental clearance (Q)")
#>         propSd <- c(0, 0.5)
#>         label("Proportional residual error (fraction)")
#>         lka <- 0.1
#>         label("First order absorption rate (ka)")
#>     })
#>     model({
#>         cl <- exp(lcl)
#>         vc <- exp(lvc)
#>         vp <- exp(lvp)
#>         q <- exp(lq)
#>         kel <- cl/vc
#>         k12 <- q/vc
#>         k21 <- q/vp
#>         ka <- exp(lka)
#>         d/dt(depot) <- -ka * depot
#>         d/dt(central) <- -kel * central - k12 * central + k21 * 
#>             peripheral1 + ka * depot
#>         d/dt(peripheral1) <- k12 * central - k21 * peripheral1
#>         Cc <- central/vc
#>         Cc ~ prop(propSd)
#>     })
#> }