Skip to contents

Adds a transit absorption delay evaluated with the transit() pseudo-function instead of explicit compartments. The delay is parameterized by an estimated mean transit time mtt and transit rate Ktr; the implied number of transit compartments is Mtt * Ktr - 1.

Usage

addTransitAnalytic(
  ui,
  central = "central",
  depot = "depot",
  ka = "ka",
  transit = "transit",
  ktr = "ktr",
  mtt = "Mtt",
  Ktr = "Ktr",
  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

transit

the transit compartment prefix of an explicit chain, removed (with a warning) when present

ktr

the transit rate variable of an explicit chain, used for that removal

mtt

mean transit time variable name

Ktr

transit rate variable name

model

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

Value

a model with analytic transit absorption

Details

Dosing records stay on depot. The model gains transit(Mtt * Ktr - 1, Mtt), which adds the amount that has traversed the transit chain at each solve time, plus a transitDose(depot) directive. The directive makes etTrans() translate bolus records on depot to phantom doses: the record's amount drives transit() but is not added to the depot state, so ordinary dosing records need no evid = 7. ka then drains the depot into central as usual.

This is the analytic sibling of addTransit(), which builds one ODE state per transit compartment and estimates ktr; both forms are supported. removeTransitAnalytic() undoes this function.

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)
  })
}

pk1cmtDes |> addTransitAnalytic()
#>  
#>  
#> ℹ 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   lMtt   lKtr 
#>   0.45   1.00   3.45   0.50   0.10   0.10 
#> 
#> 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)")
#>         lMtt <- 0.1
#>         label("Mean transit time (Mtt)")
#>         lKtr <- 0.1
#>         label("Transit rate (Ktr)")
#>     })
#>     model({
#>         Ktr <- exp(lKtr)
#>         Mtt <- exp(lMtt)
#>         ka <- exp(lka)
#>         cl <- exp(lcl)
#>         vc <- exp(lvc)
#>         kel <- cl/vc
#>         d/dt(depot) <- transit(Mtt * Ktr - 1, Mtt) + -ka * depot
#>         transitDose(depot)
#>         d/dt(central) <- ka * depot - kel * central
#>         Cc <- central/vc
#>         Cc ~ prop(propSd)
#>     })
#> }