Using Wings for NONMEM with R and Xpose

Home | Installation | Control Streams | Bootstrap | Randomization Test | Visual Predictive Check | Autocovariate | Files | References

 

Last Updated: 3 April 2012

 

Installation of R and Xpose

 

[Thanks to Malin Rhodin for testing and documenting how to use WFN with R and Xpose]

 

You will need to install the R system and then the Xpose package in order to use Xpose. Instructions are given for obtaining and installing R and Xpose.

 

    R

 

1)      Go to the web page: http://www.r-project.org/

2)      Select the CRAN under the Download directory to download R.

3)      When R has been downloaded proceed with downloading Xpose

 

   XPOSE

 

1)      Go to the web page: http://xpose.sourceforge.net/

2)      Select downloads and choose the version you need.

3)      The xpose is downloaded as a folder and needs to be installed in R before it can be used.

4)      Open R

5)      In R, select Packages -> Install package(s) from the GUI menu.

Select a CRAN mirror close to you, choose Hmisc. Install it.

6)      In R, select Packages -> Install package(s).. from the GUI menu.

Select at CRAN mirror close to you, and choose gam. Install it.

7)      In R, select Packges -> Install packages from local zip file...

Find the Xpose binary file you downloaded, and install it.

8)      Xpose is now installed in R's library subfolder

9)      You may load Xpose in R by starting R and then typing this in the R command window:

library(xpose4)

10)  To start the Xpose menu system use this in the R command window:

xpose4()

11)   The above instructions from 5-10, and alternative ways to install Xpose, can also be found at : http://xpose.sourceforge.net/docs_install.php

 

 

    How to use WFN together with Xpose

 

1)      In your NM-TRAN control stream file include four $TABLE records such as the following:

$TABLE ID TIME IPRE IWRE NOPRINT ONEHEADER FILE=sdtab1
$TABLE ID SEX RACE DIAG NOPRINT NOAPPEND ONEHEADER FILE=catab
1
$TABLE ID THEO WT AGE NOPRINT NOAPpEND ONEHEADER FILE=cotab
1
$TABLE ID E0 EMAX EC50 ETA1 ETA2 ETA3 NOPRINT NOAPPEND ONEHEADER FILE=patab
1

2)      Make sure that it includes the parameters that your model file contains.

3)      In $PRED or $ERROR you need to add IPRE and IWRE

4)      E.g. IPRE = Y and IWRE = DV-IPRE. (see the Xpose manual for details)

5)      Choose a number relevant to the actual run. In the above example it is number one.

6)      Save your model file under a new name, for example put XP at the end to show that it is compatible with Xpose.

7)      Open a WFN window and run the NM-TRAN control stream with nmgo

8)      When the run is completed open R.

9)      Open Xpose in R (see above).

10)  Go to File and select Change directory to choose the directory in which the data results are. E.g. ka1_XP.std

11)  When prompted by Xpose enter the run number chosen under step 3 (e.g. 1).

 

Examples of a NM-TRAN model file:

 Pharmacodynamic Problem Using $PRED

$PROB theophylline pharmacodynamics standard control stream
$DATA theopd.dat IGNORE #
$INPUT ID TIME THEO AGE WT SEX RACE DIAG DV
$ESTIM POSTHOC
$COV


$THETA (0,150.,) ; POPE0
$THETA (0,200.,) ; POPEMAX
$THETA (.001,10,) ; POPEC50

$OMEGA 0.5 ; ETAE0
$OMEGA 0.5 ; ETAEMAX
$OMEGA 0.5 ; ETAEC50

$SIGMA 100 ; ERRSD

$PRED

E0=THETA(1)*EXP(ETA(1))
EMAX=THETA(2)*EXP(ETA(2))
EC50=THETA(3)*EXP(ETA(3))

Y = E0 + EMAX*THEO/(THEO+EC50) + ERR(1)

 

 Pharmacokinetic Problem Using $PK,$ERROR

 

$PROBLEM FIRST ORDER WITH LAG

$INPUT ID TIME AMT WT AGE SEX DV

$DATA tgsparse.dat IGNORE=#

$ESTIM MAXEVAL=9990 POSTHOC NOABORT PRINT=0

$WARN WARN=NONE

$COV

$SUB ADVAN2 TRANS2

 

$THETA (0,1)     ;popcl

$THETA (0,10)    ;popv

$THETA (0,0.5)   ;popka

$THETA (0,0.5)   ;poptlag

    

$OMEGA 0.09 ;etacl

$OMEGA 0.09 ;etav

$OMEGA 0.09 ;etaka

$OMEGA 0.09 ;etatlag

 

