RE: if-the-statement for 3 class categorical covariate
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
Quoted reply history
-----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