Model building advice

8 messages 5 people Latest: May 19, 2005

Model building advice

From: Doug J. Eleveld Date: April 27, 2005 technical
From: "Eleveld, DJ" d.j.eleveld@anest.umcg.nl Subject: [NMusers] Model building advice Date: Wed, April 27, 2005 10:39 am Hello everyone, I am having difficulties getting a model to work with NONMEM and I hope someone can give me some advice. During simulation one model state variable must undergo step changes of various sizes at certain events. Between these events the same variable decays towards zero. I cant code the step changes as 'doses' directly in the input file because the size of the step change depends on the state of other variables in the simulation. When I try to code these step changes in DADT() portions of $DES there are endless problems with integration. My current best attempt uses COM variabels to force the step change but i get ERROR IN LSODI1: CODE 205 MESSAGE ISSUED FROM TABLE STEP even from simulation. I think being able to manipulate the A() values from within $DES would help, but NONMEM does not allow this. Another possibility would be to simulate a 'dose' to a compartment from within the $DES code but I dont know if this is possible. Does anyone have any advice as to how I can force step-like changes to a model state varaible in a way that NONMEMs integration routines can handle it? Thank you, Doug Eleveld

Re: Model building advice

From: Leonid Gibiansky Date: April 27, 2005 technical
From: "Leonid Gibiansky" leonidg@metrumrg.com Subject: Re: [NMusers] Model building advice Date: Wed, April 27, 2005 11:19 am It is hard to understand without an example what exactly you trying to achieve, but you may be able to code your step changes as doses, and then change the steps during the computation using the bioavailability parameter (that may reduce or increase the dose depending on other variables) Leonid

RE: Model building advice

From: William Bachman Date: April 27, 2005 technical
From: "Bachman, William (MYD)" bachmanw@iconus.com Subject: RE: [NMusers] Model building advice Date: Wed, April 27, 2005 2:52 pm Generally, these "I got this error message" but not sharing the control stream and sufficient data to reproduce the message (either disguised data or simulated to protect the guilty) lead to lots of general and not very helpful suggestions. If you can't or won't be more specific, a consultant may be the way to go.

RE: Model building advice

From: Serge Guzy Date: April 27, 2005 technical
From: "Serge Guzy" GUZY@xoma.com Subject: RE: [NMusers] Model building advice Date: Wed, April 27, 2005 3:51 pm I do agree with Bill that no information is given here to help you out. Only one suggestion may be has some value. If you know the times at which your state variable variable undergo step changes, you must create nodes in your integration routines, each node corresponding to the times at which a discrete change in the state variable(s) occur. I believe that at each node, the previous integration step allows you to know the step change of the state variable and this will automatically generate a new initial condition for that state variable for the next integration step. If you do not cut your problem in pieces, then no integration routine will work because of the gradient discontinuity caused by the step change at the node positions Serge Guzy President POP_PHARM

RE: Model building advice

