Re: RANDOM VARIABLE IS DEFINED IN A NESTED IF STRUCTURE

From: Nick Holford Date: January 29, 2013 technical Source: mail-archive.com
Yanke Yu, NM-TRAN (like Berkeley Madonna) can be used to code nested IF statements if no random effect variables are included. But because NM-TRAN does some quite complex translation of abbreviated code it is not possible to automatically translate IF statements which contain random effect variables. This can always be worked around by slightly more complex and less efficient code that still leads to the correct solution. With your problem you could replace the nested IF structure with 3 separate IF statements. For example, change this: IF (OCCUPANCY.LE..3) THEN INH = 0 ELSEIF (OCCUPANCY.LE..9.AND.OCCUPANCY.GE..3) THEN INH = OCCUPANCY*5/3-0.5 ELSE INH = 1 ENDIF to this: IF (OCCUPANCY.LT.0.3) THEN INH = 0 ENDIF IF (OCCUPANCY.LE.0.9.AND.OCCUPANCY.GE.0.3) THEN INH = OCCUPANCY*5/3-0.5 ENDIF IF (OCCUPANCY.GT.0.9) THEN INH = 1 ENDIF Personally I would not use this kind of model because I don't believe it is pharmacologically plausible to imagine that inhibitory effects relate to occupancy would change in this discontinuous way. I would use a continuous function such as a sigmoid Emax model to describe this kind of effect. Best wishes, Nick
Quoted reply history
On 29/01/2013 9:08 a.m., [email protected] wrote: > Dear NONMEM users: > > Regarding the use of IF ELSE statement in NONMEM, can it be used in the $DES block in between the differential equations? e.g. in my control stream attached below in blue, OCCUPANCY was defined by A(3) and A(4), OCCUPANCY was further used to define INH using IF ELSE statement, and last, INH was used in the A(5) and A(6) differential equations. Can NONMEM do this? The error message I received attached below in red is "RANDOM VARIABLE IS DEFINED IN A NESTED IF STRUCTURE". Berkeley-Madonna can do such analysis, I just try to see whether it can also work in NONMEM. > > If NONMEM can do this, how can I revise the code? > > Thanks for the help! > > Best, > > Yanke > > $DES > > DADT(1) = -CL/V1*A(1)+Q*(A(2)/Vt-A(1)/V1)-kon*(A(1)/V1)*(A(3)/Nbs)+koff*A(4) > > DADT(2) = Q*(-A(2)/Vt+A(1)/V1)-CL/Vt*A(2) > DADT(3) = -kL*A(3)-kon*(A(1)/V1)*(A(3)/Nbs)+koff*A(4)+PROD*A(6)*Nbs > DADT(4) = -kAL*A(4)+kon*(A(1)/V1)*(A(3)/Nbs)-koff*A(4) > > OCCUPANCY = A(4)/(A(4)+A(3)) > IF (OCCUPANCY.LE..3) THEN > INH = 0 > > ELSEIF (OCCUPANCY.LE..9.AND.OCCUPANCY.GE..3) THEN > INH = OCCUPANCY*5/3-0.5 > > ELSE > INH = 1 > ENDIF > > DADT(5) = Stc-kTC*A(5)-(1-INH)*ki*A(3)/Nbs*A(5)/V1 > DADT(6) = (1-INH)*ki*A(3)/Nbs*A(5)/V1-kIC*A(6) > > AN ERROR WAS FOUND IN THE CONTROL STATEMENTS. > > AN ERROR WAS FOUND ON LINE 79 AT THE APPROXIMATE POSITION NOTED: > ENDIF > X > 326 RANDOM VARIABLE IS DEFINED IN A NESTED IF STRUCTURE. -- Nick Holford, Professor Clinical Pharmacology Dept Pharmacology & Clinical Pharmacology, Bldg 503 Room 302A University of Auckland,85 Park Rd,Private Bag 92019,Auckland,New Zealand tel:+64(9)923-6730 fax:+64(9)373-7090 mobile:+64(21)46 23 53 email: [email protected] http://www.fmhs.auckland.ac.nz/sms/pharmacology/holford
Jan 28, 2013 Yanke_Yu RANDOM VARIABLE IS DEFINED IN A NESTED IF STRUCTURE
Jan 29, 2013 Nick Holford Re: RANDOM VARIABLE IS DEFINED IN A NESTED IF STRUCTURE