Hi there,
Could you illustrate to make the Phoenix equivalent to this NONMEM twist, to get the the average concentration calculated on the fly, in period btw. current and since last effect response record.
Thx
Thomas
$PK
IF(NEWIND.NE.2)THEN ; set up variables for new subject
LAUC = 0 ; previous AUC
LTM = TIME ; previous time
LAVE = 0 ; average concentration since previous record
ENDIF
KA=THETA(1)
CL=THETA(2)
V=THETA(3)
$DES
DADT(1)=-KA*A(1)
DADT(2)=KA*A(1)-CL/V*A(2)
DADT(3)=A(2)
$ERROR
CP=A(2)/V
AUC=A(3)/V
DTIM = TIME - LTM ; Time difference
DAUC = AUC - LAUC ; Difference in AUC
IF(DTIM.EQ.0)THEN
CAVE = LAVE ; Time has not changed, average concentration is the same
ELSE
CAVE = DAUC/DTIM
ENDIF
; Record current AUC and TIME for next call
LAUC = AUC
LTM = TIME
LAVE = CAVE
BASE = FID1
EFF = EM*CAVE**HILL/(EC**HILL+CAVE**HILL)
IPRE = BASE - EFF
IF(IPRE.LT.0) IPRE=0
Y = IPRE + EPS(1)