Tip # 3 -
Coding Time After Dose (TAD) and ... the NONMEM Coding Challenge
#1:
Topic for Tip of the "Random Time Interval" # 3 was suggested
by Nick Holford.
Having the time of an observation after a dose (TAD) is useful
in generating diagnostic plots, particulary in multiple dose
studies. (TAD is also used in diagnostic plots that are automatically
generated with the PDx-Pop interface and must be found in
the table file for the run.)
Several ways of generating TAD are given below in order of
increasing complexity:
in this version, I keyed off of AMT:
$PK
IF (AMT.GT.0) THEN
TDOS=TIME
TAD=0.0
ENDIF
IF (AMT.EQ.0) TAD=TIME-TDOS
Caution: will not work for SS infustion (AMT is 0).
you could also use EVID:
$PK
IF (EVID.EQ.1.OR.EVID.EQ.4) THEN
TDOS=TIME
TAD=0.0
ENDIF
IF (EVID.NE.1.AND.EVID.NE.4) TAD=TIME-TDOS
Caution: will not work for observations before the first
dose as may be found in PK-PD data.
this version uses EVID and NEWIND. The code below sets
TAD=0.0 for all nondose records prior to the first dose.
$PK
IF(NEWIND.LT.2) THEN
IFL=0
TAD=0.0
ENDIF
IF(EVID.EQ.1.OR.EVID.EQ.4) THEN
TDOS=TIME
TAD=0.0
IFL=1
ENDIF
IF(IFL.EQ.1.AND.EVID.NE.1.AND.EVID.NE.4)TAD=TIME-TDOS
Caution: will not calculate correct TAD for observations
after an ADDL dose
[Note: Remember to ask for TAD in the $TABLE record of your
control stream.] and now ... (drum roll please) ... the
NONMEM Coding Challenge #1
CHALLENGE: How would you code to get the correct
TAD after ADDL doses? (control stream and data below)
[To be honest, I haven't figured this one out yet myself! This
tip is already late enough, so, for those of you who like a
challenge or who just have a lot of time on your hands, give
it a shot! The solution that I like the best will be published
in a subsequent "Tip" {- NO, THIS IS NOT A DEMOCRACY -}.] Hint:
may require an INFN subroutine
CONTROL STREAM:
$PROB RUN# 705 nonmem coding challenge #1
$INPUT C ID TIME DV AMT WT AGE CRCL SMK ADDL II EVID
$DATA 704.csv IGNORE=C
$SUBROUTINE ADVAN2 TRANS2
$PK
;replace this TAD code with yours for ADDL TAD's
IF(NEWIND.LT.2) THEN
IFL=0
TAD=0.0
ENDIF
IF(EVID.EQ.1.OR.EVID.EQ.4) THEN
TDOS=TIME
TAD=0.0
IFL=1
ENDIF
IF(IFL.EQ.1.AND.EVID.NE.1.AND.EVID.NE.4)TAD=TIME-TDOS