Skip to contents

Replaces the transit rate ktr <- exp(lktr) of a transit chain with the mean-transit-time form Monolix uses: Mtt <- exp(lMtt) and ktr <- (n+1)/Mtt, where n is the number of transit compartments. The estimated parameter becomes the mean transit time, and the initial estimate is converted so the model is unchanged at the starting point. The chain rate expression keeps ktr as its name, so the rest of the model is untouched.

Usage

convertTransitMtt(ui, transit = "transit", ktr = "ktr", mtt = "Mtt")

Arguments

ui

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

transit

the transit compartment prefix ("transit" for the first path, "transitB" for a second path added by addSecondAbsorption())

ktr

the transit rate variable name

mtt

the mean transit time variable name

Value

a model with the transit chain parameterized by mtt

Details

The number of transit compartments is counted from the model, so the chain must already be present (see addTransit() and addSecondAbsorption()).

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 |> addTransit(3) |> convertTransitMtt()
#>  
#>  
#> ℹ 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 5-cmt ODE model ────────────────────────────────────── 
#>  ── Initalization: ──  
#> Fixed Effects ($theta): 
#>      lka      lcl      lvc   propSd     lMtt 
#> 0.450000 1.000000 3.450000 0.500000 1.286294 
#> 
#> 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() {
#>     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 <- 1.28629436111989
#>         label("Mean transit time (Mtt)")
#>     })
#>     model({
#>         ka <- exp(lka)
#>         cl <- exp(lcl)
#>         vc <- exp(lvc)
#>         kel <- cl/vc
#>         Mtt <- exp(lMtt)
#>         ktr <- (3 + 1)/Mtt
#>         d/dt(depot) <- -ktr * depot
#>         d/dt(transit1) <- ktr * depot - ktr * transit1
#>         d/dt(transit2) <- ktr * transit1 - ktr * transit2
#>         d/dt(transit3) <- ktr * transit2 - ka * transit3
#>         d/dt(central) <- ka * transit3 - kel * central
#>         Cc <- central/vc
#>         Cc ~ prop(propSd)
#>     })
#> }