From: Doug J. Eleveld Date: April 28, 2005 technical
From: "Eleveld, DJ" d.j.eleveld@anest.umcg.nl Subject: RE: [NMusers] Model building advice Date: Thu, April 28, 2005 7:04 am Thank you for your suggestions... Serge, i'm not exactly sure what you mean by 'node' in the intergration routine, do you mean event? I tried to use the bioavalibility parameter as Leonid Gibiansky suggested in a mail to me. I added dose events (fixed size) at the appropriate times into the appropriate compartment and manipulate the bioavalibility to change the size of step but this does not work. I am not allowed to change bioavalability constants in the $DES code. Neither may I change bioavailability in the $ERROR code. When using fixed dose sizes and and fixed bioavalibility then all the step changes will be the same. But I need the size of the step change to change during the integration. To better describe what I mean by step change in state variable, essentially what I would like to have in my $DES and $ERROR code is: $DES ... DADT(5)=-POTK*A(5) ; Decay bewteen twitches ... $ERROR CALLFL=0 ... STEP=.... A(5)=A(5)+STEP ; Produce the step change But I cannot manipulate A(5) within the $ERROR code. The relevant part of the control stream is: (error line at the bottom) -------Control stream-------- $PROB Potentiation fitting $DATA potent.da2 $INPUT ID TIME DV CFLG MDV AMT RATE CMT $SUBROUTINES ADVAN9 TOL=3 $MODEL NCOMPARTMENTS=5 NPARAMETERS=12 COMP(CENTRAL DEFDOSE) COMP(PERIF1 NOOFF NODOSE) COMP(PERIF2 NOOFF NODOSE) COMP(EFFECT NOOFF NODOSE) COMP(POTENT NOOFF) $PK CALLFL=1 V1=THETA(1)*EXP(ETA(1)) V2=THETA(2)*EXP(ETA(2)) V3=THETA(3)*EXP(ETA(3)) CL=THETA(4)*EXP(ETA(4)) Q3=THETA(6)*EXP(ETA(6)) Q2=(THETA(2)*(THETA(6)/THETA(3) + THETA(5)))*EXP(ETA(5)) S1=V1 KEO=THETA(7)*EXP(ETA(7)) EC50=THETA(8)*EXP(ETA(8)) GAMM=THETA(9)*EXP(ETA(9)) POTR=THETA(10)+ETA(10) ; r has normal dist POTK=THETA(11)*EXP(ETA(11)) SCAL=THETA(12)*EXP(ETA(12)) $DES C1=A(1)/V1 ; Conc in V1 C2=A(2)/V2 ; Conc in V2 C3=A(3)/V3 ; Conc in V3 DADT(1)=Q2*(C2-C1)+Q3*(C3-C1)-CL*C1 ; Change in V1 DADT(2)=Q2*(C1-C2) ; Change in V2 DADT(3)=Q3*(C1-C3) ; Change in V3 DADT(4)=(C1-A(4))*KEO ; Effect compartment conc DADT(5)=-POTK*A(5) ; Decay potentiation $ERROR CALLFL=0 PTMP=A(5) CPRE=A(1)/V1*EXP(ERR(1)) PD1=A(4)**GAMM ; Sigmoidal Emax model NMB=PD1/(PD1+(EC50**GAMM)) RPRE=SCAL*(1+A(5))*(1-NMB)+ERR(2) ; Twitch in % IF (DV.EQ.-999) RPRE=-999+ERR(2) Y=CFLG*CPRE+(1-CFLG)*RPRE ; *** Step change once per twitch *** ERROR *** IF (CFLG.NE.0) A(5)=A(5)+POTR*(1-NMB) I hope this makes more clear what I mean by 'step' change in state variable. Does anyone have any advice as to how I can achieve this kind of effect? Thanks very much, Doug Eleveld

RE: Model building advice

