mrgsolve
mrgsolve copied to clipboard
SS=1 happens before system is reset EVID=4 on the same record
A small example:
library(mrgsolve)
mod <- mread_cache("pk1", modlib())
dat <- read.table(header=T, text="
ID TIME CMT AMT EVID SS II
1 0 1 100 4 1 12
2 0 1 100 1 1 12
3 0 1 100 4 0 0
4 0 1 100 1 0 0
")
sim <- mod |>
data_set(dat) |>
mrgsim(end=5)
all(sim$CP[sim$ID==1] == sim$CP[sim$ID==2]) ## [1] FALSE
all(sim$CP[sim$ID==1] == sim$CP[sim$ID==3]) ## [1] TRUE
all(sim$CP[sim$ID==1] == sim$CP[sim$ID==4]) ## [1] TRUE
For ID=1, I was expecting the result to be identical to ID=2 (as in NONMEM). Instead, it gave the same result as ID=3 and ID=4.
Thanks, @benjaminrich; I'll take a look.
It looks like mrgsolve is advancing to steady state then resetting then dosing.
Confirming the NONMEM behavior here: https://github.com/mrgsolve/nmtests/blob/master/dosing/dosing-vignette.md#21-reset-and-dose-evid-4-with-ss1
Link isn't working; but it is case 21

Make sure the fix matches this too:
