ADAPT II Release 4 Instructions

Red Text Lines are Instructions
Blue Characters are user entries
A) Log on to BINGER (binger.ouhsc.edu) and create a new class directory

BINGER$ create/dir [.class]

B) Move to the new directory The new directory is home.CLASS 
where home (here and later) is the name of your home directory

BINGER$ cd [.class]

  U1:[home.CLASS]
  
C) Copy the file db-copy.com to this directory

BINGER$ COPY U1:[DAVID.MAC.PUB]DB-COPY.COM DB-COPY.COM

D) Use this file, twice

BINGER$ @db-copy

  U1:[home.CLASS]
%COPY-S-COPIED, U1:[DAVID.MAC.PUB]DB-COPY.COM;23 copied to U1:[home.CLASS]DB-COP
Y.COM;13 (2 blocks)
%COPY-S-COPIED, U1:[DAVID.MAC.PUB]TUT5.BAT;1 copied to U1:[home.CLASS]TUT5.BAT;1
1 (8 blocks)
%COPY-S-COPIED, U1:[DAVID.MAC.PUB]TUTORIAL_5.DAT;1 copied to 

...

BINGER$ @db-copy

  U1:[home.CLASS]
%COPY-S-COPIED, U1:[DAVID.MAC.PUB]DB-COPY.COM;23 copied to U1:[home.CLASS]DB-COP
Y.COM;14 (2 blocks)
%COPY-S-COPIED, U1:[DAVID.MAC.PUB]TUT5.BAT;1 copied to ...

E) Run ADAPT II Release 4

BINGER$ adapt

                                ADAPT II
                               Release  4

                     Biomedical Simulations Resource
                    University of Southern California

             Installed at:    OUHSC COLLEGE OF PHARMACY

  Initialize Session

    Terminal Options:

      1.  VT/TEK Terminal
      2.  X Windows (not available)

    Enter option number:    1


    Editor Options:

      1.  EDT
      2.  EMACS

    Enter option number:    1


  Program  Menu:


    1.  SIM
    2.  ID
    3.  SAMPLE
    4.  Previous executeable image
    5.  Exit ADAPT



  Enter option number:    2


  Model  File  Menu:

    1.  Define a new model                 4.  Return to Program Menu
    2.  Use an existing model              5.  Exit ADAPT
    3.  Modify an existing model


  Enter option number:    3


  Enter name of existing model file (e.g., 1compk):   oneciv

  Enter name for new model file (e.g., newname):   firsteg

F) Edit S/R if necessary - not necessary here

C**********************************************************************
C                          ADAPT II                                   *
C                         Release  4                                  *
C**********************************************************************
C                                                                     *
C                           MODEL                                     *
C                                                                     *
C    This file contains the Fortran subroutines listed below in       *
C    which the user must enter the relevant equations and constants.  *
C    Consult the user's manual for details concerning the format for  *
C    entered equations and definition of symbols.                     *
C                                                                     *
C       1. DiffEq- System Differential Equations.                     *
C       2. Amat  - System State Matrix.                               *
C       3. Output- System Output Equations.                           *
C       4. Symbol- Parameter Symbols,Constants.                       *
C       5. Varmod- Variance Model Equations used                      *
C       6. Prior - Prior Mean and Covariance values                   *
C       7. Sparam- Secondary parameters                               *
C                                                                     *
C**********************************************************************


        Subroutine DIFFEQ(T,X,XP)

        Implicit None

c        Include 'globals.inc'
c        Include 'model.inc'
        include 'u1:[david.adapt4]globals.inc'
        include 'u1:[david.adapt4]model.inc'

        Real*8 T,X(MaxNDE),XP(MaxNDE)

CC
C----------------------------------------------------------------------C
C 1.  Enter Differential Equations Below  {e.g.  XP(1) = -P(1)*X(1) }  C
C----c-----------------------------------------------------------------C

        xp(1) = -p(1)*x(1)

C----------------------------------------------------------------------C
C----------------------------------------------------------------------C
C

        Return
        End


C######################################################################C

        Subroutine AMAT(A)
        Implicit None

