RE: [NMusers] unidentified cause of "F OR DERIVATIVE RETURNED BY PRED IS INFINITE (INF) OR NOT A NUMBER (NAN)"

2018-02-02 Thread Luu_Ken
Matthew,

I'm guessing this error occurs because you fix the $OMEGA BLOCK(1) for 
ETA_CL_OCC1 to 0. The way the model is parameterized, to get rid of the IOV, 
you only need to fix the OMG_CL_OCC to 0 in the $THETA block, and leave the 
$OMEGA BLOCK(1) for ETA_CL_OCC1 alone (fixed to 1). Agree with Leonid to reduce 
the IOVs to a more manageable number.

Ken

-Original Message-
From: owner-nmus...@globomaxnm.com [mailto:owner-nmus...@globomaxnm.com] On 
Behalf Of Leonid Gibiansky
Sent: Friday, February 02, 2018 7:13 AM
To: HUI, Ka Ho ; nmusers@globomaxnm.com
Subject: Re: [NMusers] unidentified cause of "F OR DERIVATIVE RETURNED BY PRED 
IS INFINITE (INF) OR NOT A NUMBER (NAN)"

I think this is overkill to have 10 occasions, and this could be a problem. Try 
to start first with 2 occasions (e.g, first 5 doses and the rest). If this 
works it means that it is just a numerical problem.
Also, just to check, try

Y=LOG(F+0.0001)+EPS_EXP

to remove the possibility of F=0.
Thanks
Leonid

