___________________________________________________________________
 |                                                                 |
 |                            NWPRI EXAMPLES                       |
 |_________________________________________________________________|

 These examples illustrate the use of the NONMEM utility routine  NWPRI  |
 by  the NM-TRAN $PRIOR record, and also by an equivalent user-supplied  |
 routine PRIOR.                                                          |
 For a discussion of PRIOR:  (See prior).   For  a  discussion  of  the
 NWPRI  routine  and in particular, a discussion of the $THETA, $OMEGA,
 $SIGMA records: (See nwpri).

 Example 1
 ------- -

 Use of PRIOR and NWPRI and a control stream for single-subject data:

 This example obtains parameter estimates  from  single  subject  data,
 using  a  two-compartment  PK model, and it incorporates a frequentist
 prior of multivariate normal form for all of the THETA vector.

 $PROB SINGLE SUBJECT DATA WITH PRIOR ON THETA
 $INPUT ID DOSE TIME DV WT
 $DATA data1
 $PRIOR NWPRI NTHETA=3,NETA=1,NTHP=3,NPEXP=1                             |
 $PRED
 ;
 ;     THETA(1)=MEAN ABSORPTION RATE CONSTANT
 ;     THETA(2)=MEAN ELIM. RATE CONSTANT (1/HR)
 ;     THETA(3)=CLEARANCE (LITERS/HR)
 ;     DOSE=WEIGHT-ADJUSTED DOSE (MG/KG)
 ;
       IF (NEWIND.EQ.0) AMT=DOSE*WT
       T1=THETA(1)
       T2=THETA(2)
       T3=THETA(3)
       A=EXP(-T2*TIME)
       B=EXP(-T1*TIME)
       C=T1-T2
       D=A-B
       E=T3*C
       Y=AMT*T1*T2/E*D+ETA(1)

 $THETA  (.4,1.7,7) (.025,.102,.4) (.3,3,30)
 ;mode for prior with THETA:
 $THETA 2.77 FIX .0781 FIX 2.63 FIX
 $OMEGA .388
 ;var-cov for prior with THETA:
 $OMEGA BLOCK (3) 5.55 .00524 .00024 -.128 .00911 .515 FIX

 $EST

 Instead of a $PRIOR record, the following may be used:                  |

 $SUBROUTINE PRIOR=prior                                                 |

 The prior routine is as follows:

       SUBROUTINE PRIOR (ICALL,CNT)
       DOUBLE PRECISION CNT
       NTHETA=3
       NETA=1                                                            |
       NTHP=3
       NETP=0                                                            |
       NPEXP=1
       PLEV=0
       CALL NWPRI (NTHETA,NETA,NEPS,NTHP,NETP,NEPP,NPEXP,ITYP,PLEV,
      1            NSAM,ISS,CNT)
       RETURN
       END

 Example 2
 ------- -

 First example of use of PRIOR and NWPRI and a control stream for popu-
 lation data:

 This example obtains parameter estimates from population data, using a
 two-compartment  PK  model, and it incorporates a frequentist prior of
 multivariate normal/inverse Wishart form for all of the  THETA  vector
 and OMEGA matrix.

 $PROB POPULATION DATA WITH PRIOR ON THETA AND OMEGA
 $INPUT ID DOSE TIME DV WT
 $DATA data2
 $PRIOR NWPRI NTHETA=3 NETA=3 NTHP=3 NETP=3 NPEXP=1                      |
 $PRED
 ;
 ;     THETA(1)=MEAN ABSORPTION RATE CONSTANT - MEAN ELIM. RATE CONSTANT (l/HR)
 ;     THETA(2)=MEAN ELIM. RATE CONSTANT (1/HR)
 ;     THETA(3)=SLOPE OF CLEARANCE VS WEIGHT RELATIONSHIP (LITERS/HR/KG)
 ;     DOSE=WEIGHT-ADJUSTED DOSE (MG/KG)
 ;
       IF (NEWIND.NE.2) THEN
          AMT=DOSE*WT
          W=WT
       ENDIF
       T0=THETA(1)*EXP(ETA(1))
       T2=THETA(2)*EXP(ETA(2))
       T1=T2+T0
       T3=THETA(3)*W*EXP(ETA(3))
       A=EXP(-T2*TIME)
       B=EXP(-T1*TIME)
       C=T1-T2
       D=A-B
       E=T3*C
       Y=AMT*T1*T2/E*D+EPS(1)
 $THETA  (0,4,5) (0,.09,.5) (.004,.01,.9)
 ;mode for prior on THETA:
 $THETA 3 FIX .08 FIX .04 FIX
 ;df for prior on OMEGA:
 $THETA 12 FIX
 $OMEGA BLOCK (3) .7 .04 .05 .02 .06 .08
 ;var-cov for prior on THETA:
 $OMEGA BLOCK (3) .494 .00207 .0000847 .000692 .0000471 .0000292 FIX
 ;mode for prior on OMEGA:
 $OMEGA BLOCK (3) .7 .04 .05 .02 .06 .08 FIX
 $SIGMA  .4

 $EST

 Instead of a $PRIOR record, the following may be used:                  |

 $SUBROUTINE PRIOR=prior                                                 |

 The prior routine is as follows:

       SUBROUTINE PRIOR (ICALL,CNT)
       DOUBLE PRECISION CNT
       NTHETA=3
       NETA=3
       NTHP=3
       NETP=3
       NPEXP=1
       PLEV=0
       CALL NWPRI (NTHETA,NETA,NEPS,NTHP,NETP,NEPP,NPEXP,ITYP,PLEV,
      1            NSAM,ISS,CNT)
       RETURN
       END

 Example 3
 ------- -

 Second example of use of PRIOR and NWPRI  and  a  control  stream  for
 population data:

 This example simulates the THETA and  OMEGA  parameters  of  the  same
 two-compartment  population  PK  model, as well as the population data
 from this model.
 During problem finalization, the entire post-simulation  theta  vector  |
 and omega array in common NMPR16 are written to external files.         |

 $PROB POPULATION DATA WITH PRIOR ON THETA AND OMEGA
 $INPUT ID DOSE TIME DV WT
 $DATA data2
 $PRIOR NWPRI                                                            |
        NTHETA=3 NETA=3 NTHP=3 NETP=3 NPEXP=1 ITYP=0 PLEV=.9999          |
 $PRED
 ;
 ;     THETA(1)=MEAN ABSORPTION RATE CONSTANT - MEAN ELIM. RATE CONSTANT (l/HR)
 ;     THETA(2)=MEAN ELIM. RATE CONSTANT (1/HR)
 ;     THETA(3)=SLOPE OF CLEARANCE VS WEIGHT RELATIONSHIP (LITERS/HR/KG)
 ;     DOSE=WEIGHT-ADJUSTED DOSE (MG/KG)
 ;
       IF (NEWIND.NE.2) THEN
          AMT=DOSE*WT
          W=WT
       ENDIF
       T0=THETA(1)*EXP(ETA(1))
       T2=THETA(2)*EXP(ETA(2))
       T1=T2+T0
       T3=THETA(3)*W*EXP(ETA(3))
       A=EXP(-T2*TIME)
       B=EXP(-T1*TIME)
       C=T1-T2
       D=A-B
       E=T3*C
       Y=AMT*T1*T2/E*D+EPS(1)
       IF (ICALL.EQ.3) THEN                                              |
         WRITE (97,*) THSIMP                                             |
         WRITE (98,*) OMSIMP(BLOCK)                                      |
       ENDIF                                                             |

 $THETA  (0,4,5) (0,.09,.5) (.004,.01,.9)
 ;mode for prior on THETA:
 $THETA 3 FIX .08 FIX .04 FIX
 ;df for prior on OMEGA:
 $THETA 12 FIX
 $OMEGA BLOCK (3) .7 .04 .05 .02 .06 .08
 ;var-cov for prior on THETA:
 $OMEGA BLOCK (3) .494 .00207 .0000847 .000692 .0000471 .0000292 FIX
 ;mode for prior on OMEGA:
 $OMEGA BLOCK (3) .7 .04 .05 .02 .06 .08 FIX
 $SIGMA  .4

 $SIM (547676) ONLY

 Suppose a $TABLE record is added to  the  above  control  stream.   To  |
 obtain  values  of  DV  computed  with  the  simlulated values of eta,  |
 include the following code:                                             |

       IF (ICALL.EQ.4) THEN                                              |
       T0=THSIMP(1)*EXP(ETA(1))                                          |
       T2=THSIMP(2)*EXP(ETA(2))                                          |
       T3=THSIMP(3)*W*EXP(ETA(3))                                        |
       ELSE                                                              |
       T0=THETA(1)*EXP(ETA(1))                                           |
       T2=THETA(2)*EXP(ETA(2))                                           |
       T3=THETA(3)*W*EXP(ETA(3))                                         |
       ENDIF                                                             |

 Instead of a $PRIOR record, the following may be used:                  |

 $SUBROUTINE PRIOR=prior                                                 |

 The prior routine is as follows:

       SUBROUTINE PRIOR (ICALL,CNT)
       DOUBLE PRECISION CNT
       NTHETA=3
       NETA=3
       NTHP=3
       NETP=3
       NPEXP=1
       ITYP=0
       PLEV=.9999
       ISS=0
       CALL NWPRI (NTHETA,NETA,NEPS,NTHP,NETP,NEPP,NPEXP,ITYP,PLEV,
      1            NSAM,ISS,CNT)
       RETURN
       END

 REFERENCES: none.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     


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