Skip to contents

This extracts the solved linear compartment model(s) from a model and returns them as micro-constants (k, k12, k21, k13, k31), the central volume v and the absorption rate ka, each as an R expression in terms of the model variables. This is useful for translating a linCmt() model to software that has its own closed-form linear compartment solutions (like NONMEM's ADVAN1-4, ADVAN11-12 or Monolix's pkmodel()).

Usage

linCmtMicro(ui)

Arguments

ui

rxUi-like model object

Value

A list with one element per linear compartment system (endpoints that share the same linCmt(), like conditional linCmt() ~ ... | cond endpoints, share one element). Each element is a list with ncmt (number of compartments), oral0 (1 when there is a depot compartment, 0 otherwise), and the expressions ka, v, k, k12, k21, k13 and k31. ka is 0 for a model without a depot, and the transfer rates a model does not have (like k13 and k31 for 2 compartments) are NULL. A model without linCmt() returns an empty list.

Author

Matthew L. Fidler

Examples


oneCmt <- function() {
  ini({
    tka <- 0.45
    tcl <- log(2.7)
    tv <- 3.45
    add.sd <- 0.7
  })
  model({
    ka <- exp(tka)
    cl <- exp(tcl)
    v <- exp(tv)
    cp <- linCmt()
    cp ~ add(add.sd)
  })
}

linCmtMicro(oneCmt)
#>  
#>  
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments
#> [[1]]
#> [[1]]$ncmt
#> [1] 1
#> 
#> [[1]]$oral0
#> [1] 1
#> 
#> [[1]]$ka
#> ka
#> 
#> [[1]]$v
#> v
#> 
#> [[1]]$k
#> cl/v
#> 
#>