On 2/2/2018 4:17 AM, HUI, Ka Ho wrote:
> Dear nmusers,
>
> I have trouble figuring out the cause of the error I am encountering:
>
> 0INDIVIDUAL NO.   1   ID= 2.00E+00
> (WITHIN-INDIVIDUAL) DATA REC NO.   2
>
> ...
>
> OCCURS DURING SEARCH FOR ETA AT INITIAL VALUE, ETA=0
>
> F OR DERIVATIVE RETURNED BY PRED IS INFINITE (INF) OR NOT A NUMBER (NAN).
>
> To my own experience, this error is usually due to some mistakes in
> the coding, such as the div/0 error occurring at the dosing record.
> However, for this time, after I eliminated a few other possible
> causes, it appears that the error will occur whenever I remove the
> occasional variability from the model (by fixing variability to ZERO),
> and this makes no sense to me.
>
> I have attached a minimal reproducible example at the bottom. Any help
> is appreciated and thank you for your attention.
>
> Best Regards,
>
> Matthew
>
> $SIZES  DIMTMP=1000
>
> $PROBLEMMODEL
>
> $INPUT  C ID DOSE_N AMT=DOSE_UM RATE=RATE_UM TIME CP_UM
> DV=CP_LN_UM MDV EVID
>
> $DATA   DATAFILE_TEST.csv IGNORE=@
>
> $SUBROUTINE ADVAN3 TRANS4
>
> $PK
>
> ;SETTING LLOQ
>
>  IF (NEWIND.EQ.0) THEN
>
>  LN_LLOQ=-2.
>
>  ENDIF
>
> ;INTEROCCASION VARIABILITY
>
>  OCC1=0
>
>  IF (DOSE_N.EQ.1) OCC1=1
>
>  OCC2=0
>
>  IF (DOSE_N.EQ.2) OCC2=1
>
>  OCC3=0
>
>  IF (DOSE_N.EQ.3) OCC3=1
>
>  OCC4=0
>
>  IF (DOSE_N.EQ.4) OCC4=1
>
>  OCC5=0
>
>  IF (DOSE_N.EQ.5) OCC5=1
>
>  OCC6=0
>
>  IF (DOSE_N.EQ.6) OCC6=1
>
>  OCC7=0
>
>  IF (DOSE_N.EQ.7) OCC7=1
>
>  OCC8=0
>
>  IF (DOSE_N.EQ.8) OCC8=1
>
>  OCC9=0
>
>  IF (DOSE_N.EQ.9) OCC9=1
>
>  OCC10=0
>
>  IF (DOSE_N.EQ.10) OCC10=1
>
>  OCC11=0
>
>  IF (DOSE_N.EQ.11) OCC11=1
>
>  OCC12=0
>
>  IF (DOSE_N.EQ.12) OCC12=1
>
> ;THETA DEFINITION
>
>  TVCL=THETA(1)
>
>  TVV1=THETA(2)
>
>  TVQ=THETA(3)
>
>  TVV2=THETA(4)
>
>  OMG_CL=THETA(5)
>
>  OMG_V1=THETA(6)
>
>  OMG_Q=THETA(7)
>
>  OMG_V2=THETA(8)
>
>  SGM_EXP=THETA(9)
>
>  OMG_CL_OCC=THETA(10)
>
> ;ETA DEFINITION
>
>  ETA_CL=OMG_CL*ETA(1)
>
>  ETA_V1=OMG_V1*ETA(2)
>
>  ETA_Q=OMG_Q*ETA(3)
>
>  ETA_V2=OMG_V2*ETA(4)
>
>
> ETA_CL_OCC=OMG_CL_OCC*(OCC1*ETA(5)+OCC2*ETA(6)+OCC3*ETA(7)+OCC4*ETA(8)
> +OCC5*ETA(9)+OCC6*ETA(10)+OCC7*ETA(11)+OCC8*ETA(12)+OCC9*ETA(13)+OCC10
> *ETA(14)+OCC11*ETA(15)+OCC12*ETA(16))
>
> ;EFFECT DEFINITION
>
> ;CLEARANCE
>
>  POP_CL=TVCL
>
>  CL=POP_CL*EXP(ETA_CL+ETA_CL_OCC)
>
> ;CENTRAL VOLUME
>
>  POP_V1=TVV1
>
>  V1=POP_V1*EXP(ETA_V1)
>
> ;INTERCOMPARTMENTAL CLEARANCE
>
>  POP_Q=TVQ
>
>  Q=POP_Q*EXP(ETA_Q)
>
> ;PERIPHERAL VOLUME
>
>  POP_V2=TVV2
>
>  V2=POP_V2*EXP(ETA_V2)
>
> ;REQUIRED CONSTANT
>
>  S1=V1
>
> $THETA
>
> (0,9,100) ;TVCL
>
> (0,18,100) ;TVV1
>
> (0,0.75,100) ;TVQ
>
> (0,7,100) ;TVV2
>
> (0,0.3,100) ;OMG_CL
>
> (0,0.3,100) ;OMG_V1
>
> (0,0.3,100) ;OMG_Q
>
> (0,0.3,100) ;OMG_V2
>
> (0,0.3,100) ;SGM_EXP
>
> (0,0.3,100) ;OMG_CL_OCC ;Change to 0 FIX to remove occasional
> variability
>
> $ERROR
>
> EPS_EXP=SGM_EXP*EPS(1)
>
> Y=LOG(F)+EPS_EXP
>
> $OMEGA BLOCK(1) 1  FIX  ;ETA_CL
>
> $OMEGA BLOCK(1) 1  FIX  ;ETA_V1
>
> $OMEGA BLOCK(1) 1  FIX  ;ETA_Q
>
> $OMEGA BLOCK(1) 1  FIX  ;ETA_V2
>
> $OMEGA B

Re: [NMusers] unidentified cause of "F OR DERIVATIVE RETURNED BY PRED IS INFINITE (INF) OR NOT A NUMBER (NAN)"

2018-02-02 Thread Leonid Gibiansky
I think this is overkill to have 10 occasions, and this could be a 
problem. Try to start first with 2 occasions (e.g, first 5 doses and the 
rest). If this works it means that it is just a numerical problem.

Also, just to check, try

Y=LOG(F+0.0001)+EPS_EXP

to remove the possibility of F=0.
Thanks
Leonid

On 2/2/2018 4:17 AM, HUI, Ka Ho wrote:

Dear nmusers,

I have trouble figuring out the cause of the error I am encountering:

