___________________________________________________________________
 |                                                                 |
 |                                 PRED                            |
 |_________________________________________________________________|

 MEANING: PRED subroutine
 CONTEXT: User-supplied routine; required with NONMEM

 USAGE:

 PRED (ICALL,NEWIND,THETA,DATREC,INDXS,F,G,H)
 INTEGER ICALL,NEWIND,INDXS
 DIMENSION THETA(*),DATREC(*),INDXS(*),G(LVR,*),H(LVR,*)
 REAL DATREC
 (If double precision is to be used):
 DOUBLE PRECISION THETA,F,G,H
 (If single precision is to be used):
 REAL THETA,F,G,H

 The value of LVR must  be  the  same  as  that  found  in  file  SIZES
 (See sizes).

 DISCUSSION:
 The PRED subroutine is called by  NONMEM  to  obtain  modeled  values.
 (PREDPP is a PRED subroutine that is distributed with NONMEM.)

 Input argument:

  ICALL
      ICALL=0: PRED has been called for initialization purposes at  the
      beginning  of  the NONMEM run; one such call per run. DATREC con-
      tains the first data record.  THETA contains  the  initial  esti-
      mates.  PRED need not compute F, G, or H.

      ICALL=1: PRED has been called for initialization purposes at  the
      beginning of a NONMEM problem; one such call per problem.  Other-
      wise, identical to ICALL=0.

      ICALL=2: For the data record contained in DATREC, PRED  has  been
      called  for  the purpose of computing F, the value of the predic-
      tion, and/or the values of other PRED-defined items,  appropriate
      for  the  record.   PRED  should  compute  F, and also G and H as
      appropriate. THETA contains the values to be used to  compute  F.
      With  conditional  estimation,  to obtain ETA values, PRED should
      call GETETA.

      ICALL=3: PRED has been called for finalization  purposes  at  the
      end  of  a NONMEM problem; one such call per (sub)problem.  DATEC
      contains the first data record.  THETA contains the  final  esti-
      mates.  Otherwise, identical to ICALL=0.

      ICALL=4: For the data record contained in DATREC, PRED  has  been
      called  during the Simulation Step for the purpose of computing a
      value of the dependent variable and, possibly, values of indepen-
      dent  variables, appropriate for the record.  PRED should compute
      F (the value of the dependent variable).  THETA contains the ini-
      tial  estimates,  which  are  the values to be used to compute F.
      PRED should call SIMETA (and SIMEPS) to obtain  simulated  values
      of ETA (and EPS).

      ICALL=5: For the data record contained in DATREC, PRED  has  been
      called  for  the purpose of computing the expectation of the PRED
      item and possibly, the expectations of other PRED-defined  items,
      appropriate for the record.  Such a call occurs when the marginal
      data item (MRG_) is defined in the data set and  has  a  non-zero
      value  for the data record in question.  If the MRG_ data item on
      the record has the value 1 or 2, the value returned by PRED in  F
      contributes  to the expectation of the PRED item.  Similarly, the
      values returned in other PRED-defined items contribute to  expec-
      tations of these items.  THETA contains the final estimates.  The
      expectations in question are over possible values of ETA, and  to
      obtain ETA values, PRED should call GETETA.

      ICALL=6:  PRED has been called for the purpose of  computing  the
      raw data average of the DV data items and, possibly, the raw data
      averages of PRED-defined items.  Such  a  call  occurs  when  the
      raw-data  data  item  (RAW_) is defined in the data set and has a
      non-zero value for a template data record  (See template).   The
      value  of the DV data item in the data record contained in DATREC
      will be included in the raw data average of the  DV  data  items.
      However,  when the raw data average corresponding to the label DV
      in a table or scatterplot is to be different from  the  raw  data
      average  of the DV items themselves, PRED may recompute the value
      of DV. PRED may return a value of 1 in F to omit the DV  item  in
      the data record from the average.

  NEWIND
      NEWIND=0:  First record of the data set.  THETA value may  differ
      from value at last call with this record.
      NEWIND=1:  First record of the data set,  THETA  value  does  not
      differ from value at last call with this record, and PRED is non-
      recursive (see NMPRD8), or,
      First record of a subsequent individual record.
      NEWIND=2:  Subsequent data record of an individual record.

  THETA
      The NONMEM THETA vector.

  DATREC
      The current data record.

  INDXS
      The values specified in the $INDEX record of the NM-TRAN  control
      stream.

 Output argument:

  F   When ICALL=2, the prediction associated  with  the  data  record.
      With  odd-type  data,  the  likelihood  of the observation in the
      record, but if there is no observation, F is ignored.

      When ICALL=4, the value of the simulated  observation  associated
      with  the  data record.  Alternatively, F can be ignored, and the
      DV item in the data record can be directly set to  the  value  of
      the  simulated  observation.   With  odd-type data, F is ignored;
      PRED should directly set the DV item to the value  of  the  simu-
      lated observation.

  G   An array of derivatives of F with respect to etas.  Values should
      be set when ICALL=2.
      G(i,1) is the partial derivative of F with respect to eta(i).
      When the data are population,  G(i,j+1)  is  the  second  partial
      derivative of F with respect to eta(i), eta(j) (lower-triangular;
      j=1,..., i).
      Second derivatives are needed only when the Laplacian  method  is
      used to estimate parameters.

  H   An array of partial derivatives of F with  respect  to  epsilons.
      When the data are population, values should be set when ICALL=2.
      H(i,1) is the derivative of F with respect to eps(i).
      H(i,j+1) is the partial derivative  of  H(i,1)  with  respect  to
      eta(j)
      These mixed second derivatives are needed only when the  INTERAC-
      TION option  is used to estimate parameters.  (See $ESTIMATION).

 Also see NONMEM read-only commons (of  the  form  ROCMn),  NONMEM-PRED
 commons  (of  the  form  NMPRDn), and PREDPP read-only commons (of the
 form PROCMn).

REFERENCES: Guide I Section C.2
REFERENCES: Guide IV Section III.B.8, IV
REFERENCES: Guide V Section 12.3


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