Re: [NMusers] Help with ODEs for a time varying clearance

2021-07-22 Thread Niurys.CS
Dear all,

Thank you very much for clarifying my doubts and giving me some lights. I'm
going to keep it in mind.
Regards, Niurys

MSc Niurys de Castro Suárez
Assistant Professor of Pharmacometrics
Assistant Research
Pharmacy Department
Institute of Pharmacy and Food,
University of Havana
Cuba
El 22/07/2021 16:45, "Simbarashe Peter Zvada" 
escribió:

> Thanks Niurys for revisiting this.
> It was discussed quite a lot before.
> Using T in $DES, as Paolo suggested, is what I always do.
>
> As far as your code / model file is concerned, I somehow like it as long
> as you will be able to explain in simpler terms to non-pharmacometricians
> and Physicians what the values mean and implications on situations.
>
> Thanks,
> Simba
>
> On Thu, Jul 22, 2021, 4:37 PM Leonid Gibiansky 
> wrote:
>
>> PK block is executed only once per record so CL(TIME) is constant
>> between records, while in the DES block T (time) changes continuously,
>> thus implementing time dependence CL(T) exactly rather than
>> approximately. The rest is fine.
>> Thanks
>> Leonid
>>
>> On 7/22/2021 4:19 PM, Niurys.CS wrote:
>> > Dear Leonid,
>> > Thanks for yor suggestion. I've never thought in that possibility.
>> > However, I have two questions:
>> > 1-Why must I write those equations inside $DES?
>> > 2-Do you think the ODE that I proposed are Ok?
>> >
>> > Thank you very much
>> >
>> > MSc Niurys de Castro Suárez
>> > Assistant Professor of Pharmacometrics
>> > Assistant Research
>> > Pharmacy Department
>> > Institute of Pharmacy and Food,
>> > University of Havana
>> > Cuba
>> >
>> > El 22/07/2021 16:04, "Leonid Gibiansky" > > > escribió:
>> >
>> > Definition of CL should be moved inside the DES block; other than
>> > that, looks fine:
>> > ; DES --
>> > $DES
>> > CL2_TIME = CL2*EXP(-KDES*T)
>> > CL_TOTAL = CL2_TIME + CL1 ; total clearance
>> > ...
>> >
>> > Thanks
>> > Leonid
>> >
>> >
>> > On 7/22/2021 3:30 PM, Niurys.CS wrote:
>> >
>> > Dear nmusers,
>> > I'm working on the pharmacokinetics of an antiCD20 mAb; I
>> > suspect the clearance of this mAb should be time dependent as
>> > rituximab’s clearance do. I tried to model this behavior but I’m
>> > not sure if the ODEs are correct. Please can you help? I share
>> > part of the code.
>> >
>> > $SUBROUTINE ADVAN13 TOL=9
>> > $MODEL  COMP=(CENTRAL) COMP=(PERIPH1)
>> > $PK
>> > ; STRUCTURAL PARAMETERS --
>> > TVCL1   = THETA(2)  ; system-nonspecific clearance
>> > TVV1   = THETA(3)
>> > TVQ= THETA(4)
>> > TVV2   = THETA(5)
>> > TVKDES = THETA(6)  ; rate constant of the specific clearance
>> decay
>> > TVCL2  = THETA(7)  ; time varying clearance at time zero
>> > ; MU_TRANSFORMATION --
>> > MU_1   = LOG(TVCL1)
>> > MU_2   = LOG(TVV1)
>> > MU_3   = LOG(TVQ)
>> > MU_4   = LOG(TVV2)
>> > MU_5   = LOG(TVKDES)
>> > MU_6   = LOG(TVCL2)
>> > ; INDIVIDUAL PARAMETERS --
>> > CL1  = EXP(MU_1+ETA(1))
>> > V1   = EXP(MU_2+ETA(2))
>> > Q= EXP(MU_3+ETA(3))
>> > V2   = EXP(MU_4+ETA(4))
>> > KDES = EXP(MU_5+ETA(5))
>> > CL2   = EXP(MU_6+ETA(6))
>> > S1  = V1
>> > ; INITIAL CONDITIONS --
>> > A_0(1) = 0
>> > A_0(2) = 0
>> > CL2_TIME = CL2*EXP((-KDES)*(TIME))
>> > CL_TOTAL = CL2_TIME + CL1 ; total clearance
>> > ; DES --
>> > $DES
>> > CONC   = A(1)/V1
>> > DADT(1) =-(CL_TOTAL/V1)*A(1)-(Q/V1)*A(1)+(Q/V2)*A(2)
>> > DADT(2) = (Q/V1)*A(1)-(Q/V2)*A(2)
>> > ;$ERROR --
>> > CONC1 = A(1)/V1
>> > IPRED=-3
>> > IF(CONC1.GT.0) IPRED=LOG(CONC1)
>> > W = THETA(1)
>> > Y =  IPRED+W*EPS(1)
>> > IRES=DV-IPRED
>> > IWRES=IRES/W
>> >
>> > Thank you,
>> > Niurys
>> >
>> > MSc Niurys de Castro Suárez
>> > Assistant Professor of Pharmacometrics
>> > Assistant Research
>> > Pharmacy Department
>> > Institute of Pharmacy and Food,
>> > University of Havana
>> > Cuba
>> >
>>
>>


