Nick and others,

If you want to save run time, Nick's suggestion (putting DPI=3.14159 in
$PK) might not be helpful. Here's why.

First, a little backgound on the math in PREDPP.

ADVAN6 & ADVAN8 integrate both DADT (the rate of change wrt time of the
compartment amounts) and also what could be called "daeta/dt" - the rate
of change wrt time of DAETA (which is the partial derivative of
compartment amounts  wrt the etas). Now, "d(daeta)/dt" is the same as
the
partial of DADT wrt eta (i.e., d(da/deta)/dt = d(da/dt)/deta)) which is
easy for the ADVAN routines to compute, as follows.

The DES routine must compute values of DADT and also values of DA
(partial
of DADT wrt compartments A) and DP (partial of DADT wrt PK parameters P)
for all A's and P's. (This is all described in Guide VI, the
PREDPP Guide).

The ADVAN routines use the chain rule to compute the partial of DADT wrt
eta. For each eta, this involves the  sum over all compartments of
DA*(da/deta) plus the sum over all P of DP*(dp/deta).

It may be hard to follow the math as presented here, but the point is
that 
for every PK parameter (i.e., every variable defined in PK and used in
DES)
there is a loop over all the etas.  If a given PK parameter such as DPI
does not
have partials wrt etas, the loop does a lot of multiplying by 0 and
adding of 0's.  This wastes time. Better simply to define it in $DES.
In other words: the best way to save run time is to use as few PK
parameters
as possible in $DES.

In Ying's fragment of code, I see many cases where it appears that 
computations could be done in $PK rather than $DES.

e.g., $DES contains 
DPS1 = KOUT*A0 
DPS2 = (KOUT*A1 + B1*DPI/12)*DCOS(DPI*T/12)
DPS3 = (KOUT*B1 - A1*DPI/12)*DSIN(DPI*T/12) etc.

But KOUT, A0, A1, B1 and DPI appear to be constant within the $DES
block. Surely it would be better to compute these constant expressions
in $PK, and compute in $DES only that part that changes (the parts that
depend on T and A). (I assume that A0, A1, etc. are computed in $PK).

$PK 
.... 
DPS1 = KOUT*A0 
DPS2A = KOUT*A1 + B1*DPI/12 
DPS3A = KOUT*B1 -A1*DPI/12
etc 
$DES 
DPS2=DPS2A+*DCOS(DPI*T/12) 
etc

(If the runs are fast enough as originally written, then Ying certainly 
should leave things as-is because it is easier to read and understand.
I only raise the issue because Nick did.) 


On Sat, 28 Apr 2007 09:54:54 -0400, "Ying HONG"
<[EMAIL PROTECTED]> said:
> Hi, Nick,
>
> It works and significantly decreased the objective function value,
> which is consistent with the results from Hempel et al.
>
> Thank you very much!
>
> Kind Regards, Ying
>
>
> Nick Holford wrote:
> > Ying,
> >
> > If you assign the ETA to a variable outside $DES then you can use
> > the variable in $DES e.g.
> >
> > $PK
> >
> > ETAT=ETA() ; ETA for random effect on offset in cycle
> >
> > $DES
> >
> > DPS2 = (KOUT*A1 + B1*DPI/12)*DCOS(DPI*(T+ETAT)/12)
> >
> > I would also suggest putting DPI = 3.14159 in $PK. There is no need
> > to do this assignment every time the differential equation solver is
> > called.
> >
> > Nick
> >
> > Ying HONG wrote:
> >
> >> Dear NM users,
> >>
> >> A biomarker, which shows clear circadian rhythm during placebo
> >> treatment, was described by a turnover model with the introduction
> >> of a periodic time-dependent production function KST with two
> >> harmonics. The code in $DES is written as follows:
> >>
> >> $DES
> >>
> >> DPI = 3.14159 DPS1 = KOUT*A0 DPS2 = (KOUT*A1 +
> >> B1*DPI/12)*DCOS(DPI*T/12) DPS3 = (KOUT*B1 -
> >> A1*DPI/12)*DSIN(DPI*T/12) DPS4 = (KOUT*A2 + B2*DPI/6)
> >> *DCOS(DPI*T/6) DPS5 = (KOUT*B2 - A2*DPI/6) *DSIN(DPI*T/6)
> >>
> >> KST = DPS1 + DPS2 + DPS3 + DPS4 + DPS5
> >>
> >> DADT(1) = KST - KOUT*A(1)
> >>
> >> In the paper published by Hempel et al (CPT, 1998;64:622-35), a ETA
> >> was introduced in the time T which accounts for the differences in
> >> wake-up times between subjects (e.g. DCOS(DPI*(T+ETA)/12). Because
> >> ETA is prohibited in the $DES, how can I code the interindividual
> >> variability of time in the control stream?
> >>
> >> Any suggestion is highly appreciated!
> >>
> >> Kind Regards, Ying
> >>
> >> --
> >> Ying HONG, PhD Department of Pharmaceutical Sciences University at
> >> Buffalo, SUNY C237 Cooke Hall, Buffalo, NY 14260
> >>
> >> Tel: 716 645 2828 ext 275 Fax: 716 645 3693 E-mail:
> >> [EMAIL PROTECTED]
> >>
> >
> > --
> > Nick Holford, Dept Pharmacology & Clinical Pharmacology University
> > of Auckland, 85 Park Rd, Private Bag 92019, Auckland, New Zealand
> > email:[EMAIL PROTECTED] tel:+64(9)373-7599x86730 fax:373-7556
> > http://www.health.auckland.ac.nz/pharmacology/staff/nholford/
> >
> >
>
>
> --
> Ying HONG, PhD Department of Pharmaceutical Sciences University at
> Buffalo, SUNY C237 Cooke Hall, Buffalo, NY 14260
>
> Tel: 716 645 2828 ext 275 Fax: 716 645 3693 E-mail: [EMAIL PROTECTED]
>
>
-- 
  Alison Boeckmann
  [EMAIL PROTECTED]

Reply via email to