From: "Eleveld, DJ" d.j.eleveld@anest.umcg.nl 
Subject: [NMusers] What does nonmem do after iteration stops?
Date:  Fri, June 3, 2005 6:28 am 

Hi Everyone, 

I've noticed something curious:  
I use the PRINT=1 option in the $ESTIMATION to see the progress of the model fitting.  With a fitting that 
I am doing (PD mdoel fitting involving about 3000 data points) the iterations stop after about 20-30 minutes 
and then nothing is printed on the screen for several hours.  Apparently nonmem is calculating something 
after convergence that takes a very long time.  The problem does have 2 tables but I cant really imagine that 
these would require so much computing time. 

What does nonmem do after finishing iterations that could possibly require so much computation? 
Is there a way for me to avoid this computation and still see the results of the estimation? 

If its useful my control file is at the end of this message. 

Thanks very much, 

Doug Eleveld 

------------------------------------ 
$PROB  Potentiation fitting 
$DATA  potpd_.prn 
$INPUT ID TIME CPLA DV MDV AMT RATE 
$SUBROUTINES ADVAN9 TOL=6 
$ABBREVIATED COMRES=1 
$MODEL NCOMPARTMENTS=2 
       NPARAMETERS=6 
       COMP(POTENT NOOFF) 
       COMP(EFFECT NOOFF NODOSE) 
$PK 
    CALLFL=0 
    KEO=THETA(1)*EXP(ETA(1)) 
    EC50=THETA(2)*EXP(ETA(2)) 
    GAMM=THETA(3)*EXP(ETA(3)) 
    POTR=THETA(4)*EXP(ETA(4)) 
    POTK=THETA(5)*EXP(ETA(5)) 
    SCAL=THETA(6)+ETA(6) 
    IF (NEWIND.EQ.0) COM(1)=POTR 
    F1=ABS(COM(1)) 
$DES 
    DADT(1)=-POTK*A(1)          ; Decay potentiation 
    DADT(2)=(CPLA-A(2))*KEO     ; Effect compartment conc 
$ERROR 
    DPOT=A(1)                   ; The degree of potentiation 
    CEFF=A(2) 
    DPD1=CEFF**GAMM             ; Degree of NMB 
    NMB=DPD1/(DPD1+(EC50**GAMM)) 
    Y=SCAL*(1+DPOT)*(1-NMB)+ERR(1) ; Twitch prediction 
    COM(1)=POTR*(1-NMB) 
$THETA (0,0.13)(0,1460)(0,3.45) 
       (0,0.0008)(0,0.146)(0,101) 
$OMEGA 0.1 0.1 0.1 0.1 0.1 10 
$SIGMA 10 
$ESTIMATION MAX=9999 SIG=6 PRINT=1 
$TABLE TIME KEO EC50 GAMM POTR POTK SCAL 
       NOHEADER NOPRINT FILE=potent2.txt 
$TABLE TIME CEFF DPOT NMB 
       NOHEADER NOPRINT FILE=potent3.txt 
_______________________________________________________

From: "Nick Holford" n.holford@auckland.ac.nz
Subject:  Re: [NMusers] What does nonmem do after iteration stops?
Date:  Fri, June 3, 2005 11:45 am 

Doug,

Two things that might take time to compute after minimization is complete are:

1. The covariance step.
2. POST HOC parameter estimates.

However your control stream does not request either of these so I am afraid I have
no explanation for the long time take to generate table output. What happens if you
remove the $TABLE records?

Nick

_______________________________________________________

From: "Ekaterina Gibiansky" gibianskye@guilfordpharm.com
Subject: Re: [NMusers] What does nonmem do after iteration stops? 
Date:  Fri, June 3, 2005 12:08 pm 

Doug,

how big your ouput table files are? Are you running NONMEM and writing
the output to the drive on the same PC or the writing is going through
the network? May be it is something to do with the network speed of
writing the files?

Katya 
_______________________________________________________

From:  "Eleveld, DJ" d.j.eleveld@anest.umcg.nl
Subject: RE: [NMusers] What does nonmem do after iteration stops? --> Workaround 
Date:  Fri, June 3, 2005 1:54 pm 

Thanks to everyone for thier thoughtful suggestions. 

The delay seems to be related to the table step.  The tables are fairly large (about 
700k) and are written directly to the hard drive.  If I remove the $TABLE lines then 
nonmem exits soon after it stops iterating as expected.  Interestingly, if the FILE 
option isnt used, i.e. the table is written to the output file, then there is no 
delay.  I will use this method as a work-around. 

I also tried POSTHOC without any tables and there was no delay.  So I think problems 
with POSTHOC can be ruled out.  

The delay seems to happen *before* the writing of the table files.  When a run was 
'stuck', I didnt see any of the table files open.  So I dont think the file access is 
simply too slow.  Possibly the compiler/os has some issues with opening files under 
certain conditions.  I am using Open Watcom 1.0 and Win 98.  I will try to update to 
Open Watcom 1.3 and see if that helps. 

Thanks very much, 

Doug 

_______________________________________________________

From: "Eleveld, DJ" d.j.eleveld@anest.umcg.nl
Subject: RE: [NMusers] What does nonmem do after iteration stops? --> Further info 
Date:  Wed, June 8, 2005 10:34 am 

I tried a few more things to determine the source of the post-iteration delay: 

1) $TABLE --> delay 
2) $TABLE NOAPPEND --> nodelay 
3) $TABLE NOAPPEND but with DV and Y as columns --> nodelay 
4) No tables but $COVARAINCE --> delay 

It appears that the OS/compiler is not the cause since even big tables can be 
made without any extra delay.  Neither does it seem to be related to prediction 
since DV and Y can be included in a table without extra delay.  So to be more 
specific the delay seems to follow covaraince calculation or residual and weighted 
residual calculation.  I dont understand why this is. 

This could possibly be a model-related issue since the model I am fitting is unusual 
in that the bioavalability parameter F1 changes over time depending on a random 
variable defined in $PK.  Nonmem seems to have trouble handling this variable, 
giving me strange ETA estimations and POSTHOC values equal for all individuals 
regardles of the estimated ETA value.  I'm in the process of documenting this and 
will report back to the users group with more detailed information. 

Thanks very much, 

Doug Eleveld
_______________________________________________________