Re: [NMusers] Help with ODEs for a time varying clearance

2021-07-22 Thread Simbarashe Peter Zvada
Thanks Niurys for revisiting this.
It was discussed quite a lot before.
Using T in $DES, as Paolo suggested, is what I always do.

As far as your code / model file is concerned, I somehow like it as long as
you will be able to explain in simpler terms to non-pharmacometricians and
Physicians what the values mean and implications on situations.

Thanks,
Simba

On Thu, Jul 22, 2021, 4:37 PM Leonid Gibiansky 
wrote:

> PK block is executed only once per record so CL(TIME) is constant
> between records, while in the DES block T (time) changes continuously,
> thus implementing time dependence CL(T) exactly rather than
> approximately. The rest is fine.
> Thanks
> Leonid
>
> On 7/22/2021 4:19 PM, Niurys.CS wrote:
> > Dear Leonid,
> > Thanks for yor suggestion. I've never thought in that possibility.
> > However, I have two questions:
> > 1-Why must I write those equations inside $DES?
> > 2-Do you think the ODE that I proposed are Ok?
> >
> > Thank you very much
> >
> > MSc Niurys de Castro Suárez
> > Assistant Professor of Pharmacometrics
> > Assistant Research
> > Pharmacy Department
> > Institute of Pharmacy and Food,
> > University of Havana
> > Cuba
> >
> > El 22/07/2021 16:04, "Leonid Gibiansky"  > > escribió:
> >
> > Definition of CL should be moved inside the DES block; other than
> > that, looks fine:
> > ; DES --
> > $DES
> > CL2_TIME = CL2*EXP(-KDES*T)
> > CL_TOTAL = CL2_TIME + CL1 ; total clearance
> > ...
> >
> > Thanks
> > Leonid
> >
> >
> > On 7/22/2021 3:30 PM, Niurys.CS wrote:
> >
> > Dear nmusers,
> > I'm working on the pharmacokinetics of an antiCD20 mAb; I
> > suspect the clearance of this mAb should be time dependent as
> > rituximab’s clearance do. I tried to model this behavior but I’m
> > not sure if the ODEs are correct. Please can you help? I share
> > part of the code.
> >
> > $SUBROUTINE ADVAN13 TOL=9
> > $MODEL  COMP=(CENTRAL) COMP=(PERIPH1)
> > $PK
> > ; STRUCTURAL PARAMETERS --
> > TVCL1   = THETA(2)  ; system-nonspecific clearance
> > TVV1   = THETA(3)
> > TVQ= THETA(4)
> > TVV2   = THETA(5)
> > TVKDES = THETA(6)  ; rate constant of the specific clearance
> decay
> > TVCL2  = THETA(7)  ; time varying clearance at time zero
> > ; MU_TRANSFORMATION --
> > MU_1   = LOG(TVCL1)
> > MU_2   = LOG(TVV1)
> > MU_3   = LOG(TVQ)
> > MU_4   = LOG(TVV2)
> > MU_5   = LOG(TVKDES)
> > MU_6   = LOG(TVCL2)
> > ; INDIVIDUAL PARAMETERS --
> > CL1  = EXP(MU_1+ETA(1))
> > V1   = EXP(MU_2+ETA(2))
> > Q= EXP(MU_3+ETA(3))
> > V2   = EXP(MU_4+ETA(4))
> > KDES = EXP(MU_5+ETA(5))
> > CL2   = EXP(MU_6+ETA(6))
> > S1  = V1
> > ; INITIAL CONDITIONS --
> > A_0(1) = 0
> > A_0(2) = 0
> > CL2_TIME = CL2*EXP((-KDES)*(TIME))
> > CL_TOTAL = CL2_TIME + CL1 ; total clearance
> > ; DES --
> > $DES
> > CONC   = A(1)/V1
> > DADT(1) =-(CL_TOTAL/V1)*A(1)-(Q/V1)*A(1)+(Q/V2)*A(2)
> > DADT(2) = (Q/V1)*A(1)-(Q/V2)*A(2)
> > ;$ERROR --
> > CONC1 = A(1)/V1
> > IPRED=-3
> > IF(CONC1.GT.0) IPRED=LOG(CONC1)
> > W = THETA(1)
> > Y =  IPRED+W*EPS(1)
> > IRES=DV-IPRED
> > IWRES=IRES/W
> >
> > Thank you,
> > Niurys
> >
> > MSc Niurys de Castro Suárez
> > Assistant Professor of Pharmacometrics
> > Assistant Research
> > Pharmacy Department
> > Institute of Pharmacy and Food,
> > University of Havana
> > Cuba
> >
>
>


