___________________________________________________________________
 |                                                                 |
 |                     ABBREVIATED FUNCTION EXAMPLE                |
 |_________________________________________________________________|

 Example 1
 ------- -

 Here is an example of the use and construction of a function  of  both
 time  and  the  first-order  elimination  rate constant of a simple PK
 one-compartment model, to compute the amount in the system at a  given
 time.  (See abbreviated_function).

 $PRED
    ...
    VECTRA(1)=THETA(1)*EXP(ETA(1))
    VECTRA(2)=TIME
    ...
    A=DOSE*FUNCA(VECTRA)
    ...

       FUNCTION FUNCA(X,X1,X2)
       DOUBLE PRECISION X,X1,X2,FUNCA,EXPT
       DIMENSION X(9),X1(9),X2(9,9)
 C THE FUNCTION ITSELF
       EXPT=EXP(-X(1)*X(2))
       FUNCA=EXPT
 C 1ST. PARTIALS
       X1(1)=-EXPT*X(2)
       X1(2)=-EXPT*X(1)
 C 2ND. PARTIALS
       X2(1,1)=EXPT*X(2)*X(2)
       X2(1,2)=EXPT*X(1)*X(2)
       X2(2,1)=EXPT*X(1)*X(2)
       X2(2,2)=EXPT*X(1)*X(1)
       RETURN
       END

 Example 2
 ------- -

 Here is an example of the use and construction of the cumulative  dis-
 tribution  function  of  the  standard  normal distribution, where the
 argument will be treated as a random variable.  The function  utilizes
 the  NONMEM  utility  function PHI, that simply gives the value of the
 cumulative distribution function.

 With NONMEM VI 1.0 and 1.1, the code in this example is the  only  way  |
 to  use  PHI when the partial derivatives of the argument will be used  |
 by NONMEM.  PHI may also be used in verbatim code when the argument is  |
 not random or when partial derivatives are not used by NONMEM.          |

 $PRED
    ...
    VECTRA(1)=THETA(1)+ETA(1)
    ...
    A=FUNCA(VECTRA)
    ...

       FUNCTION FUNCA(X,X1,X2)
       DOUBLE PRECISION X,X1,X2,FUNCA,P5,TWO,R,E
       DOUBLE PRECISION PHI                                              |
       DIMENSION X(9),X1(9),X2(9,9)
       DATA P5/0.5/,R/.39894228037539D0/,TWO/2./
 C THE FUNCTION ITSELF
       FUNCA=PHI(X(1))
 C 1ST. PARTIAL
       E=EXP(-P5*X(1)**2)
       X1(1)=R*E
 C 2ND. PARTIAL
       X2(1,1)=-TWO*R*P5*X(1)*E
       RETURN
       END

 Note that with NONMEM VI 2.0 PHI may be used directly  in  abbreviated  |
 code, and partial derivatives, if any, will be computed appropriately.  |

 $PRED                                                                   |
    ...                                                                  |
    A=PHI(THETA(1)+ETA(1))                                               |
    ...                                                                  |

 REFERENCES: None.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     


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