Skip to contents

To add transit compartments to the model

Usage

addTransit(
  model,
  transit,
  central = "central",
  depot = "depot",
  transitComp = "transit",
  ktr = "ktr"
)

Arguments

model

The model as a function

transit

the number of transit compartments to be added

central

a character vector representing the central compartment

depot

a character vector representing the depot compartment

transitComp

the transit compartment prefix

ktr

the parameter name for the transit compartment rate

Value

a model with transit compartment added

Examples

readModelDb("PK_1cmt_des") |>
  addTransit(3)
#>  
#>  
#>  promote `lktr` to population parameter with initial estimate 0.05
#>  change initial estimate of `lktr` to `0.05`
#>  ── rxode2-based free-form 5-cmt ODE model ────────────────────────────────────── 
#>  ── Initalization: ──  
#> Fixed Effects ($theta): 
#>    lka    lcl    lvc propSd   lktr 
#>   0.45   1.00   3.45   0.50   0.05 
#> 
#> States ($state or $stateDf): 
#>   Compartment Number Compartment Name
#> 1                  1            depot
#> 2                  2         transit1
#> 3                  3         transit2
#> 4                  4         transit3
#> 5                  5          central
#>  ── Model (Normalized Syntax): ── 
#> function() {
#>     description <- "One compartment PK model with linear clearance using differential equations"
#>     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)")
#>         lktr <- 0.05
#>     })
#>     model({
#>         ktr <- exp(lktr)
#>         ka <- exp(lka)
#>         cl <- exp(lcl)
#>         vc <- exp(lvc)
#>         kel <- cl/vc
#>         d/dt(depot) <- -ka * depot
#>         d/dt(transit1) <- ka * depot - ktr * transit1
#>         d/dt(transit2) <- ktr * transit1 - ktr * transit2
#>         d/dt(transit3) <- ktr * transit2 - ktr * transit3
#>         d/dt(central) <- ktr * transit3 - kel * central
#>         Cc <- central/vc
#>         Cc ~ prop(propSd)
#>     })
#> }