Re: [NMusers] Help with ODEs for a time varying clearance

2021-07-22 Thread Leonid Gibiansky
PK block is executed only once per record so CL(TIME) is constant 
between records, while in the DES block T (time) changes continuously, 
thus implementing time dependence CL(T) exactly rather than 
approximately. The rest is fine.

Thanks
Leonid

On 7/22/2021 4:19 PM, Niurys.CS wrote:

Dear Leonid,
Thanks for yor suggestion. I've never thought in that possibility.  
However, I have two questions:

1-Why must I write those equations inside $DES?
2-Do you think the ODE that I proposed are Ok?

Thank you very much

MSc Niurys de Castro Suárez
Assistant Professor of Pharmacometrics
Assistant Research
Pharmacy Department
Institute of Pharmacy and Food,
University of Havana
Cuba

El 22/07/2021 16:04, "Leonid Gibiansky" > escribió:


Definition of CL should be moved inside the DES block; other than
that, looks fine:
; DES --
$DES
CL2_TIME = CL2*EXP(-KDES*T)
CL_TOTAL = CL2_TIME + CL1 ; total clearance
...

Thanks
Leonid


On 7/22/2021 3:30 PM, Niurys.CS wrote:

Dear nmusers,
I'm working on the pharmacokinetics of an antiCD20 mAb; I
suspect the clearance of this mAb should be time dependent as
rituximab’s clearance do. I tried to model this behavior but I’m
not sure if the ODEs are correct. Please can you help? I share 
part of the code.