$THETA (0,0.1) ;errcv

$THETA (0,0.5) ;errsd

$SIGMA 1 FIXED ;eps1
 

$PK

     CL          = popcl*EXP(etacl)

     V           = popv*EXP(etav)

     KA          = popka*EXP(etaka)

     TLAG        = poptlag*EXP(etatlag)

     ALAG1       = TLAG

     S2          = V

 

$ERROR

      IPRE       = F

      PROP       = IPRE*errcv

      ADD        = errsd

      SD         = SQRT(PROP*PROP + ADD*ADD)

      Y          = IPRE + SD*eps1

 

$TABLE ID TIME WT AGE SEX CL V KA Y

ONEHEADER NOPRINT FILE=ka1L.fit

 

 

Example of the same NM-TRAN file that has been rewritten so that it will be compatible with Xpose.

The changes made to the file are in red.

 

 Pharmacodynamic Problem Using $PRED

$PROB theophylline pharmacodynamics standard control stream
$DATA theopd.dat IGNORE #
$INPUT ID TIME THEO AGE WT SEX RACE DIAG DV
$ESTIM POSTHOC
$COV

$THETA (0,150.,) ; POPE0
$THETA (0,200.,) ; POPEMAX
$THETA (.001,10,) ; POPEC50

$OMEGA 0.5 ; ETAE0
$OMEGA 0.5 ; ETAEMAX
$OMEGA 0.5 ; ETAEC50

$SIGMA 100 ; ERRSD

$PRED

E0=THETA(1)*EXP(ETA(1))
EMAX=THETA(2)*EXP(ETA(2))
EC50=THETA(3)*EXP(ETA(3))

Y = E0 + EMAX*THEO/(THEO+EC50) + ERR(1)

IPRE = Y
IWRE = DV-IPRE

$TABLE ID TIME IPRE IWRE NOPRINT ONEHEADER FILE=sdtab
1
$TABLE ID SEX RACE DIAG NOPRINT NOAPPEND ONEHEADER FILE=catab
1
$TABLE ID THEO WT AGE NOPRINT NOAPpEND ONEHEADER FILE=cotab
1
$TABLE ID E0 EMAX EC50 ETA1 ETA2 ETA3 NOPRINT NOAPPEND ONEHEADER FILE=patab
1

 

Pharmacokinetic Problem Using $PK,$ERROR

$PROBLEM FIRST ORDER WITH LAG

$INPUT ID TIME AMT WT AGE SEX DV

$DATA tgsparse.dat IGNORE=#

$ESTIM MAXEVAL=9990 POSTHOC NOABORT PRINT=0

$WARN WARN=NONE

$COV

$SUB ADVAN2 TRANS2

 

$THETA (0,1)     ;popcl

$THETA (0,10)    ;popv

$THETA (0,0.5)   ;popka

$THETA (0,0.5)   ;poptlag

    

$OMEGA 0.09 ;etacl

$OMEGA 0.09 ;etav

$OMEGA 0.09 ;etaka

$OMEGA 0.09 ;etatlag

 

$THETA (0,0.1) ;errcv

$THETA (0,0.5) ;errsd

$SIGMA 1 FIXED ;eps1
 

$PK

     CL          = popcl*EXP(etacl)

     V           = popv*EXP(etav)

     KA          = popka*EXP(etaka)

     TLAG        = poptlag*EXP(etatlag)

     ALAG1       = TLAG

     S2          = V

 

$ERROR

      IPRE       = F

      PROP       = IPRE*errcv

      ADD        = errsd

      SD         = SQRT(PROP*PROP + ADD*ADD)

      Y          = IPRE + SD*eps1

      IWRE       = (DV - IPRE)/SD

 

$TABLE ID TIME IPRE IWRE NOPRINT ONEHEADER FILE=sdtab1

$TABLE ID SEX NOPRINT NOAPPEND ONEHEADER FILE=catab1

$TABLE ID WT AGE NOPRINT NOAPPEND ONEHEADER FILE=cotab1

$TABLE ID CL V KA TLAG ETA1 ETA2 ETA3 ETA4 NOPRINT NOAPPEND ONEHEADER FILE=patab1

 

 

REMEMBER:

-         to number the table files with the same number (e.g. 1 [blue colour])

-         to include variables appropriate to each table file

-         the catab parameters are the categorical parameters e.g. SEX

-         the cotab are the continuous parameters e.g. WT and AGE

-         the patab parameters are the post hoc individual estimates e.g. CL, V, KA TLAG and the corresponding ETAs

 

Home | Installation | Control Streams | Bootstrap | Randomization Test | Visual Predictive Check | Autocovariate | Files | References