How to Output the Objective Function to a Separate File

3 messages 3 people Latest: Sep 29, 1994
There are a number of ways to capture the minimum value of the objective function (and other NONMEM computed quantities). Its best if users communicate directly with the NONMEM consultant on this topic, because it requires knowlege of NONMEM internals. I'll reply directly to Katya. If anyone else would like to do something similar, please send e-mail to nmconsult@c255.ucsf.edu
Here is an answer that is easy to use on a system that supports awk and grep (all unix and versions are available for DOS and other OSs). If you want to capture the obj func value at the end of each iteration you can extract it from the NONMEM listing as it produced. I use grep to search the NONMEM output as follows: grep "OBJECTIVE VALUE" nonmem.lst You could use awk to extract the obj value itself from each line. grep "OBJECTIVE VALUE" nonmem.lst|awk '{print $6}' As supplied NONMEM leaves the OS to flush the output file buffer when it feels like it instead of after printing the results of each iteration. If you want to have a continuously updated output file while NONMEM is running then you need to flush the file buffer. If your f77 compiler supports flush() or something like that then it easy to make the change to the NONMEM source so that the output file buffer is flushed as soon as a new obj value is printed. I can supply details if you wish.