From: musor000@optonline.net  
Subject: [NMusers] time-controlled drug delivery  
Date: Sat, March 20, 2004 3:59 pm  

Dear NONMEM users,

     I try to replicate a model of time-controlled drug delivery.  Infusion rate is
an oscillating function.  Predicted variable does not match the observed one
well.  Surprisingly, when I add a data record with time=0 and missing dependent
variable, I receive different results.  Objective function is negative.  Also,
when I use TIME instead of T in $des block, results are different.   The code
and the data are below.

Thanks you,
Pavel

 $PROB  TIME-CONTROLLED DRUG DELIVERY, SINGLE SUBJECT
  ;RESULTS ARE QUITE DIFFERENT WHEN I SPECIFY MISSING
  ;RECORD FOT TIME=0.  STRANGE...
 $INPUT      EVID TIME CP=DV
 $DATA       PK36DIF0.DA
 $SUBROUTINES  ADVAN8  TOL=7    ;TOL - THE NUMBER OF ACCURATE DIGITS
 $MODEL COMP=(DEPOT)
 $EST     MAXEVAL=9990 SIG=7 PRINT=5 
 $PK
    AMPL =THETA(1)   ;AMPLITUDE OF OSCILATIONS
    V1   =THETA(2)      ;VOLUME OF DISTRIBUTION;
    K1   =THETA(3)      
    S1  =V1            ;The amount A in the observation compartment
                       ;at the time of observation, divided by the 
                       ;value of a parameter S, is used as the prediction.
    CL=K1*V1


 $THETA  (.01,0.35,1)    ;AMPL
         (.1,2,10)      ;V1
         (.001,0.025,100)  ;K1 
 
 ;$OMEGA DIAGONAL(7)  .1 .1 .1 .1 .1 .1 .1    
 $DES
   TM=T
   RIN=0.1+AMPL*0.1*COS((2*3.14159265/60)*(TIME-60))
   DADT(1)=0.1+AMPL*0.1*COS((2*3.14159265/60)*(T-60))-K1*A(1)


$ERROR
  Y=F+ERR(1)
  CONC=F
 
$OMEGA 0.1       

 $COV                          ;COVARIANCE STEP IS IMPLEMENTED

$TABLE TM AMPL V1 K1 CL   NOAPPEND FIRSTONLY
$TABLE TM TIME PRED DV RIN RES WRES
$SCAT  DV VS IPRED UNIT

*******************
DATA:
0   10.6061     0.5173
0   31.8182     0.8214
0   60.1010     1.8692
0   77.7778     1.4870
0   91.9192     1.4728
0  120.2020     2.4959
0  152.0202     1.5575
0  201.5152     1.5988
0  229.7980     2.3068
0  300.5051     2.5459

_______________________________________________________

From: Nick Holford n.holford@auckland.ac.nz
Subject: RE: [NMusers] time-controlled drug delivery  
Date: Sat, March 20, 2004 5:42 pm  

Pavel,

The variable T represents the current time in the integration interval between two
events. TIME is the time at the end of the integration interval. You have written:
>  $DES
>    TM=T
>    RIN=0.1+AMPL*0.1*COS((2*3.14159265/60)*(TIME-60))
>    DADT(1)=0.1+AMPL*0.1*COS((2*3.14159265/60)*(T-60))-K1*A(1)
Althought it makes no difference to your model it would be clearer to remove TM=T
and change the expression for RIN so that it uses T rather than TIME e.g.
>  $DES
>    RIN=0.1+AMPL*0.1*COS((2*3.14159265/60)*(T-60))
>    DADT(1)=RIN -K1*A(1)
I suspect you are using TM and RIN to try to capture the valeus of T and RIN during
integration but this will not work. You can only determine RIN and save it in a
table at the time of an event in your data file. TM will always be the time at the
end of the integration interval.

There are two parameters in your model which you code as constants -- the period and
phase. You have the phase with the same value as the period. There is no point in
doing this
>    RIN=0.1+AMPL*0.1*COS((2*3.14159265/60)*(T-60))
and
>    RIN=0.1+AMPL*0.1*COS((2*3.14159265/60)*T)
are equivalent. 

