Skip to content

Instantly share code, notes, and snippets.

@kylebaron
Created December 6, 2018 19:51
Show Gist options
  • Save kylebaron/074dc3f3e3a66b3715321b3915592628 to your computer and use it in GitHub Desktop.
Save kylebaron/074dc3f3e3a66b3715321b3915592628 to your computer and use it in GitHub Desktop.
Example Two Compartment With Infusion into Depot
library(mrgsolve)

mod <- mread("pk2", modlib())
#> Building pk2 ... done.

mod %>% 
  ev(amt  = 100, rate = 3) %>% 
  mrgsim(end = 48, delta = 0.1) %>% 
  plot

as.list(mod)$code %>% cat(sep = "\n")
#> $PARAM @annotated
#> CL   :  1 : Clearance (volume/time)
#> V2   : 20 : Central volume (volume)
#> Q    :  2 : Inter-compartmental clearance (volume/time)
#> V3   : 10 : Peripheral volume of distribution (volume)
#> KA   :  1 : Absorption rate constant (1/time)
#> 
#> $CMT @annotated
#> EV     : Extravascular compartment (mass)
#> CENT   : Central compartment (mass)
#> PERIPH : Peripheral compartment (mass) 
#> 
#> $GLOBAL
#> #define CP (CENT/V2)
#> 
#> $PKMODEL ncmt = 2, depot = TRUE
#> 
#> $CAPTURE @annotated
#> CP : Plasma concentration (mass/time)
#> 

Created on 2018-12-06 by the reprex package (v0.2.1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment