RE: [NMusers] output SE of population PK parameters in Nonmem

From: Rik Schoemaker <rik.schoemaker_at_exprimo.com>
Date: Thu, 7 Feb 2008 19:23:53 +0100

Dear Mark,

Works like a charm! If you have a $PRED instead of a $PK just insert =
your
lines as the first $PRED statements (without $INFN of course).

Below is some R syntax (adapted from Xpose source code) to read your =
file
(which should also work if you decide not to output the correlation =
matrix):



#####################################
## read estimated parameters table ##
#####################################
# obj <- objects()
# remove(obj)
        path <-"C:\\DataDir\\"
        filename.extra <- paste(path,"FileName.est",sep="")
#Read the file
        data.extra <- scan(filename.extra,sep = "\n", what = character())
#The patterns to find the headers in the file
        theta.pat <- "^ *THETAS"
        omega.pat <- "^ *OMEGAS"
        mvof.pat <- "^ *MVOF"
        setheta.pat <- "^ *SE THETAS"
        corrm.pat <- "^ *CORR MATRIX EST"
#The lines corresponding to the headers
        theta.pat.line <- grep(theta.pat, data.extra)
        omega.pat.line <- grep(omega.pat, data.extra)
        mvof.pat.line <- grep(mvof.pat, data.extra)
        setheta.pat.line <- grep(setheta.pat, data.extra)
        corrm.pat.line <- grep(corrm.pat, data.extra)
#The number of rows
        tot.theta.rows <- omega.pat.line - theta.pat.line - 1
        tot.omega.rows <- mvof.pat.line - omega.pat.line - 1
        tot.mvof.rows <- setheta.pat.line - mvof.pat.line - 1
        if (length(corrm.pat.line)>0) {
        tot.setheta.rows <- corrm.pat.line - setheta.pat.line -1
        tot.corrm.rows <- length(data.extra) - corrm.pat.line
        } else {
        tot.setheta.rows <- length(data.extra) - setheta.pat.line}
#Read the different output types
        THETA<-
read.table(filename.extra,skip=theta.pat.line,nrows=tot.theta.rows)
        ETA<-
read.table(filename.extra,skip=omega.pat.line,nrows=tot.omega.rows)
        MVOF <-
read.table(filename.extra,skip=mvof.pat.line,nrows=tot.mvof.rows)
        SETHETA<-
read.table(filename.extra,skip=setheta.pat.line,nrows=tot.setheta.row=
s)
#If you want the entire matrix:
# CORRM<-
read.table(filename.extra,skip=corrm.pat.line,nrows=tot.corrm.rows,fi=
ll=T,co
l.names=1:tot.corrm.rows)
#If you only want the correlations for the Thetas:
        if (length(corrm.pat.line)>0){
                CORRM<-
read.table(filename.extra,skip=corrm.pat.line,nrows=length(THETA),fil=
l=T,col
.names=1:length(THETA))
                k<-1
                for(i in 1:(length(THETA)-1)) {
                        k<-k+1
                        for(j in k:length(THETA)){
                                CORRM[i,j]<-CORRM[j,i]
                        }
                }
        }
        CORRMM<-as.matrix.data.frame(CORRM)




If you use S-plus, you need to change the read.table syntax lines to
importData equivalents:


#Read the different output types
        THETA<-
importData(filename.extra,type="ASCII",startRow=theta.pat.line,endRow=
=theta.
pat.line+tot.theta.rows)
        ETA<-
importData(filename.extra,type="ASCII",startRow=omega.pat.line,endRow=
=omega.
pat.line+tot.omega.rows)
        MVOF <-
importData(filename.extra,type="ASCII",startRow=mvof.pat.line,endRow==
mvof.pa
t.line+tot.mvof.rows)
        SETHETA<-
importData(filename.extra,type="ASCII",startRow=setheta.pat.line,endR=
ow=seth
eta.pat.line+tot.setheta.rows)
#If you want the entire matrix:
# CORRM<-
importData(filename.extra,type="ASCII",startRow=corrm.pat.line,endRow=
=corrm.
pat.line+tot.corrm.rows)
#If you only want the correlations for the Thetas:
        if (length(corrm.pat.line)>0){
                CORRM<-
importData(filename.extra,type="ASCII",startRow=corrm.pat.line,endRow=
=corrm.
pat.line+length(THETA),endCol=length(THETA))
                k<-1
                for(i in 1:(length(THETA)-1)) {
                        k<-k+1
                        for(j in k:length(THETA)){
                                CORRM[i,j]<-CORRM[j,i]
                        }
                }
        }

Thanks!

Rik

________________________________

From: Mark Sale - Next Level Solutions [mailto:mark_at_nextlevelsolns.com]
Sent: 07 February 2008 01:53
To: Rik Schoemaker
Cc: nmusers_at_globomaxnm.com
Subject: RE: [NMusers] output SE of population PK parameters in Nonmem


         Rik,
 It isn't pretty (but what Fortran is?, wouldn't be Fortran without a =
GOTO)
but this seems to work. The previous wasn't working because I didn't =
notice
that the variables in COMMON /CM12/ are REAL, not the default DOUBLE
PRECISION.


$INFN
" FIRST
" INCLUDE 'C:\NMVI\SIZES'
" COMMON /CM12/ COVM(LPAR3),COVINM(LPAR3),STHTA(LTH)
" 1 ,SEN(LVR,LVR),CORRM(LPAR3)
" REAL COVM,COVINM,STHTA,SEN,CORRM
" INTEGER I,N,P
IF (ICALL.EQ.3) THEN
  OPEN(50,FILE='parms')
  WRITE (50,*) 'THETAS'
  WRITE (50,*) THETA
  WRITE (50,*) 'OMEGAS'
  WRITE (50,*) OMEGA(DIAG)
  WRITE (50,*) 'MVOF'
  WRITE (50,*) OBJECT
  WRITE (50,*) 'SE THETAS'
  WRITE (50,*) SETHET
  WRITE (50,*) 'CORR MATRIX EST'
" DO 20 I = 1,70
" DO 10 N = 1, I
" P = P + 1
" IF(CORRM(P).EQ.0) GOTO 30
" WRITE (50,777) CORRM(P)
" 10 CONTINUE
" WRITE(50,'(A2)') ' '
" 20 CONTINUE
" 30 CONTINUE
" 777 FORMAT (' ',F8.6,$)
ENDIF

Mark Sale MD
Next Level Solutions, LLC
www.NextLevelSolns.com
919-846-9185



        -------- Original Message --------
        Subject: RE: [NMusers] output SE of population PK parameters in
Nonmem
        From: "Rik Schoemaker" <rik.schoemaker_at_exprimo.com>
        Date: Wed, February 06, 2008 1:23 pm
        To: <nmusers_at_globomaxnm.com>
        
        Dear Alison,
        
        I'm not sure I'm the one to suggest you update NMTRAN! It seems
there are
        enough tools out there to either extract the info from the output
file or to
        use a custom written INFN routine instead (for instance if you want
more
        decimals). It's just that I'd been searching the documentation for a
        'reserved variable' and couldn't find it...
        
        Thanks!
        
        Rik
        
        
        -----Original Message-----
        From: Alison Boeckmann [mailto:alisonboeckmann_at_fastmail.fm
<http://email.secureserver.net/pcompose.php#Compose> ]
        Sent: 06 February 2008 18:15
        To: Rik Schoemaker; nmusers_at_globomaxnm.com
<http://email.secureserver.net/pcompose.php#Compose>
        Subject: RE: [NMusers] output SE of population PK parameters in
Nonmem
        
        Rik, There is no "keyword" at present for these values. Lets call
them
        "reserved variables" rather than "keywords".
        
        To make a new reserved variable of this sort, there are three steps.
        
        1) Someone must identify a common in NONMEM that contains the values
of
        interest. The other responders seem to think that CM12 is the one
for
        the correlation matrix of the estimate. Whatever, someone must use
        verbatim or user-written code to be sure that the commons have the
        values under the appropriate circumstances.
        2) Let me or ICON know about this, with an example of the code that
you
        use to display them.
        3) NMTRAN could then be revised to make a reserved variable in the
same
        family as SETHET et. al, and to allow it to be used in WRITE/PRINT
        statements in a similar manner.
        
        An easier and faster approach is to use nmsee to mark the values
        of interest in the NONMEM output report, and then use grep or
findstr to
        extract them.
        
        Nmsee can supply the following --
        prefixes (appearing in nmsee output with the prefix option):
        
        ti, tu, tl theta initial, upper bound, and lower bound
        oi, si omega and sigma initial
        tj, oj, sj theta, omega, sigma from init estimates step
        gi, gf gradients initial and final
        pf scaled transformed parameters final
        mm minimum value of objective function
        tf, of, sf theta, omega, and sigma final
        te, oe, se theta, omega, and sigma std errors
        cx, cr, cv covar, correl, and inv covar matrices of est
        cy T matrix
        xx text lines
        
        I have been planning to change it to mark the following:
        xx ETABAR: -0.13E-02 -0.45E-02 -0.25E-01
        xx SE: 0.29E-01 0.27E-01 0.21E-01
        xx P VAL.: 0.96E+00 0.87E+00 0.24E+00
        
        It is much easier and faster to change nmsee than to change NMTRAN!
        
        
        
        
        Steps 1 and 2 are up to the user community. Step 3 is something that
        could be implemented in a future release of NONMEM.
        
        
        
        On Wed, 6 Feb 2008 14:30:42 +0100, "Rik Schoemaker"
        <rik.schoemaker_at_exprimo.com