I used the following code to estimate period and phase and the run converged with 7
sig digs using ADVAN6. I would not recommend using ADVAN8 unless you have very good
reason to suspect a stiff system (and I can see no evidence of that in your
problem).

$PROB  TIME-CONTROLLED DRUG DELIVERY, SINGLE SUBJECT
  ;RESULTS ARE QUITE DIFFERENT WHEN I SPECIFY MISSING
  ;RECORD FOT TIME=0.  STRANGE...
$INPUT ID TIME DV
$DATA data.txt
$SUBROUTINES  ADVAN6  TOL=7    ;TOL - THE NUMBER OF ACCURATE DIGITS
$MODEL COMP=(DEPOT)
$EST     MAXEVAL=9990 SIG=7 PRINT=5
$COV                          ;COVARIANCE STEP IS IMPLEMENTED

$THETA
(.01,1.34,10)    ;AMPL
(.1,2.19,10)      ;V1
(.001,0.0206,100)  ;K1
(1,49.,100) ; PERIOD
(-1,9.51,60) ; PHASE     
$OMEGA 0 FIXED ; Make NONMEM think this is a popln analysis but with single subject
data
$SIGMA 0.106
      
;$OMEGA DIAGONAL(7)  .1 .1 .1 .1 .1 .1 .1
$PK
    AMPL =THETA(1)*EXP(ETA(1))   ;AMPLITUDE OF OSCILATIONS
    V1   =THETA(2)      ;VOLUME OF DISTRIBUTION;
    K1   =THETA(3)
    PERIOD=THETA(4)
    PHASE=THETA(5)

    S1  =V1            ;The amount A in the observation compartment
                       ;at the time of observation, divided by the
                       ;value of a parameter S, is used as the prediction.
    CL=K1*V1


$DES
   RIN=0.1+AMPL*0.1*COS((2*3.14159265/PERIOD)*(T-PHASE))
   DADT(1)=RIN-K1*A(1)

$ERROR
  Y=F+ERR(1)
  CONC=F

$TABLE ID TIME AMPL V1 K1 CL Y
NOPRINT FILE=cosine.fit

Nick
--
Zip file attachments have .gz extension. Please save as .zip 
http://www.health.auckland.ac.nz/pharmacology/staff/nholford/zip_attachment.htm
****
Nick Holford, Dept Pharmacology & Clinical Pharmacology
University of Auckland, 85 Park Rd, Private Bag 92019, Auckland, New Zealand
email:n.holford@auckland.ac.nz tel:+64(9)373-7599x86730 fax:373-7556
http://www.health.auckland.ac.nz/pharmacology/staff/nholford/


_______________________________________________________

From: musor000@optonline.net  
Subject: RE: [NMusers] time-controlled drug delivery  
Date: Sun, March 21, 2004 11:06 pm  



Hi, Nick,

Thanks for your help.  I learn NONMEM by my own and try to replicate results from
book by Gabrielson & Weiner.   They use fixed phase and period.  Problem is that I
cannot get results which are similar to what I see in the book:  AMPL=0.248013,
V=2.119573, CL=0.048638.  My amplitude is much smaller and standard errors of the
estimates are much larger.  Parameters I am geting are here:  AMPL=0.0615, V1=1.59,
K1=0.0326, CL=0.0518.  They look stable.  When I create a record with time=0 and
mising dependent variable, the results are quite different:  AMPL=0.0320, V1=2.12,
K1=0.0239, CL=0.0507.  They also look stable. Another problen is that NONMEM does
not print the last record (time=300.5051).  I can see this record when I add a
missing record at the end of the data file and the results are different again....
(AMPL=0.0959, V1=2.44, K1=0.0191, CL=0.0466).

I'll look at plots tommorrow.  May be they will explain something.  

Here are modified data (with the first  and the last missing records):
0    0                .
0   10.6061     0.5173
0   31.8182     0.8214
0   60.1010     1.8692
0   77.7778     1.4870
0   91.9192     1.4728
0  120.2020     2.4959
0  152.0202     1.5575
0  201.5152     1.5988
0  229.7980     2.3068
0  300.5051     2.5459
0  360.0            .

Thank you,
Pavel 

 

_______________________________________________________