From: Ekaterina Gibiansky Date: April 28, 2005 technical
From: "Ekaterina Gibiansky" GibianskyE@guilfordpharm.com Subject: RE: [NMusers] Model building advice Date: Thu, April 28, 2005 9:08 am Doug, bioavailability approach should work, but not by inserting F in the DES block. You may reserve a place in the COMMON BLOCK using COM variable ($ABBREV COMRES=1). In the error block you can change it (ex, COM(1)= POTR*(1-NMB)), and in $PK block you can change F5, when certain conditions are met (IF(...) F5 = (COM(1)). You may need to insert the second record with the same time and with a dose, if you want to test for condition and add the dose to compartment 5 at the same time. Otherwise, it'll change COM(1) in the error block, but will change F at the time of the next record. And if the condition that you set is false in the next record, F will not be changed. Katya Ekaterina Gibiansky, PhD Head, Pharmacometrics Guilford Pharmaceuticals Inc Phone: (410)-631-6828 Fax: (410)-631-6828 E-mail: gibianskye@guilfordpharm.com

Follow up: Model building advice

From: Doug J. Eleveld Date: May 19, 2005 technical
From: "Eleveld, DJ" d.j.eleveld@anest.umcg.nl Subject: [NMusers] Follow up: Model building advice Date: Thu, May 19, 2005 7:01 am Thanks everyone for the model building advice. I implemented Katya's advice and used COM(1) for communication between $ERROR and $PK to set the appropriate bioavailibility and added dose records at the appropriate times in the datafile. This almost doubled the amount of records to about 6100 and as expected also increased runtimes. The code looks clean and simulations are visually quite reasonable. But I still cant get any estimation methods to converge. Using the FO method to start here is a brief summary my results so far: Using ADVAN6: ------------- 0MINIMIZATION TERMINATED DUE TO MAX. NO. OF FUNCTION EVALUATIONS EXCEEDED NO. OF FUNCTION EVALUATIONS USED:10024 NO. OF SIG. DIGITS UNREPORTABLE The resulting theta values are completly unreasonable so I cant use them to try and improve the inital theta values. Using ADVAN9: ------------- ERROR IN LSODI1: CODE 204 0PROGRAM TERMINATED BY OBJ MESSAGE ISSUED FROM ESTIMATION STEP Using ADVAN8: ------------- Nonmem has been running for more than 48 hours now and still no results. This is too long for a FO method? Should I assume that something has gone wrong? Here is my control file: ------------------------ $PROB Potentiation fitting $DATA potent.da2 $INPUT ID TIME DV CFLG MDV AMT RATE CMT $SUBROUTINES ADVAN9 TOL=6 $ABBREVIATED COMRES=1 $MODEL NCOMPARTMENTS=5 NPARAMETERS=12 COMP(CENTRAL DEFDOSE) COMP(PERIF1 NOOFF NODOSE) COMP(PERIF2 NOOFF NODOSE) COMP(EFFECT NOOFF NODOSE) COMP(POTENT NOOFF) $PK V1=THETA(1)*EXP(ETA(1)) V2=THETA(2)*EXP(ETA(2)) V3=THETA(3)*EXP(ETA(3)) CL=THETA(4)*EXP(ETA(4)) Q3=THETA(6)*EXP(ETA(6)) Q2=(THETA(2)*(THETA(6)/THETA(3) + THETA(5)))*EXP(ETA(5)) S1=V1 KEO=THETA(7)*EXP(ETA(7)) EC50=THETA(8)*EXP(ETA(8)) GAMM=THETA(9)*EXP(ETA(9)) POTR=ABS(THETA(10)+ETA(10)) ; r has normal dist POTK=THETA(11)*EXP(ETA(11)) SCAL=THETA(12)+ETA(12) ; scale has normal dist IF (NEWIND.EQ.0) COM(1)=0 F5=POTR*(1-COM(1)) $DES C1=A(1)/V1 ; Conc in V1 C2=A(2)/V2 ; Conc in V2 C3=A(3)/V3 ; Conc in V3 DADT(1)=Q2*(C2-C1)+Q3*(C3-C1)-CL*C1 ; Change in V1 DADT(2)=Q2*(C1-C2) ; Change in V2 DADT(3)=Q3*(C1-C3) ; Change in V3 DADT(4)=(C1-A(4))*KEO ; Effect compartment conc DADT(5)=-POTK*A(5) ; Decay potentiation $ERROR DPOT=A(5) ; The degree of potentiation IF (DPOT.LT.0) DPOT=0 CEFF=A(4) IF (CEFF.LT.0) CEFF=0 DPD1=CEFF**GAMM ; Degree of NMB NMB=DPD1/(DPD1+(EC50**GAMM)) COM(1)=NMB CPRE=A(1)/V1*EXP(ERR(1)) ; Conc prediction RPRE=SCAL*(1+DPOT)*(1-NMB)+ERR(2) ; Twitch prediction IF (DV.EQ.-999) RPRE=-999+ERR(2) ; Missing twitch sizes Y=CFLG*CPRE+(1-CFLG)*RPRE $THETA (0,0.042,0.07)(0,0.041,0.08)(0,0.089,0.15) (0,0.003,0.03)(0,0.005,1)(0,0.001,0.01) (0.05,0.15,0.3)(1100,1500,1800)(3,4.5,5.5) (0,0.006,0.006)(0.01,0.10,0.35)(90,100,110) $OMEGA 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.001 0.04 2. $SIGMA 0.2 1. $ESTIMATION MAX=9999 SIG=6 ;$SIMULATION (434, 372) (2, 3) ONLY ;$ESTIMATION MAX=9999 SIG=3 METHOD=COND NOABORT POSTHOC ;$ESTIMATION MAX=9999 NOABORT POSTHOC $TABLE TIME V1 V2 V3 CL Q2 Q3 NOPRINT FILE=potent1.txt $TABLE TIME KEO EC50 GAMM POTR POTK SCAL NOPRINT FILE=potent2.txt $TABLE TIME NMB CPRE RPRE DPOT NOPRINT FILE=potent3.txt Thanks, Doug Eleveld

Re: Follow up: Model building advice

From: Leonid Gibiansky Date: May 19, 2005 technical
From: "Leonid Gibiansky" leonidg@metrumrg.com Subject: Re: [NMusers] Follow up: Model building advice Date: Thu, May 19, 2005 7:39 am You have too many random effects. Try to restrict it to 4-5, at least initially: CL,V,KE0,EMAX. If this would run, add new ones if needed. But the problem may be deeper: with new doses, you introduce jumps in the solution while gradient methods (that are in the foundation of nonmem search algorithms) and objective function approximations do not like jumps. You may need to look for a more smooth approximation of your jumps (something like a sharp sigmoid rather than a jump in the solution) if this is possible. Leonid _______________________________________________________