Reading NONMEM output into S-Plus
From: R.Port@DKFZ-Heidelberg.de
Subject: Reading NONMEM output into S-Plus
Date: Tue, 6 Feb 2001 17:42:54 +0100
Hi Ganesh:
a few more suggestions...
If this is your $TABLE record:
$TABLE STUD ID CL V2 Q V3 KA TIME IPRED NOPRINT ONEHEADER FILE=BLUESKY2.TAB
Run NONMEM as usually to create BLUESKY2.TAB . Then, in S-Plus, issue:
> a_read.table('BLUESKY2.TAB',skip=1,header=T)
# If you want to plot residuals versus time:
> a1_a[a[,'DV']!=0,] # Extract lines where DV!=0
> plot(a1[,'TIME'],a1[,'RES'])
If you want to use your final THETA estimates in S-Plus (e.g. to create smooth prediction curves) you can also make them a data item of the output table:
$ERROR ...
IF(ICALL.EQ.3) THEN
TH1 = THETA(1)
TH2 = THETA(2)
TH3 = THETA(3)
TH4 = THETA(4)
ENDIF
$TABLE STUD ID TH1 TH2 TH3 TH4 CL V2 Q V3 KA TIME IPRED
NOPRINT ONEHEADER FILE=BLUESKY2.TAB
Then, in S-Plus:
> a_read.table('BLUESKY2.TAB',skip=1,header=T)
> theta1_a[1,'TH1'] # theta1 is mean population k_a
If you want to see final OMEGA^2 estimates in S-Plus, or objective function values, things become more complicated, and you will need something like what Vladimir Piotrovsky suggests, i.e. extracting lines from the NONMEM report file and scan them into S-Plus' using the scan () function, or making use of NONMEM commons (ROCM6...) as described by Alison.
Dr. Nicholas Holford has written very useful awk procedures to be used under UNIX that extract the more important information from the NONMEM report file (I guess they can be found in the NONMEM repository or on his own Web site).
By the way, if you are doing simulations, you might like to invoke NONMEM from within an S-Plus command file so that everything is done with one command on the S-Plus command line. E.g. if you are working under UNIX and the script that invokes NONMEM is named "start.NONMEM":
# S-Plus command file, e.g. 'graph1': ----------------------------------------
!start.NONMEM control.file report.file
a_read.table('BLUESKY2.TAB',skip=1,header=T)
a1_a[a[,'DV']!=0,]
plot(a1[,'TIME'],a1[,'RES'])
# ----------------------------------------------------------------------------
On the S-Plus command line: > source('graph1')
Good luck! Ruedi