Question about PK-PD models
I have a question for PK-PD modellers.
At present, DOWHIILE may be used in abbreviated code in
simulation, initialization-finalization, data average, expectation
blocks. These have ICALL\=2 and the eta derivatives are not needed.
With nm73, NMTRAN will have a new feature:
Use of DOWHILE in data-analytic (ICALL=2) blocks.
I have found it helpful for obtaining the eta derivatives to
make two restrictions:
639 VARIABLE MODIFIED IN DOWHILE MAY NOT ALREADY BE A RANDOM VARIABLE
640 VARIABLE MODIFIED IN DOWHILE MAY NOT BE MODIFIED MORE THAN ONCE.
These restrictions make impossible a loop such as this one:
TERM=THETA(1)*EXP(ETA(1))
SUM=0
I=1
DOWHILE (condition)
SUM=SUM+TERM
TERM=function(TERM)
I=I+1
ENDDO
You will note that TERM is being modified within DOWHILE, *and* it
is random.
In every example that I know of, TERM appears linearly, that is,
it is multiplied by a non-random variable, and only this multiplier
need be changed.
My question is:
Can anyone think of an example of this sort of loop that might be
used in PK/PD modelling, and TERM itself *must* be changed?
Possibly a TERM that is a function of two random variables?
A few comments:
All the elementary functions can be computed with Taylor series,
and I think any Taylor series can be computed with DOWHILE with the
restrictions. So it needs to be something more complicated.
-----------
For example, here are two fragments of code that work correctly.
Example 1: EXP function (an exercise using Taylor series)
; Taylor series (actually, Mclaurin series) for exp(F)=SUM of F**I/I!
; FI=F**I
; FACTORIAL=I!
FI=1
FACTORIAL=1
TERM=1
SUM=1
I=1
DOWHILE (I<999.and.TERM>.000000000000001)
FACTORIAL=FACTORIAL*I
FI=FI*F
TERM=FI/FACTORIAL
SUM=SUM+TERM
I=I+1
ENDDO
Example 2: Steady state dose into Transit compartment.
Past implied doses are summed until their contributions are negligible.
DOSE, DOSETIME, IIVAL are set in $PK from AMT, TIME, II on the SS
dose record. NN and KTR are set in $PK and are random variables.
$DES
INPT=0
ABI=1 ; set ABI to satisfy first DOWHILE condition
I=1
DOWHILE (I<999 .and. ABI>.000000001)
DELTAT=T-dosetime+(I-1)*IIVAL
IPT=DOSE*deltat**NN*EXP(-KTR*deltat)
INPT=INPT+IPT
ABI=ABS(IPT)
I=I+1
ENDDO
DADT(1)=KINPT*INPT-KTR*A(1)
....
--
Alison Boeckmann
[email protected]