0INDIVIDUAL NO.   1   ID= 2.00E+00   (WITHIN-INDIVIDUAL) 
DATA REC NO.   2


...

OCCURS DURING SEARCH FOR ETA AT INITIAL VALUE, ETA=0

F OR DERIVATIVE RETURNED BY PRED IS INFINITE (INF) OR NOT A NUMBER (NAN).

To my own experience, this error is usually due to some mistakes in the 
coding, such as the div/0 error occurring at the dosing record. However, 
for this time, after I eliminated a few other possible causes, it 
appears that the error will occur whenever I remove the occasional 
variability from the model (by fixing variability to ZERO), and this 
makes no sense to me.


I have attached a minimal reproducible example at the bottom. Any help 
is appreciated and thank you for your attention.


Best Regards,

Matthew

$SIZES      DIMTMP=1000

$PROBLEM    MODEL

$INPUT  C ID DOSE_N AMT=DOSE_UM RATE=RATE_UM TIME CP_UM DV=CP_LN_UM 
MDV EVID


$DATA   DATAFILE_TEST.csv IGNORE=@

$SUBROUTINE ADVAN3 TRANS4

$PK

;SETTING LLOQ

     IF (NEWIND.EQ.0) THEN

     LN_LLOQ=-2.

     ENDIF

;INTEROCCASION VARIABILITY

     OCC1=0

     IF (DOSE_N.EQ.1) OCC1=1

     OCC2=0

     IF (DOSE_N.EQ.2) OCC2=1

     OCC3=0

     IF (DOSE_N.EQ.3) OCC3=1

     OCC4=0

     IF (DOSE_N.EQ.4) OCC4=1

     OCC5=0

     IF (DOSE_N.EQ.5) OCC5=1

     OCC6=0

     IF (DOSE_N.EQ.6) OCC6=1

     OCC7=0

     IF (DOSE_N.EQ.7) OCC7=1

     OCC8=0

     IF (DOSE_N.EQ.8) OCC8=1

     OCC9=0

     IF (DOSE_N.EQ.9) OCC9=1

     OCC10=0

     IF (DOSE_N.EQ.10) OCC10=1

     OCC11=0

     IF (DOSE_N.EQ.11) OCC11=1

     OCC12=0

     IF (DOSE_N.EQ.12) OCC12=1

;THETA DEFINITION

     TVCL=THETA(1)

     TVV1=THETA(2)

     TVQ=THETA(3)

     TVV2=THETA(4)

     OMG_CL=THETA(5)

     OMG_V1=THETA(6)

     OMG_Q=THETA(7)

     OMG_V2=THETA(8)

     SGM_EXP=THETA(9)

     OMG_CL_OCC=THETA(10)

;ETA DEFINITION

     ETA_CL=OMG_CL*ETA(1)

     ETA_V1=OMG_V1*ETA(2)

     ETA_Q=OMG_Q*ETA(3)

     ETA_V2=OMG_V2*ETA(4)

 
ETA_CL_OCC=OMG_CL_OCC*(OCC1*ETA(5)+OCC2*ETA(6)+OCC3*ETA(7)+OCC4*ETA(8)+OCC5*ETA(9)+OCC6*ETA(10)+OCC7*ETA(11)+OCC8*ETA(12)+OCC9*ETA(13)+OCC10*ETA(14)+OCC11*ETA(15)+OCC12*ETA(16))


;EFFECT DEFINITION

;CLEARANCE

     POP_CL=TVCL

     CL=POP_CL*EXP(ETA_CL+ETA_CL_OCC)

;CENTRAL VOLUME

     POP_V1=TVV1

     V1=POP_V1*EXP(ETA_V1)

;INTERCOMPARTMENTAL CLEARANCE

     POP_Q=TVQ

     Q=POP_Q*EXP(ETA_Q)

;PERIPHERAL VOLUME

     POP_V2=TVV2

     V2=POP_V2*EXP(ETA_V2)

;REQUIRED CONSTANT

     S1=V1

$THETA

(0,9,100) ;TVCL

(0,18,100) ;TVV1

