Skip to contents

Adds a parallel absorption path to a model that already has first-order absorption through depot, for Monolix-style double-absorption models: one dose record is split at translation time into two parallel inputs with a logit-parameterized F1 apportionment. The second path can itself be zero-order (type = "zero", Monolix's Tk02 modeled duration directly on the central compartment), first-order (type = "first", ka2, which adds depot2), or a first-order path behind a transit delay (delay = "transit"), with an optional lag. The transit delay is either an explicit compartment chain (transitType = "ode") or the analytic transit() input (transitType = "analytic"). When the first path is zero-order (addZeroOrderAbs()), only a first-order second path is available.

Usage

addSecondAbsorption(
  ui,
  type = c("first", "zero"),
  delay = c("none", "lag", "transit"),
  n = NULL,
  central = "central",
  depot = "depot",
  depot2 = "depot2",
  ka = "ka",
  ka2 = "ka2",
  tk0 = "tk0",
  mtt2 = "Mtt2",
  ktr2 = "Ktr2",
  transitType = c("ode", "analytic"),
  f1 = 0.7
)

Arguments

ui

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

type

second-path input type: "zero" for a zero-order input (Monolix's Tk02: a modeled duration dur(central) on the central compartment) or "first" for a first-order (ka2) input. A zero-order second path is only available when the first path is first-order (two modeled durations cannot share the central compartment).

delay

second-path delay: "none", "lag" (an alag on the second path), or "transit" (a transit delay before the second path). "transit" needs a first-order second path.

n

number of transit compartments when delay = "transit"

central

central compartment name

depot

depot compartment name

depot2

name of the second depot compartment

ka

absorption rate parameter name

ka2

name of the second first-order absorption rate

tk0

name of the zero-order duration on the second path

mtt2

mean transit time variable of the analytic second-path transit delay

ktr2

transit rate variable of the analytic second-path transit delay

transitType

how a transit delay is built: "ode" (the default) adds one ODE state per transit compartment (see addTransit()); "analytic" evaluates the delay with the transit() pseudo-function from mtt2/ktr2 and marks depot2 with transitDose() (see addTransitAnalytic()). The two forms solve the same profile.

f1

initial fraction of the dose entering the first path, in (0,1)

Value

a model with two parallel absorption paths

Details

Only one second absorption path is supported per model; applying this twice raises an error.

Author

Matthew L. Fidler

Examples

pk1cmtDes <- function() {
  ini({
    lka <- 0.45; label("Absorption rate (Ka)")
    lcl <- 1; label("Clearance (CL)")
    lvc <- 3.45; label("Central volume of distribution (V)")
    propSd <- 0.5; label("Proportional residual error (fraction)")
  })
  model({
    ka <- exp(lka)
    cl <- exp(lcl)
    vc <- exp(lvc)
    kel <- cl / vc
    d/dt(depot) <- -ka * depot
    d/dt(central) <- ka * depot - kel * central
    Cc <- central / vc
    Cc ~ prop(propSd)
  })
}


# simultaneous first-order + first-order (Monolix oral1_oral1)
pk1cmtDes |>
  addSecondAbsorption(type = "first", delay = "lag", f1 = 0.7)
#>  
#>  
#> ℹ 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): 
#>         lka         lcl         lvc      propSd        lka2  llagDepot2 
#>   0.4500000   1.0000000   3.4500000   0.5000000   0.1000000   0.1000000 
#> logitfDepot 
#>   0.8472979 
#> 
#> States ($state or $stateDf): 
#>   Compartment Number Compartment Name
#> 1                  1            depot
#> 2                  2           depot2
#> 3                  3          central
#>  ── Model (Normalized Syntax): ── 
#> function() {
#>     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)")
#>         lka2 <- 0.1
#>         label("First order absorption rate (ka2)")
#>         llagDepot2 <- 0.1
#>         logitfDepot <- 0.847297860387203
#>         label("Fraction of dose absorbed from depot (fDepot)")
#>     })
#>     model({
#>         fDepot <- expit(logitfDepot, 0, 1)
#>         lagDepot2 <- exp(llagDepot2)
#>         ka <- exp(lka)
#>         cl <- exp(lcl)
#>         vc <- exp(lvc)
#>         kel <- cl/vc
#>         splitInfusionBolus(depot, depot, depot2)
#>         d/dt(depot) <- -ka * depot
#>         f(depot) <- fDepot
#>         ka2 <- exp(lka2)
#>         d/dt(depot2) <- -ka2 * depot2
#>         f(depot2) <- 1 - fDepot
#>         lag(depot2) <- lagDepot2
#>         d/dt(central) <- ka * depot - kel * central + ka2 * depot2
#>         Cc <- central/vc
#>         Cc ~ prop(propSd)
#>     })
#> }

# simultaneous zero-order + first-order (Monolix oral0_oral1:
# Tk02 as dur(central), F1 on the first-order depot)
pk1cmtDes |>
  addSecondAbsorption(type = "zero", f1 = 0.5)
#>  
#>  
#> ℹ 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 2-cmt ODE model ────────────────────────────────────── 
#>  ── Initalization: ──  
#> Fixed Effects ($theta): 
#>         lka         lcl         lvc      propSd        ltk0 logitfDepot 
#>        0.45        1.00        3.45        0.50        0.10        0.00 
#> 
#> States ($state or $stateDf): 
#>   Compartment Number Compartment Name
#> 1                  1            depot
#> 2                  2          central
#>  ── Model (Normalized Syntax): ── 
#> function() {
#>     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)")
#>         ltk0 <- 0.1
#>         label("Zero-order absorption duration on the second path (Tk0)")
#>         logitfDepot <- 0
#>         label("Fraction of dose absorbed from depot (fDepot)")
#>     })
#>     model({
#>         fDepot <- expit(logitfDepot, 0, 1)
#>         tk0 <- exp(ltk0)
#>         ka <- exp(lka)
#>         cl <- exp(lcl)
#>         vc <- exp(lvc)
#>         kel <- cl/vc
#>         splitInfusionBolus(depot, central, depot)
#>         d/dt(depot) <- -ka * depot
#>         f(depot) <- fDepot
#>         d/dt(central) <- ka * depot - kel * central
#>         f(central) <- 1 - fDepot
#>         dur(central) <- tk0
#>         Cc <- central/vc
#>         Cc ~ prop(propSd)
#>     })
#> }