<http://email.secureserver.net/pcompose.php#Compose> > said:
> Dear all,
>
> It's a neat trick and works very well, but can anyone tell me the
> keyword (like for instance SETHET below) for exporting the
correlation
> matrix of the estimates and for the non-parametric estimates:
> 'expected value of ETA' and 'Covariance matrix of ETA'....
>
> Thanks in advance,
>
> Rik
>
> -----Original Message----- From: owner-nmusers_at_globomaxnm.com
<http://email.secureserver.net/pcompose.php#Compose>
        [mailto:owner-
> nmusers_at_globomaxnm.com
<http://email.secureserver.net/pcompose.php#Compose> ] On Behalf Of =
GIRARD
PASCAL Sent: 01 February
> 2008 18:08 To: Jin, Bo; nmusers_at_globomaxnm.com
<http://email.secureserver.net/pcompose.php#Compose> Subject: RE :
[NMusers]
> output SE of population PK parameters in Nonmem
>
> Hi Jin,
>
> See in NONMEM help:
>
___________________________________________________________________
> | |
> | FINALIZATION EXAMPLE ($PRED AND $INFN) |
> | ___________________________________________________-
> | ______________|
>
> This example contains abbreviated code which can be inserted in a
> $PRED or $INFN block. This code outputs final parameter
> estimates, standard errors, minimum value of the objective
function,
> and condi- tional estimates of etas to various user files. The
> return codes from Estimation and Covariance steps (zero for normal
> termination) are also output.
>
> IF (ICALL.EQ.3) THEN DO WHILE(DATA) IF (NEWIND.LE.1) WRITE (50,*)
> ETA ENDDO WRITE (51,*) OBJECT WRITE (52,*) THETA WRITE (53,*)
> SETHET WRITE (54,*) OMEGA(BLOCK) WRITE (55,*) SEOMEG(BLOCK) WRITE
> (56,*) SIGMA(BLOCK) WRITE (57,*) SESIGM(BLOCK) WRITE (58,*)
> IERE,IERC ENDIF
>
> Alternatively, you take advantage of the fact that all those
> estimmates are stored in Vectors and matrices of various COMMON:
> COMMON /ROCM6/ THETAF(40),OMEGAF(30,30),SIGMAF(30,30) COMMON
> /ROCM7/ SETH(40),SEOM(30,30),SESIG(30,30) COMMON /ROCM8/ OBJECT
> COMMON /ROCM9/ IERE,IERC COMMON /CM12/ COV(2850) and write your
> own INFN subroutine (see INFN help).
>
> Best regards,
>
> Pascal Girard, PhD EA 3738, CTO Fac Medecine Lyon-Sud, BP12 69921
> OULLINS Cedex, France pascal.girard_at_adm.univ-lyon1.fr
<http://email.secureserver.net/pcompose.php#Compose> Tel +33 (0)4 26
> 23 59 54 / Fax +33 (0)4 26 23 59 76
>
> Master Recherche Lyon 1 Santé et Populations, Spécialité PhIT
> http://master-sante-pop.univ-lyon1.fr/
>
> >-----Message d'origine----- De : owner-nmusers_at_globomaxnm.com
<http://email.secureserver.net/pcompose.php#Compose>
        [mailto:owner-
> >nmusers_at_globomaxnm.com
<http://email.secureserver.net/pcompose.php#Compose> ] De la part de =
Jin, Bo
Envoyé : vendredi 1
> >février 2008 17:48 À : nmusers_at_globomaxnm.com
<http://email.secureserver.net/pcompose.php#Compose> Objet : [NMusers]
> >output SE of population PK parameters in Nonmem
> >
> >Dear all: I have a question. Is there any way to output the SE or
SD
> >of a population PK parameter estimate in Nonmem (say typical
value of
> >Cl) into some files which can be read by SAS or S-Plus etc.?
(e.g.
> > some excel or TAB files?)
> >
> >thanks,
> >
> >- Bo
> >
> >_____________________________________
> >
> >BO JIN Clinical Pharmacology Statistics Merck Research Labs
Phone:
> >267-305-7876
> >
> >
> >
>
>--------------------------------------------------------------------
> >-------
> >---
> >Notice: This e-mail message, together with any attachments,
contains
> >information of Merck & Co., Inc. (One Merck Drive, Whitehouse
> >Station, New Jersey, USA 08889), and/or its affiliates (which may
be
> >known outside the United States as Merck Frosst, Merck Sharp &
Dohme
> >or MSD and in Japan, as Banyu - direct contact information for
> >affiliates is available at
> >http://www.merck.com/contact/contacts.html) that may be
confidential,
> >proprietary copyrighted and/or legally privileged. It is intended
> >solely for the use of the individual or entity named on this
message.
> >If you are not the intended recipient, and have received this
message
> >in error, please notify us immediately by reply e-mail and then
> >delete it from your system.
> >
>
>--------------------------------------------------------------------
> >-------
> >---
>
        --
        Alison Boeckmann
        alisonboeckmann_at_fastmail.fm
<http://email.secureserver.net/pcompose.php#Compose>
        
        

        

Received on Thu Feb 07 2008 - 13:23:53 EST

This archive was generated by hypermail 2.2.0 : Fri Feb 08 2008 - 10:19:22 EST