c        Include 'globals.inc'
c        Include 'model.inc'
        include 'u1:[david.adapt4]globals.inc'
        include 'u1:[david.adapt4]model.inc'

        Integer I,J
        Real*8 A(MaxNDE,MaxNDE)

        DO I=1,Ndeqs
           Do J=1,Ndeqs
              A(I,J)=0.0D0
           End Do
        End Do

CC
C----------------------------------------------------------------------C
C 2. Enter non zero elements of state matrix  {e.g.  A(1,1) = -P(1) }  C
C----c-----------------------------------------------------------------C



C----------------------------------------------------------------------C
C----------------------------------------------------------------------C
C
        Return
        End


C######################################################################C

        Subroutine OUTPUT(Y,T,X)
        Implicit None

c        Include 'globals.inc'
c        Include 'model.inc'
        include 'u1:[david.adapt4]globals.inc'
        include 'u1:[david.adapt4]model.inc'

        Real*8 Y(MaxNOE),T,X(MaxNDE)

CC
C----------------------------------------------------------------------C
C 3.  Enter Output Equations Below   {e.g.  Y(1) = X(1)/P(2) }         C
C----c-----------------------------------------------------------------C

        Y(1) = x(1)/p(2)

C----------------------------------------------------------------------C
C----------------------------------------------------------------------C
C

        Return
        End


C######################################################################C

        Subroutine SYMBOL
        Implicit None

c        Include 'globals.inc'
c        Include 'model.inc'
        include 'u1:[david.adapt4]globals.inc'
        include 'u1:[david.adapt4]model.inc'


CC
C----------------------------------------------------------------------C
C 4.                Enter as Indicated                                 C
C----c-----------------------------------------------------------------C

      NDEqs   = 1   ! Enter # of Diff. Eqs.
      NSParam = 2   ! Enter # of System Parameters.
      NVparam = 1   ! Enter # of Variance Model Parameters.
      NSecPar = 0   ! Enter # of Secondary Parameters.
      NSecOut = 0   ! Enter # of Secondary Outputs (not used).
      Ieqsol  = 1   ! Model type: 1 - DIFFEQ, 2 - AMAT, 3 - OUTPUT only.
      Descr   = 'One Compartment IV Bolus Example'

C----------------------------------------------------------------------C
C----------------------------------------------------------------------C
C
CC
C----------------------------------------------------------------------C
C 4.  Enter Symbol for Each System Parameter (eg. Psym(1)='Kel')       C
C----c-----------------------------------------------------------------C

        PSym(1) = 'kel'
        PSym(2) = 'V'

C----------------------------------------------------------------------C
C----------------------------------------------------------------------C
CC
C----------------------------------------------------------------------C
C 4. Enter Symbol for Each Variance Parameter {eg: PVsym(1)='Sigma'}   C
C----c-----------------------------------------------------------------C

        PVsym(1) = 'Sigma'

C----------------------------------------------------------------------C
C----------------------------------------------------------------------C
CC
C----------------------------------------------------------------------C
C 4. Enter Symbol for Each Secondary Parameter {eg: PSsym(1)='CLt'}    C
C----c-----------------------------------------------------------------C



C----------------------------------------------------------------------C
C----------------------------------------------------------------------C
C 
        Return
        End


C######################################################################C

        Subroutine VARMOD(V,T,X,Y)
        Implicit None

c        Include 'globals.inc'
c        Include 'model.inc'
        include 'u1:[david.adapt4]globals.inc'
        include 'u1:[david.adapt4]model.inc'

        Real*8 V(MaxNOE),T,X(MaxNDE),Y(MaxNOE)

CC
C----------------------------------------------------------------------C
C 5.    Enter Variance Model Equations Below                           C
C         {e.g. V(1) = PV(1)**2 * Y(1)**PV(2) }                        C
C----c-----------------------------------------------------------------C

        V(1) = Y(1)**pv(1)

C----------------------------------------------------------------------C
C----------------------------------------------------------------------C
C

        Return
        End

C######################################################################C

        Subroutine PRIOR(Pmean,Pcov,ICmean,ICcov)
        Implicit None

