___________________________________________________________________
 |                                                                 |
 |                         REPETITION 1 EXAMPLE                    |
 |_________________________________________________________________|

 This example illustrates the use of the  repetition  feature,  and  in
 particular,  the use of the variables RPTI and RPTO.  For a discussion
 of these reserved variables:  (See nmpr10).

 We suppose that a compartment amount A2 at time t1 is given by a  con-
 volution,  i.e.  an integral with respect to s, of the product D(t1-s)
 and r(s), where D is a unit distribution function, and r is  an  input
 function.  The integral is taken from 0 to t1.  The amount in question
 can be computed by integrating the differential equation

 dA2/ds=D(t1-s)r(s)

 from time 0 to time t1.  For A2 at a later time t2, one  integrates  a
 different differential equation:

 dA2/ds=D(t2-s)r(s)

 from time 0 to time t2.  This equation differs from the  first  in  so
 far as the constant t2, rather than t1, is used in D.

 Ordinarily, PREDPP will use a system of differential equations

 dA2/ds=f(A2,t)

 to obtain the value of a vector A2 of compartment amounts at times  t1
 and  t2,  by  first  integrating  the  system  to time t1, and then by
 integrating the same or different system from  time  t1  to  time  t2.
 This  scheme  cannot  be  used with the two equations described above,
 because  the  second  equation  -  with  the  constant  t2  -  applies
 throughout the time interval 0 to t1, as well as throughout the inter-
 val t1 to t2.

 PREDPP requires the event records to be ordered chronologically in the
 data  set,  and  with  its  ordinary usage with differential equations
 (described above), these records are processed sequentially,  starting
 with  the  first event record (which, for the purposes of this discus-
 sion, can be thought to have time 0).  The records are passed  sequen-
 tially to the PK routine.

 The differential equations used for the convolution requires something
 special.  During a regular sequential pass of the event records to the
 PK routine, when a record R with time t - at which compartment amounts
 are  desired - is initially processed and passed to the PK routine for
 the first time, the routine should set the output variable RPTO to -1.
 This signals to NONMEM that the regular pass should be interrupted and
 a second pass of the records should be initiated,  starting  with  the
 first  event record once again and ending with record R (thus the pass
 of these records is "repeated").  Only at the end of the second  pass,
    -----
 after  all  event records up to and including record R have once again
        ---
 been passed, will the value for A2(t) be established.  The amounts  at
 times  on  preceeding  records have already been established, and they
 remain unchanged as the pass of these records is  repeated.   After  R
 has been passed for the second time, the first pass will be continued,
 the next event record will be passed for the first time, and RPTO  can
 again  be set to -1.  Whenever an event record is passed for the first
 time, f(s) should be set to D(t-s)r(s), where t is  the  time  on  the
 record, so that during the second pass, the differential equation that
 is used is the desired one.  When an event record is  passed,  if  the
 input  variable to the PK routine, RPTI, has the value 0, this signals
 that the record is not being passed as a part of a repeated pass,  and
 so  this  can  be used as a signal that the record is being passed for
 the first time.

 Suppose the kinetic system is  a  two-compartment  system  where  drug
 absorption from a depot compartment into a sampling compartment occurs
 in a first-order manner, and drug elimination from the  sampling  com-
 partment  occurs  according  to  a  Weibull  unit disposition function
 D(s)=exp(-K(s**c)).  Suppose too that the superposition  principle  is
 assumed  to  hold.  So drug amount is given by a convolution.  Suppose
 the event records for an individual are simply structured, e.g.

 # TIME AMT DV     EVID
   .0    10   .      1               rec 1
   .25   .  2.44     0               rec 2
   .5    .  5.24     0               rec 3
   .75   .  5.57     0               rec 4
   1     .  5.85     0               rec 5

 Then the control stream should look like:

 $PROB
 $INPT TIME AMT DV EVID
 $DATA data
 $SUB ADVAN6 TOL=5
 $MODEL COMP=(DEPOT DEFDOSE) COMP=(CENTRAL DEFOBS)

 $PK
 KA=THETA(1)*EXP(ETA(1))
 K =THETA(2)*EXP(ETA(2))
 C =THETA(3)
 V =THETA(4)*EXP(ETA(4))
 S2=V
 IF (RPTI.EQ.0) TI=TIME
 IF (NEWIND.EQ.2) RPTO=-1

 $DES
 DADT(1)=-KA*A(1)
 D=EXP(-K*(TI-T)**C)
 DADT(2)=D*KA*A(1)

 etc.

 Note that when TIME= 0.25, RPTO need not have been set  to  -1;  after
 the second event record has been passed for the first time, the kinet-
 ics are advanced from time 0 to time 0.25 using TI=0.25.

 REFERENCES: none.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     


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