+--------------------------------------------------------------------+
 |                                                                    |
 |                          BAYES EXAMPLE 2                           |
 |                                                                    |
 +--------------------------------------------------------------------+

 This is example2.ctl from the NONMEM 7 distribution medium.  It, along
 with the data file, can be found in the examples directory.

 ;Model Desc: Two Compartment model with Clearance and
 ; central volume modeled with covariates age and gender
 ;Project Name: nm7examples
 ;Project ID: NO PROJECT DESCRIPTION

 $PROB RUN# example2 (from sampc)
 $INPUT C SET ID JID TIME DV=CONC AMT=DOSE RATE EVID MDV CMT GNDR AGE
 $DATA example2.csv IGNORE=C
 $SUBROUTINES ADVAN3 TRANS4

 $PK
 ; LCLM=log transformed clearance, male
 LCLM=THETA(1)
 ;LCLF=log transformed clearance, female.
 LCLF=THETA(2)
 ; CLAM=CL age slope, male
 CLAM=THETA(3)
 ; CLAF=CL age slope, female
 CLAF=THETA(4)
 ; LV1M=log transformed V1, male
 LV1M=THETA(5)
 ; LV1F=log transformed V1, female
 LV1F=THETA(6)
 ; V1AM=V1 age slope, male
 V1AM=THETA(7)
 ; V1AF=V1 age slope, female
 V1AF=THETA(8)
 ; LAGE=log transformed age
 LAGE=DLOG(AGE)

 ;Mean of ETA1, the inter-subject deviation of Clearance,
 ; is ultimately modeled as linear function of THETA(1) to THETA(4).
 ; Relating thetas to Mus by linear functions is not essential for
 ; ITS, IMP, or IMPMAP methods, but is very helpful for MCMC methods
 ; such as SAEM and BAYES.

 MU_1=(1.0-GNDR)*(LCLM+LAGE*CLAM) + GNDR*(LCLF+LAGE*CLAF)

 ; Mean of ETA2, the inter-subject deviation of V1,
 ; is ultimately modeled as linear function of THETA(5) to THETA(8)

 MU_2=(1.0-GNDR)*(LV1M+LAGE*V1AM) + GNDR*(LV1F+LAGE*V1AF)
 MU_3=THETA(9)
 MU_4=THETA(10)
 CL=DEXP(MU_1+ETA(1))
 V1=DEXP(MU_2+ETA(2))
 Q=DEXP(MU_3+ETA(3))
 V2=DEXP(MU_4+ETA(4))
 S1=V1

 $ERROR
 CALLFL=0
 ; Option to model the residual error coefficient in THETA(11),
 ; rather than in SIGMA.
 SDSL=THETA(11)
 W=F*SDSL
 Y = F + W*EPS(1)
 IPRED=F
 IWRES=(DV-F)/W

 ;Initial THETAs
 $THETA
 ( 0.7 ) ;[LCLM]
 ( 0.7 ) ;[LCLF]
 ( 2 )   ;[CLAM]
 ( 2.0);[CLAF]
 ( 0.7 ) ;[LV1M]
 ( 0.7 ) ;[LV1F]
 ( 2.0 )   ;[V1AM]
 ( 2.0 )   ;[V1AF]
 ( 0.7 ) ;[MU_3]
 (  0.7 );[MU_4]
 ( 0.3 )     ;[SDSL]

 ;Initial OMEGAs
 $OMEGA BLOCK(4)
 0.5  ;[p]
 0.001  ;[f]
 0.5  ;[p]
 0.001 ;[f]
 0.001 ;[f]
 0.5  ;[p]
 0.001 ;[f]
 0.001 ;[f]
 0.001 ;[f]
 0.5 ;[p]

 ; SIGMA is 1.0 fixed, serves as unscaled variance for EPS(1).
 ; THETA(11) takes up the residual error scaling.
 $SIGMA
 (1.0 FIXED)

 ;Prior information is important for MCMC Bayesian analysis,
 ; not necessary for maximization methods
 ; In this example, only the OMEGAs have a prior distribution,
 ; the THETAS do not.
 ; For Bayesian methods, it is most important for at least the
 ; OMEGAs to have a prior, even an uninformative one,
 ; to stabilize the analysis. Only if the number of subjects
 ; exceeds the OMEGA dimension number by at least 100,
 ; then you may get away without priors on OMEGA for BAYES analysis.
 $PRIOR NWPRI
 ; Prior OMEGA matrix
 $OMEGAP BLOCK(4) FIX VALUES(0.01,0.0)
 ; Degrees of freedom to OMEGA prior matrix:
 $OMEGAPD 4 FIX

 ; The first analysis is iterative two-stage.
 ; Note that the GRD specification is THETA(11) is a
 ; Sigma-like parameter.  This will allow NONMEM to make
 ; efficient gradient evaluations for THETA(11), which is useful
 ; for later IMP,IMPMAP, and SAEM methods, but has no impact on
 ; ITS and BAYES methods.

 $EST METHOD=ITS INTERACTION FILE=example2.ext NITER=1000 NSIG=2
      PRINT=5 NOABORT SIGL=8 NOPRIOR=1 CTYPE=3 GRD=TS(11)

 ; Results of ITS serve as initial parameters for the IMP method.

 $EST METHOD=IMP INTERACTION EONLY=0 MAPITER=0 NITER=100 ISAMPLE=300
      PRINT=1 SIGL=8

 ; The results of IMP are used as the initial values for the SAEM method.

 $EST METHOD=SAEM NBURN=3000 NITER=2000 PRINT=10 ISAMPLE=2
      CTYPE=3 CITER=10 CALPHA=0.05

 ; After the SAEM method, obtain good estimates of the marginal density
 ; (objective function),
 ; along with good estimates of the standard errors.

 $EST METHOD=IMP INTERACTION EONLY=1 NITER=5 ISAMPLE=3000
      PRINT=1 SIGL=8 SEED=123334
      CTYPE=3 CITER=10 CALPHA=0.05

 ; The Bayesian analysis is performed.

 $EST METHOD=BAYES INTERACTION FILE=example2.TXT NBURN=10000
      NITER=3000 PRINT=100 NOPRIOR=0
      CTYPE=3 CITER=10 CALPHA=0.05

 ; Just for old-times sake, lets see what the traditional
 ; FOCE method will give us.
 ; And, remember to introduce a new FILE, so its results wont
 ; append to our Bayesian FILE.

 $EST  METHOD=COND INTERACTION MAXEVAL=9999 FILE=example2.ext NSIG=2
   SIGL=14 PRINT=5 NOABORT NOPRIOR=1

 $COV MATRIX=R UNCONDITIONAL

REFERENCES: Guide Introduction_7

  
Go to main index.
  
Created by nmhelp2html v. 1.0 written by Niclas Jonsson (Modified by AJB 5/2006,11/2007,10/2012)