$SUBROUTINE ADVAN13 TOL=9
$MODEL  COMP=(CENTRAL) COMP=(PERIPH1)
$PK
; STRUCTURAL PARAMETERS --
TVCL1   = THETA(2)  ; system-nonspecific clearance
TVV1   = THETA(3)
TVQ    = THETA(4)
TVV2   = THETA(5)
TVKDES = THETA(6)  ; rate constant of the specific clearance decay
TVCL2  = THETA(7)  ; time varying clearance at time zero
; MU_TRANSFORMATION --
MU_1   = LOG(TVCL1)
MU_2   = LOG(TVV1)
MU_3   = LOG(TVQ)
MU_4   = LOG(TVV2)
MU_5   = LOG(TVKDES)
MU_6   = LOG(TVCL2)
; INDIVIDUAL PARAMETERS --
CL1  = EXP(MU_1+ETA(1))
V1   = EXP(MU_2+ETA(2))
Q    = EXP(MU_3+ETA(3))
V2   = EXP(MU_4+ETA(4))
KDES = EXP(MU_5+ETA(5))
CL2   = EXP(MU_6+ETA(6))
S1  = V1
; INITIAL CONDITIONS --
A_0(1) = 0
A_0(2) = 0
CL2_TIME = CL2*EXP((-KDES)*(TIME))
CL_TOTAL = CL2_TIME + CL1 ; total clearance
; DES --
$DES
    CONC   = A(1)/V1
    DADT(1) =-(CL_TOTAL/V1)*A(1)-(Q/V1)*A(1)+(Q/V2)*A(2)
    DADT(2) = (Q/V1)*A(1)-(Q/V2)*A(2)
;$ERROR --
CONC1 = A(1)/V1
IPRED=-3
IF(CONC1.GT.0) IPRED=LOG(CONC1)
W = THETA(1)
Y =  IPRED+W*EPS(1)
IRES=DV-IPRED
IWRES=IRES/W

Thank you,
Niurys

MSc Niurys de Castro Suárez
Assistant Professor of Pharmacometrics
Assistant Research
Pharmacy Department
Institute of Pharmacy and Food,
University of Havana
Cuba





Re: [NMusers] Help with ODEs for a time varying clearance

2021-07-22 Thread Paolo Denti
Dear Niurys,
I have not checked the whole code, but something I spotted as incorrect is the 
use of TIME.

The variable TIME only changes in a discrete way with the time of events in the 
dataset (e.g. doses or samples).

If you want something truly "continuous" you need to use the variable T and 
define inside the $DES block all the variables that depend on T (and are 
therefore time varying).

In your case, you should move the equations calculating the CL to $DES and use 
T instead of TIME.

...
; DES --
$DES
CL2_TIME = CL2*EXP((-KDES)*(T))
CL_TOTAL = CL2_TIME + CL1 ; total clearance
...

For more info, I'd google TIME vs T DES Nonmem, I think there is a tutorial by 
Nick about this.

I hope this helps.

Good luck!
Paolo





On 22 July 2021 21:41:43 "Niurys.CS"  wrote:

CAUTION: This email originated outside the UCT network. Do not click any links 
or open attachments unless you know and trust the source.


Dear nmusers,
I'm working on the pharmacokinetics of an antiCD20 mAb; I suspect the clearance 
of this mAb should be time dependent as rituximab’s clearance do. I tried to 
model this behavior but I’m not sure if the ODEs are correct. Please can you 
help? I share  part of the code.

$SUBROUTINE ADVAN13 TOL=9
$MODEL  COMP=(CENTRAL) COMP=(PERIPH1)
$PK
; STRUCTURAL PARAMETERS --
TVCL1   = THETA(2)  ; system-nonspecific clearance
TVV1   = THETA(3)
TVQ= THETA(4)
TVV2   = THETA(5)
TVKDES = THETA(6)  ; rate constant of the specific clearance decay
TVCL2  = THETA(7)  ; time varying clearance at time zero
; MU_TRANSFORMATION --
MU_1   = LOG(TVCL1)
MU_2   = LOG(TVV1)
MU_3   = LOG(TVQ)
MU_4   = LOG(TVV2)
MU_5   = LOG(TVKDES)
MU_6   = LOG(TVCL2)
; INDIVIDUAL PARAMETERS --
CL1  = EXP(MU_1+ETA(1))
V1   = EXP(MU_2+ETA(2))
Q= EXP(MU_3+ETA(3))
V2   = EXP(MU_4+ETA(4))
KDES = EXP(MU_5+ETA(5))
CL2   = EXP(MU_6+ETA(6))
S1  = V1
; INITIAL CONDITIONS --
A_0(1) = 0
A_0(2) = 0
CL2_TIME = CL2*EXP((-KDES)*(TIME))
CL_TOTAL = CL2_TIME + CL1 ; total clearance
; DES --
$DES
  CONC   = A(1)/V1
  DADT(1) =-(CL_TOTAL/V1)*A(1)-(Q/V1)*A(1)+(Q/V2)*A(2)
  DADT(2) = (Q/V1)*A(1)-(Q/V2)*A(2)
