kyleb Mon Mar 19 16:56:57 2018
library(mrgsolve)
code <- '
$PARAM CL = 1, V = 30, KA = 1, F1 = 0.5, F2 = 1
$PKMODEL cmt = "DEPOT CENT", depot = TRUE
$MAIN
F_DEPOT = F1;
F_CENT = F2;
'
mod <- mcode_cache("fcmt", code) %>% obsonly()
## Compiling fcmt ... done.
mod %>%
ev(amt = 100, cmt = "DEPOT") %>%
mrgsim(recsort = 3)
## Model: fcmt
## Dim: 25 x 4
## Time: 0 to 24
## ID: 1
## ID time DEPOT CENT
## [1,] 1 0 50.00000 0.00
## [2,] 1 1 18.39397 31.00
## [3,] 1 2 6.76676 41.39
## [4,] 1 3 2.48935 44.23
## [5,] 1 4 0.91578 44.32
## [6,] 1 5 0.33690 43.44
## [7,] 1 6 0.12394 42.22
## [8,] 1 7 0.04559 40.91
mod %>%
ev(amt = 100, cmt = "CENT") %>%
mrgsim(recsort = 3)
## Model: fcmt
## Dim: 25 x 4
## Time: 0 to 24
## ID: 1
## ID time DEPOT CENT
## [1,] 1 0 0 100.00
## [2,] 1 1 0 96.72
## [3,] 1 2 0 93.55
## [4,] 1 3 0 90.48
## [5,] 1 4 0 87.52
## [6,] 1 5 0 84.65
## [7,] 1 6 0 81.87
## [8,] 1 7 0 79.19
mod %>%
param(F1 = 1, F2 = 0.5) %>%
ev(amt = 100, cmt = "DEPOT") %>%
mrgsim(recsort = 3)
## Model: fcmt
## Dim: 25 x 4
## Time: 0 to 24
## ID: 1
## ID time DEPOT CENT
## [1,] 1 0 100.00000 0.00
## [2,] 1 1 36.78794 62.00
## [3,] 1 2 13.53353 82.78
## [4,] 1 3 4.97871 88.45
## [5,] 1 4 1.83156 88.64
## [6,] 1 5 0.67379 86.87
## [7,] 1 6 0.24788 84.44
## [8,] 1 7 0.09119 81.83
mod %>%
param(F1 = 1, F2 = 0.5) %>%
ev(amt = 100, cmt = "CENT") %>%
mrgsim(recsort = 3)
## Model: fcmt
## Dim: 25 x 4
## Time: 0 to 24
## ID: 1
## ID time DEPOT CENT
## [1,] 1 0 0 50.00
## [2,] 1 1 0 48.36
## [3,] 1 2 0 46.78
## [4,] 1 3 0 45.24
## [5,] 1 4 0 43.76
## [6,] 1 5 0 42.32
## [7,] 1 6 0 40.94
## [8,] 1 7 0 39.59