c        Include 'globals.inc'
c        Include 'model.inc'
        include 'u1:[david.adapt4]globals.inc'
        include 'u1:[david.adapt4]model.inc'

        Integer I,J
        Real*8 Pmean(MaxNSP+MaxNDE), ICmean(MaxNDE)
        Real*8 Pcov(MaxNSP+MaxNDE,MaxNSP+MaxNDE), ICcov(MaxNDE,MaxNDE)

CC
C----------------------------------------------------------------------C
C 6.    Enter Nonzero Elements of Prior Mean Vector                    C
C          {  e.g. Pmean(2) = 10.0    }                                C
C----c-----------------------------------------------------------------C

 
 
C----------------------------------------------------------------------C
C----------------------------------------------------------------------C
CC
C----------------------------------------------------------------------C
C 6. Enter Nonzero Elements of Covariance Matrix (Lower Triang.)       C
C         {  e.g. Pcov(2,1) = 0.25    }                                C
C----c-----------------------------------------------------------------C



C----------------------------------------------------------------------C
C----------------------------------------------------------------------C
C
        Return
        End


C######################################################################C

        Subroutine SPARAM(PS,P,IC)
        Implicit None

c        Include 'globals.inc'
        include 'u1:[david.adapt4]globals.inc'

        Real*8 PS(MaxNSECP), P(MaxNSP+MaxNDE), IC(MaxNDE) 

CC
C----------------------------------------------------------------------C
C 7.    Enter Equations Defining Secondary Parameters                  C
C           {  e.g.  PS(1) = P(1)*P(2)   }                             C
C----c-----------------------------------------------------------------C

     
        
C----------------------------------------------------------------------C
C----------------------------------------------------------------------C
C
        Return
        End

G) Exit edit mode with control-Z and exit (to save changes) 
or quit (to make no changes - i.e. keep the file the same)

control-Z
*exit

U1:[home.CLASS]FIRSTEG.FOR;11 258 lines



                                ADAPT II
                               Release  4

                     Biomedical Simulations Resource
                    University of Southern California

             Installed at:    OUHSC COLLEGE OF PHARMACY

  compiling...     FIRSTEG
  linking.....     FIRSTEG & $ADAPT:ID


  Enter file name to save executable program (e.g., 1compk) else : firsteg


   ADAPT II    ID -- PARAMETER ESTIMATION    Date:  3/07/1999  Time: 20:35


Read data from a file (Y/N)? n

Do you want to save these data in an output file (Y/N)? n

     ----- SUPPLY MODEL INPUT INFORMATION -----

Enter the number of model inputs: 0

Enter the number of bolus inputs: 1

Enter the compartment number for each bolus input (e.g. 1,3,...): 1

Enter the number of input event times: 1

For each input event enter as required:
          Time    Value for all Inputs
Event     Units,       B(1)
 1.       0,250

     ----- SUPPLY MODEL OUTPUT INFORMATION -----

Enter the number of model output equations: 1

Enter the number of observation times: 5

For each observation enter as required:
                Time     Measured Value For Each Output
Observation     Units ,     Y(1)
     1.         1,8

     2.         2,5

     3.         3,2.6

     4.         5,0.9

     5.         6,0.56


     ----- ESTIMATOR SELECTION ----- 

The following estimation procedures are available:
     1. Weighted least squares (WLS)
     2. Maximum likelihood (ML)
     3. Generalized least squares (GLS)
     4. Maximum a posteriori probability (MAP)

Enter option number: 1


     --- Supply Weighting Information For WLS Estimator ---

The following weighting options are available:
 1.   General
 2.   Inverse variance of the output error (linear)
 3.   Inverse variance of the output error (nonlinear)

     For Y( 1):

Enter the number of the desired weighting procedure:  2

Define the Linear Std. Dev. vs Output Curve:

                  Y( 1) Value, Std. Dev.
Low Measurement             .5,.05

High Measurement            10,1

Enter the number of 0 weight observations:  0


    ----- INITIALIZE ESTIMATION PROCEDURE -----

Read parameter values from a file (Y/N)? n

Enter initial values for parameters & specify those to be estimated: 

           Value  Estimate (Y/N)? 
kel          .5,y

V            20,y

IC( 1)       0,n

Do you want to store the parameter values in a file (Y/N)? n

