metrumresearchgroup / mrgsolve

Simulate from ODE-based population PK/PD and QSP models in R
https://mrgsolve.org
GNU General Public License v2.0
131 stars 36 forks source link

Infusion should apply bio-availability after calculating infusion duration #954

Closed rfaelens closed 2 years ago

rfaelens commented 2 years ago

When calculating infusion duration based on rate, the bio-availability parameter is taken into account before calculating the infusion duration.

What I did:

data <- expand.ev(ID=1:2,amt=100,rate=10,F1=c(1,0.1))

What I expected: Both ID's have an infusion of duration 10h, but ID 2 will receive only 10% of the amount.

What happened: Both ID's receive the same rate of infusion, but ID 2 stops infusing earlier.

library(tidyverse)
library(mrgsolve)
#> 
#> Attaching package: 'mrgsolve'
#> The following object is masked from 'package:stats':
#> 
#>     filter
code <- '
$PARAM CL=1, FORM=1,F1 = 0.1
$MAIN
F_CENT = 1;
if(FORM==2) F_CENT = F1;
$CMT CENT
$ODE dxdt_CENT = -(CL/10)*CENT;
$CAPTURE CL FORM  F1
'

mod <- mcode("bioav1",code) %>% carry_out(evid)
#> Building bioav1 ...
#> done.
data <- expand.ev(ID=1:2,amt=100,rate=10,FORM=c(1,2))
mod %>% data_set(data) %>%
  mrgsim() %>% plot()

Created on 2022-03-24 by the reprex package (v2.0.1)

Reprex based on https://github.com/metrumresearchgroup/mrgsolve/blob/37c581518eb591282c19314a9030df44fb908a04/inst/maintenance/unit/test-bioav.R

kylebaron commented 2 years ago

Hi @rfaelens -

That's the expected behavior - changing bioavailability changes infusion duration. If you want an specific duration, you have to model D.

Kyle

rfaelens commented 2 years ago

OK, then I will need to double-check my validation step. Thanks!

kylebaron commented 2 years ago

Ok; are you working from our set? Or developing your own? That 4.12 in the other issue looked familiar. I added cases showing only infusion + bioav and infusion + bioav + pinned duration.

smouksassi commented 2 years ago

some history is here https://www.cognigen.com/nonmem/nm/98nov012001.html (see Stuart Beal comment). Also you can look at NONMEM PREDPP guide and I think mrgsolve try to be consistent with the NONMEM zoo :).

kylebaron commented 2 years ago

Thanks for the reference, @smouksassi ; you indeed are a wise elephant.

mattfidler commented 2 years ago

@kylebaron do you have a fixed duration data item. In nlmixr/rxode we have dur. They have one in monolix as well (though I cannot remember what it is, but it wasn't dur). If you don't it should not be too hard to add (and would make translation from nlmixr to mrgsolve a bit easier).

kylebaron commented 2 years ago

Thanks, @mattfidler ... I'll look into it.