Hi,

NM-TRAN has some restrictions on its language so that it can do the really tricky stuff behind the scenes that is needed to create the FORTRAN that NONMEM uses. These restrictions apply tocoding conditional statements.

First of all you cannot have nested IF-THEN-ELSE blocks with NM-TRAN if they include random variables. The NM-TRAN error message states this if you try this.
 326  RANDOM VARIABLE IS DEFINED IN A NESTED IF STRUCTURE.

The example provided by Bernard is a nested structure containing random effects (ETA variables). As coded by Bernard it is not legal. ENDIF statements are always required for every IF-THEN. So the 'crash' experienced by Bernard was caused by not following the rules.

I have re-coded it below to show the nested structure. However, this will fail in NM-TRAN because of the use of ETA variables in the expressions.

IF (GENE.EQ.3) THEN           ;GG
    CL = THETA(1)* EXP(ETA(1))
ELSE
   IF (GENE.EQ.2)THEN       ;GT
      CL = THETA(6)* EXP(ETA(3))
      IF (GENE.EQ.1) THEN           ;TT
         CL = THETA(7)* EXP(ETA(4))
         IF (GENE.EQ.4) THEN           ;MISSING
           CL = THETA(7)* EXP(ETA(4))
         ENDIF
      ENDIF
   ENDIF
ENDIF

The second rule is that one line IF statements cannot include THEN so the suggestion from Bill won't work. It needs to be written like this:

IF (GENE.EQ.3) CL = THETA(1)* EXP(ETA(1)) ;GG
IF (GENE.EQ.2) CL = THETA(6)* EXP(ETA(3)) ;GT
IF (GENE.EQ.1) CL = THETA(7)* EXP(ETA(4)) ;TT
IF (GENE.EQ.4) CL = THETA(7)* EXP(ETA(4)) ;MISSING



Best wishes,

Nick

On 25/07/2013 4:54 p.m., Denney, William S. wrote:
Hi Bernard,

Try using just IF statements instead of including the ELSE IF and END IF like 
this:

IF (GENE.EQ.3) THEN CL = THETA(1)* EXP(ETA(1)) ;GG
IF (GENE.EQ.2) THEN CL = THETA(6)* EXP(ETA(3)) ;GT
IF (GENE.EQ.1) THEN CL = THETA(7)* EXP(ETA(4)) ;TT
IF (GENE.EQ.4) THEN CL = THETA(7)* EXP(ETA(4)) ;MISSING

It's also worth verifying that GENE is always 1 to 4.  The crash could be 
happening because you have a value other than 1 to 4.  A way around this is to 
have a default value and then only apply changes like:

CL = THETA(7)* EXP(ETA(4)) ; for TT or MISSING
IF (GENE.EQ.3) THEN CL = THETA(1)* EXP(ETA(1)) ;GG
IF (GENE.EQ.2) THEN CL = THETA(6)* EXP(ETA(3)) ;GT

That will ensure that it works for all cases and will generally be more robust 
code.

Thanks,

Bill

-----Original Message-----
From: [email protected] [mailto:[email protected]] On 
Behalf Of Bernard Ngara
Sent: Thursday, July 25, 2013 10:09 AM
To: nmusers
Subject: [NMusers] if-the-statement for 3 class categorical covariate

Dear all

I am shoked because NONMEM sents a crash message when i factor in covariate 
modeling using a 4 class categorical variable genotype:
IF (GENE.EQ.3) THEN           ;GG
         CL = THETA(1)* EXP(ETA(1))
     ELSE IF (GENE.EQ.2)THEN       ;GT
         CL = THETA(6)* EXP(ETA(3))
     IF (GENE.EQ.1) THEN           ;TT
         CL = THETA(7)* EXP(ETA(4))
     IF (GENE.EQ.4) THEN           ;MISSING
         CL = THETA(7)* EXP(ETA(4))
     END IF
However if i binarize the code, nonmem runs successfully IF (GENE.EQ.3) THEN
         CL = THETA(1)* EXP(ETA(1))
     ELSE
         CL = THETA(6)* EXP(ETA(3))

     END IF

Thanks in advance
--
Bernard Ngara
Trainee Biostatistician
Africa Institute of Biomedical Science and Technology P. O Box 2294 Harare 
Zimbabwe
+263 772 160 896

--
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
office:+64(9)923-6730 mobile:NZ +64(21)46 23 53 FR +33(7)85 36 84 99
email: [email protected]
http://holford.fmhs.auckland.ac.nz/

Holford NHG. Disease progression and neuroscience. Journal of Pharmacokinetics 
and Pharmacodynamics. 2013;40:369-76 
http://link.springer.com/article/10.1007/s10928-013-9316-2
Holford N, Heo Y-A, Anderson B. A pharmacokinetic standard for babies and 
adults. J Pharm Sci. 2013: 
http://onlinelibrary.wiley.com/doi/10.1002/jps.23574/abstract
Holford N. A time to event tutorial for pharmacometricians. CPT:PSP. 2013;2: 
http://www.nature.com/psp/journal/v2/n5/full/psp201318a.html
Holford NHG. Clinical pharmacology = disease progression + drug action. British 
Journal of Clinical Pharmacology. 2013: 
http://onlinelibrary.wiley.com/doi/10.1111/bcp.12170/abstract


Reply via email to