RE: calculation of time-to-nadir
From: Nick Holford
Subject: RE:[NMusers] calculation of time-to-nadir
Date: Tue, August 3, 2004 3:49 am
Erik,
Thanks very much for suggesting this solution to finding the time of maximum (or
minimum) of a function.
I thought it might be of interest to show the data, code and output for the kind of
problem that Anthe asked about originally i.e. the time to nadir.
This example implements a linear pharmacodynamic effect inhibiting the input to a
turnover model so that the solution to the time of nadir is known analytically (as
in your Cmax example). It uses the $SIMULATION option to simulate data from a
template data file (nadir.dat). The output table file shows that your clever brute
force method agrees quite closely with the analytical solution for the time of
nadir.
Note that the accuracy of the solution depends on the spacing of the times in the
data set. When the data has only two times, 0 and 100 (time increment 100), then the
predicted time of nadir is 54.884 compared with the analytical value of 54.931.
Interestingly if the time increment is 1 unit then the brute force solution is
somewhat worse (54.965) than with a time increment of 10 (54.933; see below).
By trial and error I looked for the smallest value of TOL that would give a brute
force prediction that is identical (54.931) to the analytical solution.
Paradoxically I found it needed TOL=7 with a time increment of 100, TOL=8 with a
time increment of 10 and TOL=9 with a time increment of 1.
Nick
$PROBLEM Nadir
$INPUT TIME AMT CMT DV
$DATA nadir.dat
$SUBROUTINES ADVAN6 TOL=6
$MODEL
COMP = CENTRAL
COMP = EFFECT
COMP = NADIR
COMP = TMIN
$PK
K = THETA(1)
KOUT = THETA(2)
C0 = THETA(3)
SLOPE = THETA(4)
KIN=KOUT*C0
F2=C0
$DES
DCP=A(1)
DCE=A(2)
DADT(1) = -K*DCP
D2 = KIN*(1-SLOPE*DCP) - DCE*KOUT
DADT(2) = D2
IF (D2.LT.0) THEN
DADT(3) = D2 ; Y(3) is conc 'lost' from effect site
DADT(4) = 1 ; Y(4) is elapsed time up to nadir
ELSE
DADT(3) = 0
DADT(4) = 0
ENDIF
$ERROR
CP = A(1)
CE = A(2)
NADIR = C0+A(3)
TNAD = A(4)
;Theoretical time of nadir for limear PD model
TMIN = (LOG(K)-LOG(KOUT))/(K-KOUT)
Y = CE*(1+ERR(1))
$THETA
0.01 ; k
0.03 ; keq
100 ; C0
0.01 ; Slope
$OMEGA
0.001 ; cverr
$SIM (123456) SUBPROBLEMS=1 ONLYSIM
$TABLE TIME CP CE NADIR TNAD TMIN
NOPRINT ONEHEADER NOAPPEND FILE=nadir.fit
nadir.dat
#TIME AMT CMT DV
0 1 2 .
0 100 1 .
10 . . .
20 . . .
30 . . .
40 . . .
50 . . .
60 . . .
70 . . .
80 . . .
90 . . .
100 . . .
nadir.fit
TIME CP CE NADI TNAD TMIN
0 0 100 100 0 54.931
0 100 100 100 0 54.931
10 90.484 75.397 75.397 10 54.931
20 81.873 59.512 59.512 20 54.931
30 74.082 49.863 49.863 30 54.931
40 67.032 44.631 44.631 40 54.931
50 60.653 42.49 42.49 50 54.931
60 54.881 42.473 42.265 54.933 54.931
70 49.659 43.881 42.265 54.933 54.931
80 44.933 46.208 42.265 54.933 54.931
90 40.657 49.095 42.265 54.933 54.931
100 36.788 52.286 42.265 54.933 54.931
--
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/