From:"Bachman, William"   
Subject: [NMusers] "Tip of the Week #4 - March 4, 2002" - Coding Time After Dose(TAD) 
Date: Mon, March 4, 2002 1:06 pm

Last week's Tip put forth the following challenge:

How would you code to get the correct TAD after ADDL doses?  A sample
control stream, data file and hint were given.
[Hint: may require an INFN subroutine]

One solution, in fact the only one received, from an anonymous scholar used
a replacement INFN Fortran subroutine named TAD.for.  The concepts used
were:

1. add an additional column (named TAD) to the datafile filled with zeros as
placeholders.

2. code a solution for calculating TAD in TAD.for using modulus arithmetic:

C TAD.FOR (INFN ROUTINE FOR COMPUTING TIME AFTER DOSE)
C wjb 28feb2002 GloboMax LLC   
C data items: C ID TIME DV AMT WT AGE CRCL SMK ADDL II EVID TAD
C DATREC(3)=TIME DATA ITEM
C DATREC(10)=ADDL DATA ITEM
C DATREC(11)=II DATA ITEM
C DATREC(12)=EVID DATA ITEM 
C DATREC(13)=TAD DATA ITEM 
C   
       SUBROUTINE INFN (ICALL,THETA,DATREC,INDXS,NEWIND)
       DIMENSION THETA(*),DATREC(*),INDXS(*)
       DOUBLE PRECISION THETA 
       INTEGER IFL
       REAL DATREC, DIV, TDOS
C call at termination only       
       IF (ICALL.EQ.3) THEN
C INITIALIZE PASS
       MODE=0
       CALL PASS (MODE)
       MODE=2
C PASS THROUGH DATA
    5  CALL PASS (MODE)
       IF (MODE.EQ.0) GO TO 10
       IF (NEWIND.LT.2) THEN
         DATREC(13)=0.0
         IFL=0
       ENDIF
       IF(DATREC(12).EQ.1.OR.DATREC(12).EQ.4) THEN
          DATREC(13)=0.0
          DIV=DATREC(11)
          TDOS=DATREC(3)
          IFL=1
       ENDIF  
       IF(IFL.EQ.1.AND.DATREC(12).NE.1.AND.DATREC(12).NE.4) 
     1 DATREC(13)=AMOD(DATREC(3)-TDOS,DIV)
       GO TO 5
   10  ENDIF
       END

3. modify the control stream to use the modified data file and call the new
INFN routine:

$PROB RUN# 708 nonmem challenge #1 solution wjb 28FEB2000
$INPUT C ID TIME DV AMT WT AGE CRCL SMK ADDL II EVID TAD
$DATA 706.csv IGNORE=C
$SUBROUTINE ADVAN2 TRANS2 INFN=TAD.FOR
;no code for TAD in control stream needed


[Note: Verify that this code or any other code you receive from an outside
source works with YOUR DATA.]

*****************************************************************
If you have a "tip" or a better way to do things, by all means, feel free to
post them!  One of the reasons for doing this (other than good PR for
GloboMax), is to stimulate discussion.  We at GloboMax can learn from your
experience as well.
Do you have a "tip" you would like to share, but would prefer to remain
anonymous?  If so, you may forward it to us and your identity will be
withheld.  Distribution as a "Tip of the Week" will be at the discretion of
nmconsult@globomaxnm.com.
*****************************************************************


nmconsult@globomaxnm.com
GloboMax LLC
7250 Parkway Drive, Suite 430
Hanover, MD 21076
Voice: (410) 782-2205
FAX: (410) 712-0737