Time-varying bioavailability and reproducibility in NONMEM analysis

5 messages 4 people Latest: Feb 12, 2020
Dear NONMEM users, I'm struggling for a couple of weeks against contradictory results between NONMEM and R analysis of the same data with the same model which includes a time-varying bioavailability. Here is a simplified example of my issue: On the one hand, let's introduce a bicompartmental model with a depot compartment, where bioavailability is decreasing over time given a maximum in decrease (MAXDECR) and a first-order decay constant (LAMBDA). Instead of the variable TIME, I use a covariate TOLD (Time Of Last Dose) in order to be sure that the value of F1 computed by NONMEM will be independent of the time used for computation: --- $INPUT CID TIME EVID AMT CMT DV MDV TOLD $MODEL COMP=(DEPOT) COMP=(CENTRAL) COMP=(PERIPH) $PK MAXDECR = THETA(1) LAMBDA = THETA(2) / 24 ; TIME is in hour, Lambda in day-1 F1 = 1 - MAXDECR + MAXDECR * EXP(-LAMBDA * TOLD) $THETA (0, 0.5, 1) FIX (0, 0.15 ) FIX --- On the other hand, we have a dataset of 28 IDs with: - the same dosing regimen of 400 mg qd for 28 days (one line with EVID=1 per administration, no ADDL). - different "sampling occasions" at 0h, 6h, 12 and 18h post-dose; at day 1 for ID1, at day 1&2 for ID2, at day 1&2&3 for ID3, and so on until ID28 who has a complete PK exploration from day 1 to 28. All these lines are filled with EVID=0, DV=., and MDV=1. Then, I estimate these concentrations in maximum a posteriori Bayesian manner (MAXEVAL = 0) with ADVAN 13 (there is no inter-individual nor residual variability). My problem is that NONMEM found different concentrations in these 28 individuals, even though they received the same dose. Besides, as excepted, I found that all individuals had the same value for F1 (at a given time point). Would any of you have an idea of why NONMEM does not return the same predictions ? Thank you very much in advance Kind regards Félicien LE LOUEDEC, PharmD PhD student Centre de Recherches en Cancérologie de Toulouse (CRCT), Toulouse, FRANCE Team 14: « Dose Individualization of Anticancer Drugs » +335 31 15 55 69 [email protected]<mailto:[email protected]>
could you show equations? Bioavailability is treated differently in Nonmem and R, so code should reflect it. Thanks Leonid
Quoted reply history
On 2/11/2020 3:52 AM, Le Louedec Felicien wrote: > Dear NONMEM users, > > I’m struggling for a couple of weeks against contradictory results between NONMEM and R analysis of the same data with the same model which includes a time-varying bioavailability. Here is a simplified example of my issue: > > On the one hand, let’s introduce a bicompartmental model with a depot compartment, where bioavailability is decreasing over time given a maximum in decrease (MAXDECR) and a first-order decay constant (LAMBDA). Instead of the variable TIME, I use a covariate TOLD (Time Of Last Dose) in order to be sure that the value of F1 computed by NONMEM will be independent of the time used for computation: > > --- > > $INPUT CID TIME EVID AMT CMT DV MDV TOLD > > $MODEL COMP=(DEPOT) COMP=(CENTRAL) COMP=(PERIPH) > > $PK > > MAXDECR = THETA(1) > > LAMBDA = THETA(2) / 24 ; TIME is in hour, Lambda in day-1 > > F1 = 1 - MAXDECR + MAXDECR * EXP(-LAMBDA * TOLD) > > $THETA > > (0, 0.5, 1) FIX > > (0, 0.15 ) FIX > > --- > > On the other hand, we have a dataset of 28 IDs with: > > -the same dosing regimen of 400 mg qd for 28 days (one line with EVID=1 per administration, no ADDL). > > -different “sampling occasions” at 0h, 6h, 12 and 18h post-dose; at day 1 for ID1, at day 1&2 for ID2, at day 1&2&3 for ID3, and so on until ID28 who has a complete PK exploration from day 1 to 28. All these lines are filled with EVID=0, DV=., and MDV=1. > > Then, I estimate these concentrations in maximum a posteriori Bayesian manner (MAXEVAL = 0) with ADVAN 13 (there is no inter-individual nor residual variability). > > My problem is that NONMEM found different concentrations in these 28 individuals, even though they received the same dose. Besides, as excepted, I found that all individuals had the same value for F1 (at a given time point). > > Would any of you have an idea of why NONMEM does not return the same predictions ? > > Thank you very much in advance > > Kind regards > > Félicien LE LOUEDEC, PharmD > > PhD student > > Centre de Recherches en Cancérologie de Toulouse (CRCT), Toulouse, FRANCE > > Team 14: « Dose Individualization of Anticancer Drugs » > > +335 31 15 55 69 > > [email protected] < mailto: [email protected] >
Pls check what you have compared. You have used sigma 1 for nonmem not for mrgsolve. Even if you use sigma q for Mrgsolve, the results will be slightly different due to fittong vs. Simulation via random numbers. Hope it helps
Quoted reply history
On Tue, Feb 11, 2020, 10:43 AM Le Louedec Felicien < [email protected]> wrote: > Please find below the code for NONMEM analysis and for mrgsolve which is > the package I use to perform simulations in R > > Thanks you very much > > Félicien > > ;;;;;NONMEM CODE;;; > > $PROBLEM TEST F DECREASE > $INPUT ID TIME EVID AMT CMT DV MDV TOLD > $DATA ds_sim_told.csv IGNORE=@ > $SUBROUTINES ADVAN13 TOL=4 > $MODEL COMP=(DEPOT) COMP=(CENTRAL) COMP=(PERIPH) > > $PK > TVCL = THETA(1) > TVVC = THETA(2) > TVKA = THETA(3) > TVALAG1 = THETA(4) > TVQ = THETA(5) > TVVP = THETA(6) > TVLAMBDA = THETA(7) > TVMAXDECR = THETA(8) > ERRADD = THETA(9) > ERRPROP = THETA(10) > > CL = TVCL > VC = TVVC > KA = TVKA > ALAG1 = TVALAG1 > Q = TVQ > VP = TVVP > > LAMBDA = TVLAMBDA / 24 > MAXDECR= TVMAXDECR > TVF= 1-MAXDECR+MAXDECR*EXP(-LAMBDA*TOLD) > F1 = TVF > > K20 = CL/VC > K23 = Q/VC > K32 = Q/VP > S2 = VC > > $DES > DADT(1) = - KA * A(1) > DADT(2) = KA * A(1) - K20*A(2) - K23*A(2) + K32*A(3) > DADT(3) = K23* A(2) - K32*A(3) > > $ERROR > IPRED=F > W=SQRT(ERRADD**2+(ERRPROP*IPRED)**2) > Y=IPRED+W*EPS(1) > IRES=DV-IPRED > IWRES=IRES/(W+0.001) > > $THETA > (0, 0.5) FIX ; 1 CL > (0, 3) FIX ; 2 VC > (0, 0.1) FIX ; 3 KA > (0, 1) FIX ; 4 ALAG > (0, 1) FIX ; 5 Q > (0, 25) FIX ; 6 VP > (0, 0.15) FIX ; 7 LAMBDA > (0, 0.50) FIX ; 8 MAXDECR > (0) FIX ; 9 ADD > (0) FIX ; 10 PROP > > $OMEGA 0 FIX > $SIGMA 1 FIX > > $ESTIMATION METHOD=1 INTER NOABORT MAXEVAL=0 SIG=3 PRINT=5 POSTHOC FORMAT= > s1PE16.8E3 > $COV PRINT=E MATRIX=S > $TABLE ID TIME EVID AMT CMT DV MDV TOLD F1 PRED IPRED IWRES IRES ONEHEADER > NOPRINT FILE = run301.TAB FORMAT= s1PE16.8E3 > > ;;;; end of NONMEM CODE ;;;;; > > ;;;; MRGSOLVE CODE ;;;;; > $PROB test F decrease > > $PARAM @annotated > TVCL : 0.5 : 1 Clearance (L.h-1) > TVVC : 3 : 2 Volume (L) > TVKA : 0.1 : 3 Absorption rate constant (h-1) > TVALAG : 1 : 5 Lag time (h) > TVQ : 1 : 6 Intercompartmental Clearance (L.h-1) > TVVP : 25 : 7 Volume (L) > TVLAMBDA : 0.15 : 8 First-order decay constant (day-1) > TVMAXDECR: 0.50 : 9 Magnitude of decrease constant (%) > > TOLD : 0 : default TOLD > > $CMT @annotated > DEPOT : Depot compartment > CENTRAL : Central compartment > PERIPHERAL : Peripheral compartment > > $GLOBAL > double CL, VC, KA, ALAG, Q, VP, LAMBDA, MAXDECR, TVF, K20, K23, K32, F1 ; > > $TABLE > double DV = (CENTRAL / VC) ; > > $MAIN > CL = TVCL ; > VC = TVVC ; > KA = TVKA ; > ALAG = TVALAG ; > Q = TVQ ; > VP = TVVP ; > LAMBDA = TVLAMBDA / 24 ; > MAXDECR = TVMAXDECR ; > > TVF = 1 - MAXDECR + MAXDECR * exp(-LAMBDA*TOLD) ; > F1 = TVF ; > > K20 = CL / VC ; > K23 = Q / VC ; > K32 = Q / VP ; > > F_DEPOT = F1 ; > ALAG_DEPOT = ALAG ; > > $ODE > dxdt_DEPOT = -KA * DEPOT ; > dxdt_CENTRAL = KA * DEPOT - K20 * CENTRAL - K23 * CENTRAL + K32 * > PERIPHERAL ; > dxdt_PERIPHERAL = K23 * CENTRAL - K32 * PERIPHERAL; > > $CAPTURE @annotated > DV : Concentration central (mcg/L) > F_DEPOT : F > > ;;;; end of MRGSOLVE CODE ;;;; > > > > > > > > -----Message d'origine----- > De : [email protected] [mailto:[email protected]] > De la part de Leonid Gibiansky > Envoyé : mardi 11 février 2020 15:19 > À : [email protected] > Objet : Re: [NMusers] Time-varying bioavailability and reproducibility in > NONMEM analysis > > could you show equations? Bioavailability is treated differently in Nonmem > and R, so code should reflect it. > Thanks > Leonid > > > On 2/11/2020 3:52 AM, Le Louedec Felicien wrote: > > Dear NONMEM users, > > > > I'm struggling for a couple of weeks against contradictory results > > between NONMEM and R analysis of the same data with the same model which > > includes a time-varying bioavailability. Here is a simplified example of > > my issue: > > > > On the one hand, let's introduce a bicompartmental model with a depot > > compartment, where bioavailability is decreasing over time given a > > maximum in decrease (MAXDECR) and a first-order decay constant (LAMBDA). > > Instead of the variable TIME, I use a covariate TOLD (Time Of Last Dose) > > in order to be sure that the value of F1 computed by NONMEM will be > > independent of the time used for computation: > > > > --- > > > > $INPUT CID TIME EVID AMT CMT DV MDV TOLD > > > > $MODEL COMP=(DEPOT) COMP=(CENTRAL) COMP=(PERIPH) > > > > $PK > > > > MAXDECR = THETA(1) > > > > LAMBDA = THETA(2) / 24 ; TIME is in hour, Lambda in day-1 > > > > F1 = 1 - MAXDECR + MAXDECR * EXP(-LAMBDA * TOLD) > > > > $THETA > > > > (0, 0.5, 1) FIX > > > > (0, 0.15 ) FIX > > > > --- > > > > On the other hand, we have a dataset of 28 IDs with: > > > > -the same dosing regimen of 400 mg qd for 28 days (one line with EVID=1 > > per administration, no ADDL). > > > > -different "sampling occasions" at 0h, 6h, 12 and 18h post-dose; at day > > 1 for ID1, at day 1&2 for ID2, at day 1&2&3 for ID3, and so on until > > ID28 who has a complete PK exploration from day 1 to 28. All these lines > > are filled with EVID=0, DV=., and MDV=1. > > > > Then, I estimate these concentrations in maximum a posteriori Bayesian > > manner (MAXEVAL = 0) with ADVAN 13 (there is no inter-individual nor > > residual variability). > > > > My problem is that NONMEM found different concentrations in these 28 > > individuals, even though they received the same dose. Besides, as > > excepted, I found that all individuals had the same value for F1 (at a > > given time point). > > > > Would any of you have an idea of why NONMEM does not return the same > > predictions ? > > > > Thank you very much in advance > > > > Kind regards > > > > Félicien LE LOUEDEC, PharmD > > > > PhD student > > > > Centre de Recherches en Cancérologie de Toulouse (CRCT), Toulouse, FRANCE > > > > Team 14: « Dose Individualization of Anticancer Drugs » > > > > +335 31 15 55 69 > > > > [email protected] > > <mailto:[email protected]> > > > > > > >
Can you please share the ds_sim_told.csv file (or at least 2 complete individuals from that file)? It does seem like TOLD is the critical thing here, but I'd like to know what exactly is the discrepancy. IMO we need the input data to figure that out. mrgsolve does read covariates from the next record and we have some tests around that. If ADDL isn't involved, then I'd expect it to behave like any other time-varying covariate. Would like to look at ALAG too as Leonid suggested. It does appear that there is no variability in either simulation with THETA9 and THETA10 fixed to zero. I have cross-posted this issue on the mrgsolve Issue Tracker. If nmusers doesn't allow attachments, you can post the input data file there: https://github.com/metrumresearchgroup/mrgsolve/issues/634
Quoted reply history
On Tue, Feb 11, 2020 at 10:15 AM Saeheum Song <[email protected]> wrote: > Pls check what you have compared. You have used sigma 1 for nonmem not for > mrgsolve. > > Even if you use sigma q for Mrgsolve, the results will be > slightly different due to fittong vs. Simulation via random numbers. > > Hope it helps > > > On Tue, Feb 11, 2020, 10:43 AM Le Louedec Felicien < > [email protected]> wrote: > >> Please find below the code for NONMEM analysis and for mrgsolve which is >> the package I use to perform simulations in R >> >> Thanks you very much >> >> Félicien >> >> ;;;;;NONMEM CODE;;; >> >> $PROBLEM TEST F DECREASE >> $INPUT ID TIME EVID AMT CMT DV MDV TOLD >> $DATA ds_sim_told.csv IGNORE=@ >> $SUBROUTINES ADVAN13 TOL=4 >> $MODEL COMP=(DEPOT) COMP=(CENTRAL) COMP=(PERIPH) >> >> $PK >> TVCL = THETA(1) >> TVVC = THETA(2) >> TVKA = THETA(3) >> TVALAG1 = THETA(4) >> TVQ = THETA(5) >> TVVP = THETA(6) >> TVLAMBDA = THETA(7) >> TVMAXDECR = THETA(8) >> ERRADD = THETA(9) >> ERRPROP = THETA(10) >> >> CL = TVCL >> VC = TVVC >> KA = TVKA >> ALAG1 = TVALAG1 >> Q = TVQ >> VP = TVVP >> >> LAMBDA = TVLAMBDA / 24 >> MAXDECR= TVMAXDECR >> TVF= 1-MAXDECR+MAXDECR*EXP(-LAMBDA*TOLD) >> F1 = TVF >> >> K20 = CL/VC >> K23 = Q/VC >> K32 = Q/VP >> S2 = VC >> >> $DES >> DADT(1) = - KA * A(1) >> DADT(2) = KA * A(1) - K20*A(2) - K23*A(2) + K32*A(3) >> DADT(3) = K23* A(2) - K32*A(3) >> >> $ERROR >> IPRED=F >> W=SQRT(ERRADD**2+(ERRPROP*IPRED)**2) >> Y=IPRED+W*EPS(1) >> IRES=DV-IPRED >> IWRES=IRES/(W+0.001) >> >> $THETA >> (0, 0.5) FIX ; 1 CL >> (0, 3) FIX ; 2 VC >> (0, 0.1) FIX ; 3 KA >> (0, 1) FIX ; 4 ALAG >> (0, 1) FIX ; 5 Q >> (0, 25) FIX ; 6 VP >> (0, 0.15) FIX ; 7 LAMBDA >> (0, 0.50) FIX ; 8 MAXDECR >> (0) FIX ; 9 ADD >> (0) FIX ; 10 PROP >> >> $OMEGA 0 FIX >> $SIGMA 1 FIX >> >> $ESTIMATION METHOD=1 INTER NOABORT MAXEVAL=0 SIG=3 PRINT=5 POSTHOC >> FORMAT= s1PE16.8E3 >> $COV PRINT=E MATRIX=S >> $TABLE ID TIME EVID AMT CMT DV MDV TOLD F1 PRED IPRED IWRES IRES >> ONEHEADER NOPRINT FILE = run301.TAB FORMAT= s1PE16.8E3 >> >> ;;;; end of NONMEM CODE ;;;;; >> >> ;;;; MRGSOLVE CODE ;;;;; >> $PROB test F decrease >> >> $PARAM @annotated >> TVCL : 0.5 : 1 Clearance (L.h-1) >> TVVC : 3 : 2 Volume (L) >> TVKA : 0.1 : 3 Absorption rate constant (h-1) >> TVALAG : 1 : 5 Lag time (h) >> TVQ : 1 : 6 Intercompartmental Clearance (L.h-1) >> TVVP : 25 : 7 Volume (L) >> TVLAMBDA : 0.15 : 8 First-order decay constant (day-1) >> TVMAXDECR: 0.50 : 9 Magnitude of decrease constant (%) >> >> TOLD : 0 : default TOLD >> >> $CMT @annotated >> DEPOT : Depot compartment >> CENTRAL : Central compartment >> PERIPHERAL : Peripheral compartment >> >> $GLOBAL >> double CL, VC, KA, ALAG, Q, VP, LAMBDA, MAXDECR, TVF, K20, K23, K32, F1 ; >> >> $TABLE >> double DV = (CENTRAL / VC) ; >> >> $MAIN >> CL = TVCL ; >> VC = TVVC ; >> KA = TVKA ; >> ALAG = TVALAG ; >> Q = TVQ ; >> VP = TVVP ; >> LAMBDA = TVLAMBDA / 24 ; >> MAXDECR = TVMAXDECR ; >> >> TVF = 1 - MAXDECR + MAXDECR * exp(-LAMBDA*TOLD) ; >> F1 = TVF ; >> >> K20 = CL / VC ; >> K23 = Q / VC ; >> K32 = Q / VP ; >> >> F_DEPOT = F1 ; >> ALAG_DEPOT = ALAG ; >> >> $ODE >> dxdt_DEPOT = -KA * DEPOT ; >> dxdt_CENTRAL = KA * DEPOT - K20 * CENTRAL - K23 * CENTRAL + K32 * >> PERIPHERAL ; >> dxdt_PERIPHERAL = K23 * CENTRAL - K32 * PERIPHERAL; >> >> $CAPTURE @annotated >> DV : Concentration central (mcg/L) >> F_DEPOT : F >> >> ;;;; end of MRGSOLVE CODE ;;;; >> >> >> >> >> >> >> >> -----Message d'origine----- >> De : [email protected] [mailto:[email protected]] >> De la part de Leonid Gibiansky >> Envoyé : mardi 11 février 2020 15:19 >> À : [email protected] >> Objet : Re: [NMusers] Time-varying bioavailability and reproducibility in >> NONMEM analysis >> >> could you show equations? Bioavailability is treated differently in >> Nonmem and R, so code should reflect it. >> Thanks >> Leonid >> >> >> On 2/11/2020 3:52 AM, Le Louedec Felicien wrote: >> > Dear NONMEM users, >> > >> > I'm struggling for a couple of weeks against contradictory results >> > between NONMEM and R analysis of the same data with the same model >> which >> > includes a time-varying bioavailability. Here is a simplified example >> of >> > my issue: >> > >> > On the one hand, let's introduce a bicompartmental model with a depot >> > compartment, where bioavailability is decreasing over time given a >> > maximum in decrease (MAXDECR) and a first-order decay constant >> (LAMBDA). >> > Instead of the variable TIME, I use a covariate TOLD (Time Of Last >> Dose) >> > in order to be sure that the value of F1 computed by NONMEM will be >> > independent of the time used for computation: >> > >> > --- >> > >> > $INPUT CID TIME EVID AMT CMT DV MDV TOLD >> > >> > $MODEL COMP=(DEPOT) COMP=(CENTRAL) COMP=(PERIPH) >> > >> > $PK >> > >> > MAXDECR = THETA(1) >> > >> > LAMBDA = THETA(2) / 24 ; TIME is in hour, Lambda in day-1 >> > >> > F1 = 1 - MAXDECR + MAXDECR * EXP(-LAMBDA * TOLD) >> > >> > $THETA >> > >> > (0, 0.5, 1) FIX >> > >> > (0, 0.15 ) FIX >> > >> > --- >> > >> > On the other hand, we have a dataset of 28 IDs with: >> > >> > -the same dosing regimen of 400 mg qd for 28 days (one line with EVID=1 >> > per administration, no ADDL). >> > >> > -different "sampling occasions" at 0h, 6h, 12 and 18h post-dose; at day >> > 1 for ID1, at day 1&2 for ID2, at day 1&2&3 for ID3, and so on until >> > ID28 who has a complete PK exploration from day 1 to 28. All these >> lines >> > are filled with EVID=0, DV=., and MDV=1. >> > >> > Then, I estimate these concentrations in maximum a posteriori Bayesian >> > manner (MAXEVAL = 0) with ADVAN 13 (there is no inter-individual nor >> > residual variability). >> > >> > My problem is that NONMEM found different concentrations in these 28 >> > individuals, even though they received the same dose. Besides, as >> > excepted, I found that all individuals had the same value for F1 (at a >> > given time point). >> > >> > Would any of you have an idea of why NONMEM does not return the same >> > predictions ? >> > >> > Thank you very much in advance >> > >> > Kind regards >> > >> > Félicien LE LOUEDEC, PharmD >> > >> > PhD student >> > >> > Centre de Recherches en Cancérologie de Toulouse (CRCT), Toulouse, >> FRANCE >> > >> > Team 14: « Dose Individualization of Anticancer Drugs » >> > >> > +335 31 15 55 69 >> > >> > [email protected] >> > <mailto:[email protected]> >> > >> >> >> >> >> -- Kyle Baron | Principal Scientist I Metrum Research Group 2 Tunxis Road | Tariffville, CT 06081 p: 860-735-7043 ext. 202 | e: [email protected]
for nonmem to work correctly, the R code below should be run to correct the data file. code <- ds_sim_told$TIME > 0 & ds_sim_told$amt > 0 ds_sim_told$TOLD[code] <- ds_sim_told$TOLD[code] -24 Note that ALAG should be > 0 in this case (if you need zero ALAG, set it to 0.000001). Leonid
Quoted reply history
On 2/12/2020 7:14 AM, Le Louedec Felicien wrote: > Dear all, > > Many thanks for your answers. Indeed, part of the issue comes from the LAG time. When I run a model without LAG time, NONMEM returns the same predictions between the 28 individuals (provided that TOL is high enough), and vs MRGSOLVE. So, obviously, when there is a lag time (eg 1h), NONMEM needs a value of F at this time (T+1h), and does not use the F provided at the time of administration (T+0h). > > And everything seems clear now : as NONMEM uses NOCB to deal with missing covariates, it reaches the value of F in the next observation, which differs according to the sampling design (t+6h in subjects with EVID =0 (same TOLD), t+24h (thus a different TOLD) for individuals who do not have EVID=0 anymore). However, I guess that mrgsolve uses the value of F1 at the time of administration (T+0h), and not at the time when absorption begins (T+1h) : that would explain why mrgsolve provides the same predictions in every subjects even with a lag time. Am I right ? > > The question now is: is it possible to have a model in NONMEM, with lag time and time-decreasing bioavailability, that returns predictions independently of the sampling strategy ? > > Thank you > > Félicien > > PS: please find below the R code that I used to generate the dataset. > > ;;;;; R code for dataset ;;;; > > library(tidyverse) > > adm <- tibble(ID = 1:28, > > evid = 1, > > amt = 400, > > cmt = 1, > > DV = as.double(NA)) %>% > > crossing(time = 24*c(0:28)) %>% > > arrange(ID, time) %>% > > select(ID, time, everything()) > > obs <- tibble(ID = 1:28, > > evid = 0, > > amt = NA, > > cmt = 2, > > DV = as.double(NA)) %>% > > crossing(time = (0:(28*4))*6) %>% > > filter(time <= ID*24) %>% > > arrange(ID, time) %>% > > select(ID, time, everything()) > > ds_sim_told <- bind_rows(adm, obs) %>% > > arrange(ID, time) %>% > > mutate(MDV = 1)%>% > > mutate(TOLD = ifelse(evid == 1, time, NA)) %>% > > fill(TOLD) > > ds_sim_told # for the data_set function in mrgsolve > > ds_sim_told %>% > > rename(CID = ID, TIME = time, EVID = evid, AMT = amt, CMT = cmt) %>% > > write_csv("ds_sim_told.csv", na = ".") #data for NONMEM > > ;;;; > > *De :*Kyle Baron [mailto:[email protected]] > *Envoyé :* mardi 11 février 2020 17:59 > *À :* Saeheum Song <[email protected]> > > *Cc :* Le Louedec Felicien < [email protected] >; [email protected] ; Leonid Gibiansky < [email protected] > *Objet :* Re: [NMusers] Time-varying bioavailability and reproducibility in NONMEM analysis > > Can you please share the ds_sim_told.csv file (or at least 2 complete individuals from that file)? It does seem like TOLD is the critical thing here, but I'd like to know what exactly is the discrepancy. IMO we need the input data to figure that out. mrgsolve does read covariates from the next record and we have some tests around that. If ADDL isn't involved, then I'd expect it to behave like any other time-varying covariate. Would like to look at ALAG too as Leonid suggested. > > It does appear that there is no variability in either simulation with THETA9 and THETA10 fixed to zero. > > I have cross-posted this issue on the mrgsolve Issue Tracker. If nmusers doesn't allow attachments, you can post the input data file there: > > https://github.com/metrumresearchgroup/mrgsolve/issues/634 > > On Tue, Feb 11, 2020 at 10:15 AM Saeheum Song < [email protected] < mailto: [email protected] >> wrote: > > Pls check what you have compared. You have used sigma 1 for nonmem > not for mrgsolve. > > Even if you use sigma q for Mrgsolve, the results will be > slightly different due to fittong vs. Simulation via random numbers. > > Hope it helps > > On Tue, Feb 11, 2020, 10:43 AM Le Louedec Felicien > <[email protected] > <mailto:[email protected]>> wrote: > > Please find below the code for NONMEM analysis and for mrgsolve > which is the package I use to perform simulations in R > > Thanks you very much > > Félicien > > ;;;;;NONMEM CODE;;; > > $PROBLEM TEST F DECREASE > $INPUT ID TIME EVID AMT CMT DV MDV TOLD > $DATA ds_sim_told.csv IGNORE=@ > $SUBROUTINES ADVAN13 TOL=4 > $MODEL COMP=(DEPOT) COMP=(CENTRAL) COMP=(PERIPH) > > $PK > TVCL = THETA(1) > TVVC = THETA(2) > TVKA = THETA(3) > TVALAG1 = THETA(4) > TVQ = THETA(5) > TVVP = THETA(6) > TVLAMBDA = THETA(7) > TVMAXDECR = THETA(8) > ERRADD = THETA(9) > ERRPROP = THETA(10) > > CL = TVCL > VC = TVVC > KA = TVKA > ALAG1 = TVALAG1 > Q = TVQ > VP = TVVP > > LAMBDA = TVLAMBDA / 24 > MAXDECR= TVMAXDECR > TVF= 1-MAXDECR+MAXDECR*EXP(-LAMBDA*TOLD) > F1 = TVF > > K20 = CL/VC > K23 = Q/VC > K32 = Q/VP > S2 = VC > > $DES > DADT(1) = - KA * A(1) > DADT(2) = KA * A(1) - K20*A(2) - K23*A(2) + K32*A(3) > DADT(3) = K23* A(2) - K32*A(3) > > $ERROR > IPRED=F > W=SQRT(ERRADD**2+(ERRPROP*IPRED)**2) > Y=IPRED+W*EPS(1) > IRES=DV-IPRED > IWRES=IRES/(W+0.001) > > $THETA > (0, 0.5) FIX ; 1 CL > (0, 3) FIX ; 2 VC > (0, 0.1) FIX ; 3 KA > (0, 1) FIX ; 4 ALAG > (0, 1) FIX ; 5 Q > (0, 25) FIX ; 6 VP > (0, 0.15) FIX ; 7 LAMBDA > (0, 0.50) FIX ; 8 MAXDECR > (0) FIX ; 9 ADD > (0) FIX ; 10 PROP > > $OMEGA 0 FIX > $SIGMA 1 FIX > > $ESTIMATION METHOD=1 INTER NOABORT MAXEVAL=0 SIG=3 PRINT=5 > POSTHOC FORMAT= s1PE16.8E3 > $COV PRINT=E MATRIX=S > $TABLE ID TIME EVID AMT CMT DV MDV TOLD F1 PRED IPRED IWRES IRES > ONEHEADER NOPRINT FILE = run301.TAB FORMAT= s1PE16.8E3 > > ;;;; end of NONMEM CODE ;;;;; > > ;;;; MRGSOLVE CODE ;;;;; > $PROB test F decrease > > $PARAM @annotated > TVCL : 0.5 : 1 Clearance (L.h-1) > TVVC : 3 : 2 Volume (L) > TVKA : 0.1 : 3 Absorption rate constant (h-1) > TVALAG : 1 : 5 Lag time (h) > TVQ : 1 : 6 Intercompartmental Clearance (L.h-1) > TVVP : 25 : 7 Volume (L) > TVLAMBDA : 0.15 : 8 First-order decay constant (day-1) > TVMAXDECR: 0.50 : 9 Magnitude of decrease constant (%) > > TOLD : 0 : default TOLD > > $CMT @annotated > DEPOT : Depot compartment > CENTRAL : Central compartment > PERIPHERAL : Peripheral compartment > > $GLOBAL > double CL, VC, KA, ALAG, Q, VP, LAMBDA, MAXDECR, TVF, K20, K23, > K32, F1 ; > > $TABLE > double DV = (CENTRAL / VC) ; > > $MAIN > CL = TVCL ; > VC = TVVC ; > KA = TVKA ; > ALAG = TVALAG ; > Q = TVQ ; > VP = TVVP ; > LAMBDA = TVLAMBDA / 24 ; > MAXDECR = TVMAXDECR ; > > TVF = 1 - MAXDECR + MAXDECR * exp(-LAMBDA*TOLD) ; > F1 = TVF ; > > K20 = CL / VC ; > K23 = Q / VC ; > K32 = Q / VP ; > > F_DEPOT = F1 ; > ALAG_DEPOT = ALAG ; > > $ODE > dxdt_DEPOT = -KA * DEPOT ; > dxdt_CENTRAL = KA * DEPOT - K20 * CENTRAL - K23 * CENTRAL + > K32 * PERIPHERAL ; > dxdt_PERIPHERAL = K23 * CENTRAL - K32 * PERIPHERAL; > > $CAPTURE @annotated > DV : Concentration central (mcg/L) > F_DEPOT : F > > ;;;; end of MRGSOLVE CODE ;;;; > > -----Message d'origine----- > De : [email protected] > > <mailto:[email protected]>[mailto:[email protected] > <mailto:[email protected]>] De la part de Leonid > Gibiansky > Envoyé : mardi 11 février 2020 15:19 > À : [email protected] <mailto:[email protected]> > Objet : Re: [NMusers] Time-varying bioavailability and > reproducibility in NONMEM analysis > > could you show equations? Bioavailability is treated differently > in Nonmem and R, so code should reflect it. > Thanks > Leonid > > On 2/11/2020 3:52 AM, Le Louedec Felicien wrote: > > Dear NONMEM users, > > > > I'm struggling for a couple of weeks against contradictory results > between NONMEM and R analysis of the same data with the same model which > includes a time-varying bioavailability. Here is a simplified example of > my issue: > > On the one hand, let's introduce a bicompartmental model with a depot > compartment, where bioavailability is decreasing over time given a > maximum in decrease (MAXDECR) and a first-order decay constant (LAMBDA). > Instead of the variable TIME, I use a covariate TOLD (Time Of Last Dose) > in order to be sure that the value of F1 computed by NONMEM will be > independent of the time used for computation: > > --- > > $INPUT CID TIME EVID AMT CMT DV MDV TOLD > > $MODEL COMP=(DEPOT) COMP=(CENTRAL) COMP=(PERIPH) > > $PK > > MAXDECR = THETA(1) > > LAMBDA = THETA(2) / 24 ; TIME is in hour, Lambda in day-1 > > F1 = 1 - MAXDECR + MAXDECR * EXP(-LAMBDA * TOLD) > > $THETA > > (0, 0.5, 1) FIX > > (0, 0.15 ) FIX > > --- > > On the other hand, we have a dataset of 28 IDs with: > > -the same dosing regimen of 400 mg qd for 28 days (one line with EVID=1 > per administration, no ADDL). > > -different "sampling occasions" at 0h, 6h, 12 and 18h post-dose; at day > 1 for ID1, at day 1&2 for ID2, at day 1&2&3 for ID3, and so on until > ID28 who has a complete PK exploration from day 1 to 28. All these lines > are filled with EVID=0, DV=., and MDV=1. > > Then, I estimate these concentrations in maximum a posteriori Bayesian > manner (MAXEVAL = 0) with ADVAN 13 (there is no inter-individual nor > residual variability). > > My problem is that NONMEM found different concentrations in these 28 > individuals, even though they received the same dose. Besides, as > excepted, I found that all individuals had the same value for F1 (at a > given time point). > > Would any of you have an idea of why NONMEM does not return the same > predictions ? > > Thank you very much in advance > > Kind regards > > Félicien LE LOUEDEC, PharmD > > PhD student > > Centre de Recherches en Cancérologie de Toulouse (CRCT), Toulouse, FRANCE > > Team 14: « Dose Individualization of Anticancer Drugs » > > +335 31 15 55 69 > > [email protected] > > <mailto:[email protected]> > > <mailto:[email protected] > <mailto:[email protected]>> > > > > > -- > > *Kyle Baron | Principal Scientist I* > > Metrum Research Group > > 2 Tunxis Road | Tariffville, CT 06081 > > p: 860-735-7043 ext. 202 | e: [email protected] <mailto:[email protected]>