simulation of dose escalation study
From: "Anthe Zandvliet" Apaza@SLZ.NL
Subject: [NMusers] simulation of dose escalation study
Date: Fri, April 15, 2005 5:34 am
Dear all,
I want to simulate a dose escalation study based on a PKPD population model. With
the attached files, I can indeed perform the simulation. However, I need to redefine
the seed for each individual. Does anyone know how to perform this simulation in a
more automated manner?
The PKPD model (which I have simplified for the purpose of asking for your
recommendations) comes down to:
- a 1-compartment linear PK model. The drug is administered as a singel bolus at
time=1.
- a PD model representing a side effect of the drug.
- a dummy compartment to calculate the maximal side effect.
The maximal side effect is representative for the severeness of the side effect and
determines whether or not the dose is escalated. If the maximal side effect remains
below 50 in a particular patient (A), the dose for the subsequent patient (B) is
escalated to the next dose level. If the maximal side effect of patient A is larger
than 50, the dose for patient B remains at the same level. etc.
Using 006_1.ctl, the maximal side effect Emax is simulated for patient A.
Subsequently, 007.ctl is applied to determine the dose level for patient B. Emax of
patient B is determined with 006_2.ctl where the seed is changed from 1 to 2. Again,
007.ctl calculates the dose level for patient C. etc.
This can be done quite easily for a couple of patients using a batch file. However,
in order to simulate 200 studies of 20 patients each, 4000 control streams should be
renamed and seeds need to be changed.
Does anyone know how to do this more conveniently? Thank you in advance!
Best regards, Anthe
************************************
nmusers.for
SUBROUTINE READER()
COMMON /READ/ TID,TCOV
REAL TID(13),TCOV(13,2)
OPEN(UNIT = 77,FILE = 'DATA.CSV')
REWIND 77
DO 11,I = 1,13
READ(77,*) TID(I),TCOV(I,1), TCOV(I,2)
11 CONTINUE
END
SUBROUTINE GET_SUB(NEWIND,ID,CURID,COV1,COV2,MID)
COMMON /READ/ TID,TCOV
REAL ID,CURID,COV1,COV2,MID
INTEGER NEWIND
REAL TID(13),TCOV(13,2)
IF (NEWIND.EQ.1) THEN
12 CONTINUE
IF(ID.GT.TID(CURID)) THEN
CURID =CURID + 1
GOTO 12
END IF
ELSEIF(NEWIND.EQ.0) THEN
CURID = 1
END IF
COV1 = TCOV(CURID,1)
COV2 = TCOV(CURID,2)
MID = TID(CURID)
END
************************************
006.csv
SID ID TIME AMT LEV DV NUL
1 13 0 0 50 0 0
1 13 1 1 50 0 0
1 13 2 0 50 0 0
1 13 3 0 50 0 0
1 13 4 0 50 0 0
1 13 5 0 50 0 0
1 13 6 0 50 0 0
1 13 7 0 50 0 0
1 13 8 0 50 0 0
1 13 9 0 50 0 0
1 13 10 0 50 0 0
1 13 11 0 50 0 0
1 13 12 0 50 0 0
*****************************
006.bat
CALL NMFE5 006_1.CTL 006_1.RES
CALL NMFE5 007.CTL 007.RES
CALL NMFE5 006_2.CTL 006_2.RES
CALL NMFE5 007.CTL 007.RES
CALL NMFE5 006_3.CTL 006_3.RES
CALL NMFE5 007.CTL 007.RES
************************************
006_1.ctl
$PROB RUN# 006
$INPUT SID ID TIME AMT LEV DV NUL
$DATA 006.CSV IGNORE=@
$SUBROUTINES ADVAN6 TOL=5
$MODEL COMP=(PK, DEFDOS)
COMP=(PD, DEFOBS)
COMP=(EMAX)
$PK
F1=LEV
S1=THETA(1)*EXP(ETA(1))
K12=THETA(2)*EXP(ETA(2))
S2=THETA(3)*EXP(ETA(3))
K20=THETA(4)*EXP(ETA(4))
IF(TIME.EQ.0) CID=1
IF(TIME.EQ.1) CID=2
IF(TIME.EQ.2) CID=3
IF(TIME.EQ.3) CID=4
IF(TIME.EQ.4) CID=5
IF(TIME.EQ.5) CID=6
IF(TIME.EQ.6) CID=7
IF(TIME.EQ.7) CID=8
IF(TIME.EQ.8) CID=9
IF(TIME.EQ.9) CID=10
IF(TIME.EQ.10) CID=11
IF(TIME.EQ.11) CID=12
IF(TIME.EQ.12) CID=13
$DES
DADT(1)=-K12*A(1)
DADT(2)=K12*A(1)-K20*A(2)
IF(DADT(2).GT.0) THEN
DADT(3)=DADT(2)
ELSE
DADT(3)=0
ENDIF
$ERROR
IPRED=F
Y=IPRED*EXP(EPS(1))
E=A(2)/S2
EMAX=A(3)/S2
$THETA
1 ;S1
0.5 ;K12
1 ;S2
0.3 ;K20
$OMEGA
0.01
0.01
0.01
0.01
$SIGMA
0.01
$SIMULATION (1) ONLYSIM
$TABLE SID ID TIME AMT DV DV NUL
FILE=006.TAB NOAPPEND NOPRINT ONEHEADER NOFORWARD
$TABLE CID EMAX LEV
FILE=DATA.CSV NOAPPEND NOPRINT NOHEADER NOFORWARD
********************************
007.ctl
$PROB RUN# 007
$INPUT SID ID TIME AMT DVR DV NUL
$DATA 006.TAB IGNORE=@
$SUBROUTINES OTHER=NMUSERS.FOR
$PRED
" FIRST
" REAL CURID,ICOV1,ICOV2,MID
" LOGICAL READ
" IF(.NOT.READ)THEN
" CALL READER()
" CURID=1
" READ=.TRUE.
" ENDIF
" IF(NEWIND.LT.2)THEN
" CALL GET_SUB(NEWIND,ID,CURID,ICOV1,ICOV2,MID)
" ENDIF
COV1=ICOV1
COV2=ICOV2
EMAX=ICOV1
LEV=ICOV2
IF(LEV.EQ.50) NEXT=100
IF(LEV.EQ.100) NEXT=200
IF(LEV.EQ.200) NEXT=400
IF(LEV.EQ.400) NEXT=500
IF(LEV.EQ.500) NEXT=600
IF(LEV.EQ.600) NEXT=700
IF(LEV.EQ.700) NEXT=800
IF(LEV.EQ.800) NEXT=1000
IF(LEV.GE.1000) NEXT=LEV+100
IF(EMAX.GT.50) THEN
LEVN=LEV
ELSE
LEVN=NEXT
ENDIF
SIDN=SID+1
X=THETA(1)*EXP(ETA(1))
Y=X
$THETA
1
$OMEGA
0.0001
$SIMULATION (9999) ONLYSIM
$TABLE SIDN ID TIME AMT LEVN NUL NUL
FILE=006.TAB NOPRINT ONEHEADER NOFORWARD
$TABLE SID ID TIME LEV EMAX DVR
FILE=007.TAB NOPRINT ONEHEADER FORWARD
**********************************
006_2.ctl
;Model Desc: base model
;Project Name: pkpd simulaties
;Project ID: NO PROJECT DESCRIPTION
$PROB RUN# 006
$INPUT SID ID TIME AMT LEV DV NUL
$DATA 006.TAB IGNORE=@
$SUBROUTINES ADVAN6 TOL=5
$MODEL COMP=(PK, DEFDOS)
COMP=(PD, DEFOBS)
COMP=(EMAX)
$PK
F1=LEV
S1=THETA(1)*EXP(ETA(1))
K12=THETA(2)*EXP(ETA(2))
S2=THETA(3)*EXP(ETA(3))
K20=THETA(4)*EXP(ETA(4))
IF(TIME.EQ.0) CID=1
IF(TIME.EQ.1) CID=2
IF(TIME.EQ.2) CID=3
IF(TIME.EQ.3) CID=4
IF(TIME.EQ.4) CID=5
IF(TIME.EQ.5) CID=6
IF(TIME.EQ.6) CID=7
IF(TIME.EQ.7) CID=8
IF(TIME.EQ.8) CID=9
IF(TIME.EQ.9) CID=10
IF(TIME.EQ.10) CID=11
IF(TIME.EQ.11) CID=12
IF(TIME.EQ.12) CID=13
$DES
DADT(1)=-K12*A(1)
DADT(2)=K12*A(1)-K20*A(2)
IF(DADT(2).GT.0) THEN
DADT(3)=DADT(2)
ELSE
DADT(3)=0
ENDIF
$ERROR
IPRED=F
Y=IPRED*EXP(EPS(1))
E=A(2)/S2
EMAX=A(3)/S2
$THETA
1 ;S1
0.5 ;K12
1 ;S2
0.3 ;K20
$OMEGA
0.01
0.01
0.01
0.01
$SIGMA
0.01
$SIMULATION (2) ONLYSIM
$TABLE SID ID TIME AMT DV DV NUL
FILE=006.TAB NOAPPEND NOPRINT ONEHEADER NOFORWARD
$TABLE CID EMAX LEV
FILE=DATA.CSV NOAPPEND NOPRINT NOHEADER NOFORWARD
Slotervaart Hospital
Dept. Pharmacy and Pharmacology
Louwesweg 6
1066 EC AMSTERDAM
The Netherlands
Telephone +31 20 512 4657
FAX + 31 20 512 4753