(0,0.75,100) ;TVQ

(0,7,100) ;TVV2

(0,0.3,100) ;OMG_CL

(0,0.3,100) ;OMG_V1

(0,0.3,100) ;OMG_Q

(0,0.3,100) ;OMG_V2

(0,0.3,100) ;SGM_EXP

(0,0.3,100) ;OMG_CL_OCC ;Change to 0 FIX to remove occasional 
variability


$ERROR

EPS_EXP=SGM_EXP*EPS(1)

Y=LOG(F)+EPS_EXP

$OMEGA BLOCK(1) 1  FIX  ;ETA_CL

$OMEGA BLOCK(1) 1  FIX  ;ETA_V1

$OMEGA BLOCK(1) 1  FIX  ;ETA_Q

$OMEGA BLOCK(1) 1  FIX  ;ETA_V2

$OMEGA BLOCK(1) 1  FIX  ;ETA_CL_OCC1    ;Change to 0 FIX to remove 
occasional variability


$OMEGA BLOCK(1) SAME  ;ETA_CL_OCC2

$OMEGA BLOCK(1) SAME  ;ETA_CL_OCC3

$OMEGA BLOCK(1) SAME  ;ETA_CL_OCC4

$OMEGA BLOCK(1) SAME  ;ETA_CL_OCC5

$OMEGA BLOCK(1) SAME  ;ETA_CL_OCC6

$OMEGA BLOCK(1) SAME  ;ETA_CL_OCC7

$OMEGA BLOCK(1) SAME  ;ETA_CL_OCC8

$OMEGA BLOCK(1) SAME  ;ETA_CL_OCC9

$OMEGA BLOCK(1) SAME  ;ETA_CL_OCC10

$OMEGA BLOCK(1) SAME  ;ETA_CL_OCC11

$OMEGA BLOCK(1) SAME  ;ETA_CL_OCC12

$SIGMA

1  FIX  ;EPS_EXP

$ESTIMATION MAXEVAL= PRINT=1 METHOD=1 INTERACTION NUMERICAL SLOW 
LAPLACIAN NOABORT


$COVARIANCE PRINT=E

C,ID,DOSE_N,AMT=DOSE_UM,RATE=RATE_UM,TIME,CP_UM,DV=CP_LN_UM,MDV,EVID

.,2,1,32743.59651,5457.27,0,0,0,1,1

.,2,1,0,0,6,730,6.593044534,0,0

.,2,1,0,0,24,140,4.941642423,0,0

.,2,1,0,0,48,20,2.995732274,0,0

.,2,1,0,0,72,5.1,1.62924054,0,0

.,2,1,0,0,96,1.7,0.530628251,0,0

.,2,1,0,0,120,0.97,-0.030459207,0,0

.,2,1,0,0,144,0.005,-3,0,0

.,2,2,27286.33043,4547.72,0,0,0,1,4

.,2,2,0,0,6,920,6.82437367,0,0

.,2,2,0,0,24,46,3.828641396,0,0

.,2,2,0,0,48,0.93,-0.072570693,0,0

.,2,2,0,0,72,0.23,-1.46967597,0,0

c,2,2,0,0,96,14,2.63905733,0,0

.,2,2,0,0,120,0.06,-2.813410717,0,0

.,2,3,27286.33043,4547.72,0,0,0,1,4

.,2,3,0,0,6,910,6.8134446,0,0

.,2,3,0,0,24,16,2.772588722,0,0

.,2,3,0,0,48,0.28,-1.272965676,0,0

.,2,3,0,0,72,0.09,-2.407945609,0,0

.,2,3,0,0,96,0,0,1,2

.,2,4,27286.33043,4547.72,0,0,0,1,4

.,2,4,0,0,6,820,6.70930434,0,0

.,2,4,0,0,24,9.7,2.272125886,0,0

.,2,4,0,0,48,1.7,0.530628251,0,0

.,2,4,0,0,72,0.14,-1.966112856,0,0

.,2,4,0,0,96,0.005,-3,0,0

.,2,5,27286.33