Enter maximum number of iterations:   300

Do you want the iterations printed (Y/N)? n


            ----- RESULTS -----

            --- A. Iterations ---  

    Number of iterations      =     0
    Number of function calls  =     1

     Fitted Parameters
      kel        =   0.5000    
      V          =    20.00    

    Estimator criterion value =  4.64870    


     Working...

            ---B. Iteration Summary---

    Convergence has been achieved.

    Number of iterations      =    16
    Number of function calls  =    67

     Fitted Parameters
      kel        =   0.5407    
      V          =    18.06    

    Estimator criterion value=   0.863689    




           --- C. WLS Estimation Summary---

Do you want an estimation summary table(Y/N)?   y

Do you want the estimation summary table stored in a file (Y/N)? n

Date:  3/07/1999     Time: 20:37

Model:  One Compartment IV Bolus Example                            

Weighting Information
  Option for Y( 1):  2 with (.5000    ,.5000E-01) and (10.00    ,1.000    )

Convergence achieved
  Number of iterations:          16
  Number of function calls:      67
Estimator criterion value:   0.863689    


                               Weighted
 Output        R-squared    Sum of Squares   Sum of Squares
 Y( 1)        0.997          0.863689         0.116391    

 Model Selection Criteria
  AIC:         3.2673    
  SCHWARZ:     2.4862    

Press Enter to continue: [cr]


               Initial      Final
 Parameter      Value      Estimate     CV(%)      Confidence interval (95%)

 kel           0.5000      0.5407       4.528      [ 0.4628    ,  0.6186    ]
 V              20.00       18.06       9.453      [  12.63    ,   23.50    ]
 IC( 1)        0.0000E+00  Fixed

Do you want a correlation (1) or covariance (2) matrix, or neither (N)?  1


          kel       V         
kel         1.00
V          -0.88      1.00

Do you want a correlation (1) or covariance (2) matrix, or neither (N)?  2


          kel       V         
kel       0.599E-03
V         -.368E-01  2.92    

Do you want a correlation (1) or covariance (2) matrix, or neither (N)?  n



           --- D. WLS Estimation Model Prediction and Data Summary ---

Do you want a prediction and data summary table (Y/N)? y

Do you want the prediction and data summary stored in a file (Y/N)? n

Date:  3/07/1999     Time: 20:37

Model:  One Compartment IV Bolus Example                            


Y( 1)
 Obs.Num.   Time         Data       Model Est.     Residual     Weight
    1       1.000        8.000        8.059       -0.5939E-01    1.563    
    2       2.000        5.000        4.693        0.3065        4.000    
    3       3.000        2.600        2.733       -0.1333        14.79    
    4       5.000       0.9000       0.9270       -0.2696E-01    123.5    
    5       6.000       0.5600       0.5398        0.2018E-01    318.9    

Press Enter to continue: [cr]

Y( 1) (Continued)                 Std. Dev.   Standardized
          Obs.Num.   Model Est.   Model Est.   Residual
              1       8.059       0.5948      -0.7424E-01
              2       4.693       0.2644       0.6131    
              3       2.733       0.1252      -0.5126    
              4      0.9270       0.5509E-01  -0.2996    
              5      0.5398       0.4194E-01   0.3603    


Plotting options:
    1. Default plots
    2. Plotting with options
    3. Store plot data to a file
    4. No plots

Enter option number:   4

     ________________________________________

     --- RE-ESTIMATION OPTIONS --- 

    1. Change initial parameter values
    2. Select a different estimator
    3. Analyze a different data set
    4. Exit ID

Enter option: 4

     ________________________________________

   ADAPT II    ID -- PARAMETER ESTIMATION    Date:  3/07/1999  Time: 20:37

FORTRAN STOP



Enter (CR) to continue:    [cr]


                                ADAPT II
                               Release  4

                     Biomedical Simulations Resource
                    University of Southern California

             Installed at:    OUHSC COLLEGE OF PHARMACY

  Program  Menu:


    1.  SIM
    2.  ID
    3.  SAMPLE
    4.  Previous executeable image
    5.  Exit ADAPT



  Enter option number:    5

H) Purge (remove) old version of files to save space.

BINGER$ pur