"Tip of the Week #3 - February 25, 2002" - Coding Time After Dose

2 messages 2 people Latest: Feb 27, 2002
From:"Bachman, William" Subject:[NMusers] "Tip of the Week #3 - February 25, 2002" - Coding Time After Dose Date:Tue, February 26, 2002 4:42 pm 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: 1. 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). 2. 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. 3. 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 CL=THETA(1)*EXP(ETA(1)) TVV=THETA(2) V=TVV*EXP(ETA(2)) TVKA=THETA(3) KA=TVKA*EXP(ETA(3)) S2=V $THETA (0, 10) (0, 100) (0, 0.5) $ERROR Y=F+ERR(1) IPRED=F $OMEGA 0.04 ;[P] INTERIND VAR IN CL 0.04 ;[P] INTERIND VAR IN V 0.04 ;[P] INTERIND VAR IN KA $SIGMA 0.2 ;[A] ADDITIVE COMPONENT $EST MAXEVAL=0 PRINT=2 NOABORT ;POSTHOC $TABLE ID TIME IPRED TAD NOPRINT ONEHEADER FILE=705.tab DATA FILE (704.CSV): C,Data Desc: test of TAD for ADDL,,,,,,,,,, C,ID,TIME,DV,AMT,WT,AGE,CRCL,SMK,ADDL,II,EVID ,1,0,0,0,58.4,51,4.49,1,0,0,2 ,1,0.1,0,500,58.4,51,4.49,1,1,24,1 ,1,1.1,1.67538,0,58.4,51,4.49,1,0,0,0 ,1,4.1,2.79283,0,58.4,51,4.49,1,0,0,0 ,1,10.1,0.583263,0,58.4,51,4.49,1,0,0,0 ,1,24.1,0.146255,0,58.4,51,4.49,1,0,0,0 ,1,25.1,1.67538,0,58.4,51,4.49,1,0,0,0 ,2,0,0,0,79.3,53,5.05,0,0,0,2 ,2,0.1,0,500,79.3,53,5.05,0,1,24,1 ,2,1.1,1.32864,0,79.3,53,5.05,0,0,0,0 ,2,4.1,3.89134,0,79.3,53,5.05,0,0,0,0 ,2,10.1,3.27451,0,79.3,53,5.05,0,0,0,0 ,2,24.1,1.1749,0,79.3,53,5.05,0,0,0,0 ,2,25.1,1.32864,0,79.3,53,5.05,0,0,0,0 ,3,0,0,0,88.3,53,6.55,1,0,0,2 ,3,0.1,0,500,88.3,53,6.55,1,1,24,1 ,3,1.1,0.803595,0,88.3,53,6.55,1,0,0,0 ,3,4.1,1.62364,0,88.3,53,6.55,1,0,0,0 ,3,10.1,0.508614,0,88.3,53,6.55,1,0,0,0 ,3,24.1,0.13739,0,88.3,53,6.55,1,0,0,0 ,3,25.1,0.803595,0,88.3,53,6.55,1,0,0,0 ,4,0,0,0,69.9,25,5.96,1,0,0,2 ,4,0.1,0,500,69.9,25,5.96,1,1,24,1 ,4,1.1,2.45726,0,69.9,25,5.96,1,0,0,0 ,4,4.1,5.92102,0,69.9,25,5.96,1,0,0,0 ,4,10.1,3.18875,0,69.9,25,5.96,1,0,0,0 ,4,24.1,0.564405,0,69.9,25,5.96,1,0,0,0 ,4,25.1,2.45726,0,69.9,25,5.96,1,0,0,0 ,5,0,0,0,76.7,51,7.92,0,0,0,2 ,5,0.1,0,500,76.7,51,7.92,0,1,24,1 ,5,1.1,1.55213,0,76.7,51,7.92,0,0,0,0 ,5,4.1,4.31103,0,76.7,51,7.92,0,0,0,0 ,5,10.1,3.8874,0,76.7,51,7.92,0,0,0,0 ,5,24.1,1.3813,0,76.7,51,7.92,0,0,0,0 ,5,25.1,1.55213,0,76.7,51,7.92,0,0,0,0 ,6,0,0,0,84.8,58,5.57,0,0,0,2 ,6,0.1,0,500,84.8,58,5.57,0,1,24,1 ,6,1.1,1.39749,0,84.8,58,5.57,0,0,0,0 ,6,4.1,3.14751,0,84.8,58,5.57,0,0,0,0 ,6,10.1,2.4798,0,84.8,58,5.57,0,0,0,0 ,6,24.1,0.870149,0,84.8,58,5.57,0,0,0,0 ,6,25.1,1.39749,0,84.8,58,5.57,0,0,0,0 ,7,0,0,0,79.3,59,3.31,1,0,0,2 ,7,0.1,0,500,79.3,59,3.31,1,1,24,1 ,7,1.1,2.27435,0,79.3,59,3.31,1,0,0,0 ,7,4.1,3.17944,0,79.3,59,3.31,1,0,0,0 ,7,10.1,1.04811,0,79.3,59,3.31,1,0,0,0 ,7,24.1,0.006388,0,79.3,59,3.31,1,0,0,0 ,7,25.1,2.27435,0,79.3,59,3.31,1,0,0,0 ,8,0,0,0,76.8,60,7.05,1,0,0,2 ,8,0.1,0,500,76.8,60,7.05,1,1,24,1 ,8,1.1,1.10077,0,76.8,60,7.05,1,0,0,0 ,8,4.1,2.27792,0,76.8,60,7.05,1,0,0,0 ,8,10.1,1.10827,0,76.8,60,7.05,1,0,0,0 ,8,24.1,0.069864,0,76.8,60,7.05,1,0,0,0 ,8,25.1,1.10077,0,76.8,60,7.05,1,0,0,0 ,9,0,0,0,92.2,56,6.8,1,0,0,2 ,9,0.1,0,500,92.2,56,6.8,1,1,24,1 ,9,1.1,1.11266,0,92.2,56,6.8,1,0,0,0 ,9,4.1,2.35879,0,92.2,56,6.8,1,0,0,0 ,9,10.1,1.39264,0,92.2,56,6.8,1,0,0,0 ,9,24.1,0.115128,0,92.2,56,6.8,1,0,0,0 ,9,25.1,1.11266,0,92.2,56,6.8,1,0,0,0 ,10,0,0,0,79.6,65,6.59,1,0,0,2 ,10,0.1,0,500,79.6,65,6.59,1,1,24,1 ,10,1.1,1.47965,0,79.6,65,6.59,1,0,0,0 ,10,4.1,2.87565,0,79.6,65,6.59,1,0,0,0 ,10,10.1,1.47107,0,79.6,65,6.59,1,0,0,0 ,10,24.1,0.189881,0,79.6,65,6.59,1,0,0,0 ,10,25.1,1.47965,0,79.6,65,6.59,1,0,0,0 ,11,0,0,0,72.6,57,7.26,1,0,0,2 ,11,0.1,0,500,72.6,57,7.26,1,1,24,1 ,11,1.1,2.78516,0,72.6,57,7.26,1,0,0,0 ,11,4.1,5.9958,0,72.6,57,7.26,1,0,0,0 ,11,10.1,2.74331,0,72.6,57,7.26,1,0,0,0 ,11,24.1,0.272643,0,72.6,57,7.26,1,0,0,0 ,11,25.1,2.78516,0,72.6,57,7.26,1,0,0,0 ,12,0,0,0,83.3,63,4.41,1,0,0,2 ,12,0.1,0,500,83.3,63,4.41,1,1,24,1 ,12,1.1,2.36294,0,83.3,63,4.41,1,0,0,0 ,12,4.1,4.37676,0,83.3,63,4.41,1,0,0,0 ,12,10.1,2.21826,0,83.3,63,4.41,1,0,0,0 ,12,24.1,0.127228,0,83.3,63,4.41,1,0,0,0 ,12,25.1,2.36294,0,83.3,63,4.41,1,0,0,0 ,13,0,0,0,76.2,28,5.91,0,0,0,2 ,13,0.1,0,500,76.2,28,5.91,0,1,24,1 ,13,1.1,2.05905,0,76.2,28,5.91,0,0,0,0 ,13,4.1,5.18627,0,76.2,28,5.91,0,0,0,0 ,13,10.1,3.31315,0,76.2,28,5.91,0,0,0,0 ,13,24.1,0.690486,0,76.2,28,5.91,0,0,0,0 ,13,25.1,2.05905,0,76.2,28,5.91,0,0,0,0 ,14,0,0,0,58.4,27,5.16,0,0,0,2 ,14,0.1,0,500,58.4,27,5.16,0,1,24,1 ,14,1.1,1.78423,0,58.4,27,5.16,0,0,0,0 ,14,4.1,5.60111,0,58.4,27,5.16,0,0,0,0 ,14,10.1,4.88792,0,58.4,27,5.16,0,0,0,0 ,14,24.1,1.71557,0,58.4,27,5.16,0,0,0,0 ,14,25.1,1.78423,0,58.4,27,5.16,0,0,0,0 ,15,0,0,0,53.4,33,6.2,0,0,0,2 ,15,0.1,0,500,53.4,33,6.2,0,1,24,1 ,15,1.1,2.31405,0,53.4,33,6.2,0,0,0,0 ,15,4.1,4.82135,0,53.4,33,6.2,0,0,0,0 ,15,10.1,2.78629,0,53.4,33,6.2,0,0,0,0 ,15,24.1,0.44581,0,53.4,33,6.2,0,0,0,0 ,15,25.1,2.31405,0,53.4,33,6.2,0,0,0,0 ,16,0,0,0,80.9,63,2.32,1,0,0,2 ,16,0.1,0,500,80.9,63,2.32,1,1,24,1 ,16,1.1,1.63497,0,80.9,63,2.32,1,0,0,0 ,16,4.1,3.31025,0,80.9,63,2.32,1,0,0,0 ,16,10.1,1.3666,0,80.9,63,2.32,1,0,0,0 ,16,24.1,0.105905,0,80.9,63,2.32,1,0,0,0 ,16,25.1,1.63497,0,80.9,63,2.32,1,0,0,0 ,17,0,0,0,91.1,62,7.45,0,0,0,2 ,17,0.1,0,500,91.1,62,7.45,0,1,24,1 ,17,1.1,1.69697,0,91.1,62,7.45,0,0,0,0 ,17,4.1,2.56591,0,91.1,62,7.45,0,0,0,0 ,17,10.1,1.07543,0,91.1,62,7.45,0,0,0,0 ,17,24.1,0.173012,0,91.1,62,7.45,0,0,0,0 ,17,25.1,1.69697,0,91.1,62,7.45,0,0,0,0 ,18,0,0,0,60.7,48,4.5,1,0,0,2 ,18,0.1,0,500,60.7,48,4.5,1,1,24,1 ,18,1.1,1.34805,0,60.7,48,4.5,1,0,0,0 ,18,4.1,2.82872,0,60.7,48,4.5,1,0,0,0 ,18,10.1,1.17772,0,60.7,48,4.5,1,0,0,0 ,18,24.1,0.166779,0,60.7,48,4.5,1,0,0,0 ,18,25.1,1.34805,0,60.7,48,4.5,1,0,0,0 ,19,0,0,0,69.6,39,4.78,0,0,0,2 ,19,0.1,0,500,69.6,39,4.78,0,1,24,1 ,19,1.1,1.41609,0,69.6,39,4.78,0,0,0,0 ,19,4.1,3.64124,0,69.6,39,4.78,0,0,0,0 ,19,10.1,2.85268,0,69.6,39,4.78,0,0,0,0 ,19,24.1,0.443417,0,69.6,39,4.78,0,0,0,0 ,19,25.1,1.41609,0,69.6,39,4.78,0,0,0,0 ,20,0,0,0,71.5,46,7.47,0,0,0,2 ,20,0.1,0,500,71.5,46,7.47,0,1,24,1 ,20,1.1,1.45283,0,71.5,46,7.47,0,0,0,0 ,20,4.1,3.70842,0,71.5,46,7.47,0,0,0,0 ,20,10.1,2.52282,0,71.5,46,7.47,0,0,0,0 ,20,24.1,0.633448,0,71.5,46,7.47,0,0,0,0 ,20,25.1,1.45283,0,71.5,46,7.47,0,0,0,0 ,21,0,0,0,71.1,45,3.19,0,0,0,2 ,21,0.1,0,500,71.1,45,3.19,0,1,24,1 ,21,1.1,1.3647,0,71.1,45,3.19,0,0,0,0 ,21,4.1,4.23997,0,71.1,45,3.19,0,0,0,0 ,21,10.1,4.22604,0,71.1,45,3.19,0,0,0,0 ,21,24.1,2.19366,0,71.1,45,3.19,0,0,0,0 ,21,25.1,1.3647,0,71.1,45,3.19,0,0,0,0 ,22,0,0,0,56.2,72,3.9,0,0,0,2 ,22,0.1,0,500,56.2,72,3.9,0,1,24,1 ,22,1.1,1.25251,0,56.2,72,3.9,0,0,0,0 ,22,4.1,3.15997,0,56.2,72,3.9,0,0,0,0 ,22,10.1,2.08904,0,56.2,72,3.9,0,0,0,0 ,22,24.1,0.516536,0,56.2,72,3.9,0,0,0,0 ,22,25.1,1.25251,0,56.2,72,3.9,0,0,0,0 ,23,0,0,0,60.9,49,2.89,0,0,0,2 ,23,0.1,0,500,60.9,49,2.89,0,1,24,1 ,23,1.1,3.87079,0,60.9,49,2.89,0,0,0,0 ,23,4.1,6.33528,0,60.9,49,2.89,0,0,0,0 ,23,10.1,4.26429,0,60.9,49,2.89,0,0,0,0 ,23,24.1,1.26654,0,60.9,49,2.89,0,0,0,0 ,23,25.1,3.87079,0,60.9,49,2.89,0,0,0,0 ,24,0,0,0,85.9,41,5.43,0,0,0,2 ,24,0.1,0,500,85.9,41,5.43,0,1,24,1 ,24,1.1,1.25722,0,85.9,41,5.43,0,0,0,0 ,24,4.1,3.19174,0,85.9,41,5.43,0,0,0,0 ,24,10.1,2.61531,0,85.9,41,5.43,0,0,0,0 ,24,24.1,0.995998,0,85.9,41,5.43,0,0,0,0 ,24,25.1,1.25722,0,85.9,41,5.43,0,0,0,0 ,25,0,0,0,75.5,38,4.16,0,0,0,2 ,25,0.1,0,500,75.5,38,4.16,0,1,24,1 ,25,1.1,2.57073,0,75.5,38,4.16,0,0,0,0 ,25,4.1,5.01613,0,75.5,38,4.16,0,0,0,0 ,25,10.1,2.99356,0,75.5,38,4.16,0,0,0,0 ,25,24.1,0.653015,0,75.5,38,4.16,0,0,0,0 ,25,25.1,2.57073,0,75.5,38,4.16,0,0,0,0 ,26,0,0,0,51.5,51,3.79,0,0,0,2 ,26,0.1,0,500,51.5,51,3.79,0,1,24,1 ,26,1.1,3.64646,0,51.5,51,3.79,0,0,0,0 ,26,4.1,8.05537,0,51.5,51,3.79,0,0,0,0 ,26,10.1,5.38704,0,51.5,51,3.79,0,0,0,0 ,26,24.1,1.19447,0,51.5,51,3.79,0,0,0,0 ,26,25.1,3.64646,0,51.5,51,3.79,0,0,0,0 ,27,0,0,0,60.6,60,3.99,0,0,0,2 ,27,0.1,0,500,60.6,60,3.99,0,1,24,1 ,27,1.1,2.32245,0,60.6,60,3.99,0,0,0,0 ,27,4.1,4.62563,0,60.6,60,3.99,0,0,0,0 ,27,10.1,2.86928,0,60.6,60,3.99,0,0,0,0 ,27,24.1,0.830628,0,60.6,60,3.99,0,0,0,0 ,27,25.1,2.32245,0,60.6,60,3.99,0,0,0,0 ,28,0,0,0,81.6,39,5.44,1,0,0,2 ,28,0.1,0,500,81.6,39,5.44,1,1,24,1 ,28,1.1,1.6357,0,81.6,39,5.44,1,0,0,0 ,28,4.1,3.02622,0,81.6,39,5.44,1,0,0,0 ,28,10.1,1.19906,0,81.6,39,5.44,1,0,0,0 ,28,24.1,0.039839,0,81.6,39,5.44,1,0,0,0 ,28,25.1,1.6357,0,81.6,39,5.44,1,0,0,0 ,29,0,0,0,86.5,47,7.5,0,0,0,2 ,29,0.1,0,500,86.5,47,7.5,0,1,24,1 ,29,1.1,0.645889,0,86.5,47,7.5,0,0,0,0 ,29,4.1,1.76215,0,86.5,47,7.5,0,0,0,0 ,29,10.1,1.07923,0,86.5,47,7.5,0,0,0,0 ,29,24.1,0.209841,0,86.5,47,7.5,0,0,0,0 ,29,25.1,0.645889,0,86.5,47,7.5,0,0,0,0 ,30,0,0,0,67.3,55,7.18,1,0,0,2 ,30,0.1,0,500,67.3,55,7.18,1,1,24,1 ,30,1.1,1.52906,0,67.3,55,7.18,1,0,0,0 ,30,4.1,3.7605,0,67.3,55,7.18,1,0,0,0 ,30,10.1,2.03334,0,67.3,55,7.18,1,0,0,0 ,30,24.1,0.244644,0,67.3,55,7.18,1,0,0,0 ,30,25.1,1.52906,0,67.3,55,7.18,1,0,0,0 ***************************************************************** 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
From:Mats Karlsson [mailto:Mats.Karlsson@farmbio.uu.se] Subject:Re: [NMusers] "Tip of the Week #3 - February 25, 2002" - Coding Time After Dose(TAD) and ... the NONMEM Coding Challenge #1 Date:Wed, February 27, 2002 10:20 am Hi, Rather than trying to answer the difficult ADDL problem, I'd just like to say that Nick and Bill kindly made this oppotunity to point out (and warn) that Xpose allows an even simpler way to calculate TAD. In Xpose, TAD is calculated (use "managing databases option 24.2") from the table files assuming that any non-observation record (i.e. WRES=0) is a dosing record. Thus, the generation of TAD in Xpose won't appropriately handle ADDL records, SS infusions or EVID=2 (observations before the first dose will be assumed to be zero though). Mats Mats Karlsson, PhD Professor of Pharmacometrics Div. of Pharmacokinetics and Drug Therapy Dept. of Pharmaceutical Biosciences Faculty of Pharmacy Uppsala University Box 591 SE-751 24 Uppsala Sweden phone +46 18 471 4105 fax +46 18 471 4003 mats.karlsson@farmbio.uu.se