;$ERROR --
CONC1 = A(1)/V1
IPRED=-3
IF(CONC1.GT.0) IPRED=LOG(CONC1)
W = THETA(1)
Y =  IPRED+W*EPS(1)
IRES=DV-IPRED
IWRES=IRES/W

Thank you,
Niurys

MSc Niurys de Castro Suárez
Assistant Professor of Pharmacometrics
Assistant Research
Pharmacy Department
Institute of Pharmacy and Food,
University of Havana
Cuba

Disclaimer - University of Cape Town This email is subject to UCT policies and 
email disclaimer published on our website at 
http://www.uct.ac.za/main/email-disclaimer or obtainable from +27 21 650 9111. 
If this email is not related to the business of UCT, it is sent by the sender 
in an individual capacity. Please report security incidents or abuse via 
https://csirt.uct.ac.za/page/report-an-incident.php.


Re: [NMusers] Help with ODEs for a time varying clearance

2021-07-22 Thread Niurys.CS
Dear Leonid,
Thanks for yor suggestion. I've never thought in that possibility.
However, I have two questions:
1-Why must I write those equations inside $DES?
2-Do you think the ODE that I proposed are Ok?

Thank you very much

MSc Niurys de Castro Suárez
Assistant Professor of Pharmacometrics
Assistant Research
Pharmacy Department
Institute of Pharmacy and Food,
University of Havana
Cuba
El 22/07/2021 16:04, "Leonid Gibiansky" 
escribió:

> Definition of CL should be moved inside the DES block; other than that,
> looks fine:
> ; DES --
> $DES
> CL2_TIME = CL2*EXP(-KDES*T)
> CL_TOTAL = CL2_TIME + CL1 ; total clearance
> ...
>
> Thanks
> Leonid
>
>
> On 7/22/2021 3:30 PM, Niurys.CS wrote:
>
>> Dear nmusers,
>> I'm working on the pharmacokinetics of an antiCD20 mAb; I suspect the
>> clearance of this mAb should be time dependent as rituximab’s clearance do.
>> I tried to model this behavior but I’m not sure if the ODEs are correct.
>> Please can you help? I share  part of the code.
>>
>> $SUBROUTINE ADVAN13 TOL=9
>> $MODEL  COMP=(CENTRAL) COMP=(PERIPH1)
>> $PK
>> ; STRUCTURAL PARAMETERS --
>> TVCL1   = THETA(2)  ; system-nonspecific clearance
>> TVV1   = THETA(3)
>> TVQ= THETA(4)
>> TVV2   = THETA(5)
>> TVKDES = THETA(6)  ; rate constant of the specific clearance decay
>> TVCL2  = THETA(7)  ; time varying clearance at time zero
>> ; MU_TRANSFORMATION --
>> MU_1   = LOG(TVCL1)
>> MU_2   = LOG(TVV1)
>> MU_3   = LOG(TVQ)
>> MU_4   = LOG(TVV2)
>> MU_5   = LOG(TVKDES)
>> MU_6   = LOG(TVCL2)
>> ; INDIVIDUAL PARAMETERS --
>> CL1  = EXP(MU_1+ETA(1))
>> V1   = EXP(MU_2+ETA(2))
>> Q= EXP(MU_3+ETA(3))
>> V2   = EXP(MU_4+ETA(4))
>> KDES = EXP(MU_5+ETA(5))
>> CL2   = EXP(MU_6+ETA(6))
>> S1  = V1
>> ; INITIAL CONDITIONS --
>> A_0(1) = 0
>> A_0(2) = 0
>> CL2_TIME = CL2*EXP((-KDES)*(TIME))
>> CL_TOTAL = CL2_TIME + CL1 ; total clearance
>> ; DES --
>> $DES
>>CONC   = A(1)/V1
>>DADT(1) =-(CL_TOTAL/V1)*A(1)-(Q/V1)*A(1)+(Q/V2)*A(2)
>>DADT(2) = (Q/V1)*A(1)-(Q/V2)*A(2)
>> ;$ERROR --
>> CONC1 = A(1)/V1
>> IPRED=-3
>> IF(CONC1.GT.0) IPRED=LOG(CONC1)
>> W = THETA(1)
>> Y =  IPRED+W*EPS(1)
>> IRES=DV-IPRED
>> IWRES=IRES/W
>>
>> Thank you,
>> Niurys
>>
>> MSc Niurys de Castro Suárez
>> Assistant Professor of Pharmacometrics
>> Assistant Research
>> Pharmacy Department
>> Institute of Pharmacy and Food,
>> University of Havana
>> Cuba
>>
>>


Re: [NMusers] Help with ODEs for a time varying clearance

2021-07-22 Thread Leonid Gibiansky
Definition of CL should be moved inside the DES block; other than that, 
looks fine:

; DES --
$DES
CL2_TIME = CL2*EXP(-KDES*T)
CL_TOTAL = CL2_TIME + CL1 ; total clearance
...

Thanks
Leonid


On 7/22/2021 3:30 PM, Niurys.CS wrote:

Dear nmusers,
I'm working on the pharmacokinetics of an antiCD20 mAb; I suspect the 
clearance of this mAb should be time dependent as rituximab’s clearance 
do. I tried to model this behavior but I’m not sure if the ODEs are 
correct. Please can you help? I share  part of the code.


$SUBROUTINE ADVAN13 TOL=9
$MODEL  COMP=(CENTRAL) COMP=(PERIPH1)
$PK
; STRUCTURAL PARAMETERS --
TVCL1   = THETA(2)  ; system-nonspecific clearance
TVV1   = THETA(3)
TVQ    = THETA(4)
TVV2   = THETA(5)
TVKDES = THETA(6)  ; rate constant of the specific clearance decay
TVCL2  = THETA(7)  ; time varying clearance at time zero
; MU_TRANSFORMATION --
MU_1   = LOG(TVCL1)
MU_2   = LOG(TVV1)
MU_3   = LOG(TVQ)
MU_4   = LOG(TVV2)
MU_5   = LOG(TVKDES)
MU_6   = LOG(TVCL2)
; INDIVIDUAL PARAMETERS --
CL1  = EXP(MU_1+ETA(1))
V1   = EXP(MU_2+ETA(2))
Q    = EXP(MU_3+ETA(3))
V2   = EXP(MU_4+ETA(4))
KDES = EXP(MU_5+ETA(5))
CL2   = EXP(MU_6+ETA(6))
S1  = V1
; INITIAL CONDITIONS --
A_0(1) = 0
A_0(2) = 0
CL2_TIME = CL2*EXP((-KDES)*(TIME))
CL_TOTAL = CL2_TIME + CL1 ; total clearance
; DES --
$DES
   CONC   = A(1)/V1
   DADT(1) =-(CL_TOTAL/V1)*A(1)-(Q/V1)*A(1)+(Q/V2)*A(2)
   DADT(2) = (Q/V1)*A(1)-(Q/V2)*A(2)
;$ERROR --
CONC1 = A(1)/V1
IPRED=-3
IF(CONC1.GT.0) IPRED=LOG(CONC1)
W = THETA(1)
Y =  IPRED+W*EPS(1)
IRES=DV-IPRED
IWRES=IRES/W

Thank you,
Niurys

MSc Niurys de Castro Suárez
Assistant Professor of Pharmacometrics
Assistant Research
Pharmacy Department
Institute of Pharmacy and Food,
University of Havana
Cuba