z
;; 1. Based on: 000
;; 2. Description: Haloperidol
;; x1. Author: user
Problem description (required):
$PROBLEM PK model
$INPUT CENSOR AORTA=DROP ID DATE=DROP TIME AMT DV EVID MDV
$DATA DATABASE_1.CSV IGNORE=C
$SUBROUTINE ADVAN1 TRANS2
$PK
CL = THETA(3) * EXP(ETA(1))
V = THETA(4) * EXP(ETA(2))
S1 = V/1000
$THETA
(0,0.5) ; 1 prop
(0,0.005) ; 2 add
(0,24) ; 3 CL
(0,2500) ; 4 V
$OMEGA BLOCK(2)
0.3 ;; IIV-CL
0.1 0.03 ;; IIV-V
$SIGMA
1 FIX
$ERROR
IPRED = F
IRES = DV-IPRED
W = IPRED * THETA(1) + THETA(2)
IF (W.EQ.0) W = 1
IWRES = IRES/W
Y= IPRED + W * ERR(1)
$ESTIMATION
METHOD=1 MAXEVAL=99999 SIG=3 PRINT=5 NOABORT POSTHOC INTERACTION
$COVARIANCE
PRINT=E UNCONDITIONAL
$TABLE ID IPRED IWRES CWRES NOPRINT ONEHEADER FILE=SDTAB001
$TABLE ID CL V ETA1 ETA2 NOPRINT ONEHEADER FILE=PATAB001
$TABLE ID NOPRINT ONEHEADER FILE=COTAB001
$TABLE ID NOPRINT ONEHEADER FILE=CATAB001
;; 1. Based on: 001
;; 2. Description: drug
;; x1. Author: www.pkpd-info.com
$PROBLEM PK model
$INPUT ;; Change to dataset
CENSOR AORTA=DROP ID DATE=DROP TIME AMT EVID MDV TAD DV
$DATA datafile.CSV IGNORE=C
$SUBROUTINES
ADVAN1 TRANS2 ;; 1-compartment iv data
$PK
CL = THETA(3) * EXP(ETA(1))
V = THETA(4) * EXP(ETA(2))
S1 = V ;; scaling of compartment check units of dose and observations
$THETA ;; set realistic initial estimates (also for proportional and additive error)
(0, 0.1) ;1 prop
(0, 0.5) ;2 add
(0, 30) ;3 CL
(0, 200) ;4 V
$OMEGA BLOCK(2)
0.09 ;; IIV-CL
0.01 0.09 ;; IIV-V
$SIGMA
1 FIX ;residual variability
$ERROR ;; For calculation based on linear (non log-transformed) data
IPRED = F
IRES = DV-IPRED
W = IPRED*THETA(1)+THETA(2)
IF (W.EQ.0) W = 1
IWRES = IRES/W
Y= IPRED+W*ERR(1)
$EST METHOD=1 MAXEVAL=99999 SIG=3 PRINT=5 NOABORT POSTHOC INTERACTION ;; Estimation method FOCE+interaction
$COV PRINT=E UNCONDITIONAL
$TABLE ID TAD IPRED IWRES CWRES EVID MDV TIME NOPRINT ONEHEADER FILE=SDTAB001
$TABLE ID CL V ETA1 ETA2 NOPRINT ONEHEADER FILE=PATAB001
$TABLE ID NOPRINT ONEHEADER FILE=COTAB001
$TABLE ID NOPRINT ONEHEADER FILE=CATAB001
;; 1. Based on: 001
;; 2. Description: drug
;; x1. Author: www.pkpd-info.com
$PROBLEM PK model
$INPUT ;; Pas aan naar dataset
CENSOR AORTA=DROP ID DATE=DROP TIME AMT EVID MDV TAD DV
$DATA datafile.CSV IGNORE=C
$SUBROUTINES
ADVAN3 TRANS4 ;; data 2-comp (iv)
$PK
LTVCL = LOG(THETA(3))
MU_1 = LTVCL ;; MU_1 referencing
CL = EXP(MU_1 + ETA(1))
LTVV1 = LOG(THETA(4))
MU_2 = LTVV1
V1 = EXP(MU_2 + ETA(2))
Q = THETA(5)
V2 = THETA(6)
S1 = V1
$THETA ;; set realistic initial estimates
(0, 0.5) ;1 prop
(0, 0.1) ;2 add
(0, 30) ;3 CL
(0, 200) ;4 V1
(0, 30) ;5 Q
(0, 200) ;6 V2
$OMEGA BLOCK(2)
0.09 ; IIV-CL
0.01 0.09 ; IIV-V
$SIGMA
1 FIX ;residual variability
$ERROR ;; Based on linear data and proportional and additive error
IPRED = F
IRES = DV-IPRED
W = IPRED*THETA(1)+THETA(2)
IF (W.EQ.0) W = 1
IWRES = IRES/W
Y= IPRED+W*ERR(1)
$EST METHOD=1 MAXEVAL=99999 SIG=3 PRINT=5 NOABORT POSTHOC INTERACTION ;; Estimation method FOCE+interaction
$COV PRINT=E UNCONDITIONAL
$TABLE ID TAD IPRED IWRES CWRES EVID MDV TIME NOPRINT ONEHEADER FILE=SDTAB001
$TABLE ID CL V1 Q V2 ETA1 ETA2 NOPRINT ONEHEADER FILE=PATAB001
$TABLE ID NOPRINT ONEHEADER FILE=COTAB001
$TABLE ID NOPRINT ONEHEADER FILE=CATAB001
;; 1. Based on: 001
;; 2. Description: medicament
;; x1. Author: www.pkpd-info.com
$PROBLEM PK model
$INPUT ;; Change to dataset
CENSOR AORTA=DROP ID DATE=DROP TIME AMT EVID MDV TAD DV
$DATA datafile.CSV IGNORE=C
$SUBROUTINES
ADVAN2 TRANS2 ;; data 1-comp with first order absorption
$PK
TVKA = THETA(3)
KA = TVKA
TVCL = THETA(4)
CL = TVCL*EXP(ETA(1))
MU_1 = LOG(TVCL)
TVV = THETA(5)
V = TVV * EXP(ETA(2))
MU_2 = LOG(TVV)
S2 = V ;; Scaling compartment (check units of dose and observations)
$THETA ;; set realistic initial estimates
(0, 0.5) ;1 prop
(0, 0.1) ;2 add
(0, 4) ;3 Ka
(0, 30) ;4 CL
(0, 200) ;5 V
$OMEGA BLOCK(2)
0.09 ; IIV-CL
0.01 0.09 ; IIV-V
$SIGMA
1 FIX ;residual variability
$ERROR ;; Calculation based on linear (non log-transformed) data
IPRED = F
IRES = DV-IPRED
W = IPRED*THETA(1)+THETA(2)
IF (W.EQ.0) W = 1
IWRES = IRES/W
Y= IPRED+W*ERR(1)
$EST METHOD=1 MAXEVAL=99999 SIG=3 PRINT=5 NOABORT POSTHOC INTERACTION ;; Estimation methode FOCE+interaction
$COV PRINT=E UNCONDITIONAL
$TABLE ID TAD IPRED IWRES CWRES EVID MDV TIME NOPRINT ONEHEADER FILE=SDTAB001
$TABLE ID CL V KA ETA1 ETA2 NOPRINT ONEHEADER FILE=PATAB001
$TABLE ID NOPRINT ONEHEADER FILE=COTAB001
$TABLE ID NOPRINT ONEHEADER FILE=CATAB001
;; 1. Based on: 001
;; 2. Description: Drug
;; x1. Author: www.pkpd-info.com
$PROBLEM PK model
$INPUT
CENSOR AORTA=DROP ID DATE=DROP TIME AMT EVID MDV TAD DV
$DATA Dataset.CSV IGNORE=C
$SUBROUTINES
ADVAN4 TRANS4 ;; 2-comp with first order absorption
$PK
TVKA = THETA(3)
KA = TVKA*EXP(ETA(3))
MU_3 = LOG(TVKA)
TVCL = THETA(4)
CL = TVCL*EXP(ETA(1))
MU_1 = LOG(TVCL)
TVV2 = THETA(5)
V2 = TVV2 * EXP(ETA(2))
MU_2 = LOG(TVV2)
TVQ = THETA(6)
Q = TVQ
TVV3 = THETA(7)
V3 = TVV3
S2 = V2
$THETA
(0, 0.5) ;1 prop
(0 0.1) ;2 add
(0, 4) ;3 Ka
(0, 30) ;4 CL
(0, 50) ;5 Vc
(0, 20) ;6 Q
(0, 200) ;7 Vp
$OMEGA BLOCK(3)
0.09 ; IIV-CL
0.01 0.09 ; IIV-Vc
0.01 0.01 0.09 ; IIV-Ka
$SIGMA
1 FIX ;residual variability
$ERROR
IPRED = F
IRES = DV-IPRED
W = IPRED*THETA(1)+THETA(2)
IF (W.EQ.0) W = 1
IWRES = IRES/W
Y= IPRED+W*ERR(1)
$EST METHOD=1 MAXEVAL=99999 SIG=3 PRINT=5 NOABORT POSTHOC INTERACTION
$COV PRINT=E UNCONDITIONAL
$TABLE ID TAD IPRED IWRES CWRES EVID MDV TIME NOPRINT ONEHEADER FILE=SDTAB003
$TABLE ID CL V2 Q V3 KA ETA1 ETA2 ETA3 NOPRINT ONEHEADER FILE=PATAB003
$TABLE ID WT NOPRINT ONEHEADER FILE=COTAB003
$TABLE ID NOPRINT ONEHEADER FILE=CATAB003
;; 1. Based on: 001
;; 2. Description: drug
;; x1. Author: www.pkpd-info.com
$PROBLEM PK model
$INPUT
CENSOR AORTA=DROP ID DATE=DROP TIME AMT EVID MDV TAD DV
$DATA Dataset.CSV IGNORE=C
$SUBROUTINES
ADVAN12 TRANS4 ;; 3-comp with first-order absorption
$PK
TVKA = THETA(3)
MU_3 = LOG(TVKA)
KA = EXP(MU_3+ETA(3))
TVCL = THETA(4)
MU_1 = LOG(TVCL)
CL = EXP(MU_1+ETA(1))
TVV2 = THETA(5)
MU_2 = LOG(TVV2)
V2 = EXP(MU_2+ETA(2))
TVQ3 = THETA(6)
Q3 = TVQ3
TVV3 = THETA(7)
V3 = TVV3
TVQ4 = THETA(8)
Q4 = TVQ4
TVV4 = THETA(9)
V4 = TVV4
SC = V2
$THETA
(0, 0.5) ;1 prop
(0 FIX) ;2 add
(0, 4) ;3 Ka
(0, 30) ;4 CL
(0, 50) ;5 Vc
(0, 20) ;6 Q
(0, 100) ;7 Vp
(0, 10) ;8 Q4
(0, 150) ;9 V4
$OMEGA BLOCK(3)
0.09 ; IIV-CL
0.01 0.09 ; IIV-Vc
0.01 0.01 0.09 ; IIV-Ka
$SIGMA
1 FIX ;residual variability
$ERROR
IPRED = F
IRES = DV-IPRED
W = IPRED*THETA(1)+THETA(2)
IF (W.EQ.0) W = 1
IWRES = IRES/W
Y= IPRED+W*ERR(1)
$EST METHOD=1 MAXEVAL=99999 SIG=3 PRINT=5 NOABORT POSTHOC INTERACTION
$COV PRINT=E UNCONDITIONAL
$TABLE ID TAD IPRED IWRES CWRES EVID MDV TIME NOPRINT ONEHEADER FILE=SDTAB001
$TABLE ID CL V2 Q3 V3 Q4 KA ETA1 ETA2 ETA3 NOPRINT ONEHEADER FILE=PATAB001
$TABLE ID WT NOPRINT ONEHEADER FILE=COTAB001
$TABLE ID NOPRINT ONEHEADER FILE=CATAB001
;; 1. Based on: 001
;; 2. Description: drug
;; x1. Author: www.pkpd-info.com
$PROBLEM PK model
$INPUT
CENSOR AORTA=DROP ID DATE=DROP TIME AMT EVID MDV TAD DV CMT
$DATA Dataset.CSV IGNORE=C
$SUBROUTINES
ADVAN13 TOL=12
$MODEL
COMP (ABSORB,DEFDOSE)
COMP (CENTRAL)
$PK
TVKA = THETA(3)
MU_3 = LOG(TVKA)
KA = EXP(MU_3+ETA(3))
TVCL = THETA(4)
MU_1 = LOG(TVCL)
CL = EXP(MU_1+ETA(1))
TVV = THETA(5)
MU_2 = LOG(TVV)
V = EXP(MU_2+ETA(2))
S2=V
K20=CL/V
$THETA
(0, 0.5) ;1 prop
(0 FIX) ;2 add
(0, 4) ;3 Ka
(0, 30) ;4 CL
(0, 50) ;5 V
$OMEGA BLOCK(3)
0.09 ; IIV-CL
0.01 0.09 ; IIV-Vc
0.01 0.01 0.09 ; IIV-Ka
$DES
DADT(1) = -KA*A(1)
DADT(2) = A(1)*KA-A(2)*K20
$SIGMA
1 FIX ; residual variability
$ERROR
IPRED = F
IRES = DV-IPRED
W = IPRED*THETA(1)+THETA(2)
IF (W.EQ.0) W = 1
IWRES = IRES/W
Y= IPRED+W*ERR(1)
$EST METHOD=1 MAXEVAL=99999 SIG=3 PRINT=5 NOABORT POSTHOC INTERACTION
$COV PRINT=E UNCONDITIONAL
$TABLE ID TAD IPRED IWRES CWRES EVID MDV TIME NOPRINT ONEHEADER FILE=SDTAB001
$TABLE ID KA CL V ETA1 ETA2 ETA3 NOPRINT ONEHEADER FILE=PATAB001
$TABLE ID WT NOPRINT ONEHEADER FILE=COTAB001
$TABLE ID NOPRINT ONEHEADER FILE=CATAB001
;; 1. Based on: 001
;; 2. Description: drug
;; x1. Author: www.pkpd-info.com
$PROBLEM PK model
$INPUT
CENSOR AORTA=DROP ID DATE=DROP TIME AMT EVID MDV TAD DV CMT
$DATA Dataset.CSV IGNORE=C
$SUBROUTINES
ADVAN13 TOL=12
$MODEL
COMP (ABSORB,DEFDOSE)
COMP (CENTRAL)
COMP (PERIPH)
$PK
TVKA = THETA(3)
MU_3 = LOG(TVKA)
KA = EXP(MU_3+ETA(3))
TVCL = THETA(4)
MU_1 = LOG(TVCL)
CL = EXP(MU_1+ETA(1))
TVV2 = THETA(5)
MU_2 = LOG(TVV2)
V2 = EXP(MU_2+ETA(2))
TVQ = THETA(6)
Q = TVQ
TVV3 = THETA(7)
V3 = TVV3
S2=V2
K20 = CL/V2
K23 = Q/V2
K32 = Q/V3
$THETA
(0, 0.5) ;1 prop
(0 FIX) ;2 add
(0, 4) ;3 Ka
(0, 30) ;4 CL
(0, 250) ;5 Vc
(0, 6) ;6 Q
(0, 600) ;7 Vp
$OMEGA BLOCK(3)
0.09 ; IIV-CL
0.01 0.09 ; IIV-Vc
0.01 0.01 0.09 ; IIV-Ka
$DES
DADT(1)=-KA*A(1)
DADT(2)=A(1)*KA-A(2)*K20-A(2)*K23 + A(3)*K32
DADT(3)=A(2)*K23 - A(3)*K32
$SIGMA
1 FIX ; residual variability
$ERROR
IPRED = F
IRES = DV-IPRED
W = IPRED*THETA(1)+THETA(2)
IF (W.EQ.0) W = 1
IWRES = IRES/W
Y= IPRED+W*ERR(1)
$EST METHOD=1 MAXEVAL=99999 SIG=3 PRINT=5 NOABORT POSTHOC INTERACTION
$COV PRINT=E UNCONDITIONAL
$TABLE ID TAD IPRED IWRES CWRES EVID MDV TIME NOPRINT ONEHEADER FILE=SDTAB001
$TABLE ID KA CL V2 Q V3 ETA1 ETA2 ETA3 NOPRINT ONEHEADER FILE=PATAB001
$TABLE ID WT NOPRINT ONEHEADER FILE=COTAB001
$TABLE ID NOPRINT ONEHEADER FILE=CATAB001
;; 1. Based on: 001
;; 2. Description: drug
;; x1. Author: www.pkpd-info.com
$PROBLEM PK model
$INPUT
CENSOR AORTA=DROP ID DATE=DROP TIME AMT EVID MDV TAD DV CMT
$DATA Dataset.CSV IGNORE=C
$SUBROUTINES
ADVAN13 TOL=12
$MODEL
NCOMP = 3
COMP=(DEPOT,DEFDOSE)
COMP (CENTRAL)
COMP (PERIPH)
$PK
TVCL = THETA(3)
MU_1 = LOG(TVCL)
CL = EXP(MU_1+ETA(1))
TVV1 = THETA(4)
MU_2 = LOG(TVV1)
V1 = EXP(MU_2+ETA(2))
TVQ = THETA(5)
Q = TVQ
TVV2 = THETA(6)
V2 = TVV2
EMAX = THETA(7)
TMAX = THETA(8)
K20 = CL/V1
K23 = Q/V1
K32 = Q/V2
S2=V1
$THETA
(0, 0.5) ;1 prop
(0 FIX) ;2 add
(0, 30) ;3 CL
(0, 250) ;4 Vc
(0, 6) ;5 Q
(0, 600) ;6 Vp
(0.1, 10, 100);7 EMAX
(0.1, 5, 100) ;8 TMAX
$OMEGA BLOCK(2)
0.09 ; IIV-CL
0.01 0.09 ; IIV-Vc
$DES
DADT(1)=-EMAX*A(1)/(TMAX+A(1))
DADT(2)=EMAX*A(1)/(TMAX+A(1))-K20*A(2)-K23*A(2)+K32*A(3)
DADT(3)=K23*A(2)-K32*A(3)
$SIGMA
1 FIX ; residual variability
$ERROR
IPRED = F
IRES = DV-IPRED
W = IPRED*THETA(1)+THETA(2)
IF (W.EQ.0) W = 1
IWRES = IRES/W
Y= IPRED+W*ERR(1)
$EST METHOD=1 MAXEVAL=99999 SIG=3 PRINT=5 NOABORT POSTHOC INTERACTION
$COV PRINT=E UNCONDITIONAL
$TABLE ID TAD IPRED IWRES CWRES EVID MDV TIME NOPRINT ONEHEADER FILE=SDTAB001
$TABLE ID CL V1 Q V2 ETA1 ETA2 NOPRINT ONEHEADER FILE=PATAB001
$TABLE ID WT NOPRINT ONEHEADER FILE=COTAB001
$TABLE ID NOPRINT ONEHEADER FILE=CATAB001
$PK
SIZE = (WT/70)
TVCL2 =THETA(3)*SIZE**0.75
CL=TVCL2 * EXP(ETA(1))
TVV2= THETA(4)*SIZE**1
V2= TVV2
S2 = V2/1000
TVCL3 =THETA(5)*SIZE**0.75
Q=TVCL3
TVV3= THETA(6)*SIZE**1
V3= TVV3
$ABB
COMRES = 2
$PK
IF (NEWIND.LE.1) THEN
COM(1) = -1
COM(2) = -2
ENDIF
$DES
CONT = A(2)/S2 ;; Set to the correct compartment and scaling
IF(CONT.GT.COM(1)) THEN
COM(1) = CONT
COM(2) = T
ENDIF
$ERROR
CMAX = COM(1)
TMAX = COM(2)
$PK
; Set theta's to match the correct number
FLAG1 = 0
IF(CYP1.EQ.1) FLAG1=1 ; CYP1 can be any database defined categorical variate. Check levels
COV1 = (THETA(n)**FLAG1)
;or
IF(COV.EQ.0) COV1 = 1
IF(COV.EQ.1) COV1 = (1+THETA(n))
; Add covariate to PK parameter
TVCL = THETA(3)*COV1
CL = TVCL*EXP(ETA(1))
$PK
; Set theta's to match the correct number
; If you want to use multiple --> COVn+1
COV1 = (COV/median)**THETA(n) ; Power function
COV1 = (1+THETA(n)*(COV-median) ; Linear function
COV1 = EXP(THETA(n)*(COV-median)) ; Exponential function
IF(COV.LE.median) COV1 = (1+THETA(n)*(COV-median)) ; Hockey stick function
IF(COV.GT.median) COV1 = (1+THETA(n+1)*(COV-median)) ; Note that it has two lines and THETAs
; add covariate to your PK parameter
TVCL = THETA(3)*COV1
CL = TVCL*EXP(ETA(1))
$PK
IF(ALB.EQ.99999) THEN
ALBX = 620
ELSE
ALBX = ALB/0.066430
ENDIF
$THETA
(0, 0.5) ; 1 Error defined as a theta (check number)
$SIGMA
1 FIX ; Residual variability
$ERROR
IPRED=LOG(0.0001)
IF(F.GT.0)IPRED=LOG(F)
W=1
IF(F.GT.0)W = SQRT(THETA(1)**2)
IRES = DV-IPRED
IWRES = IRES/W
Y = IPRED+W*EPS(1)
$THETA
(0, 0.1) ; 1 proportional error as a theta (check number)
(0, 0.5) ; 2 additive error as a theta (check number)
$SIGMA
1 FIX ;residual variability
$ERROR
IPRED = F
IRES = DV-IPRED
W = IPRED*THETA(1)+THETA(2)
IF (W.EQ.0) W = 1
IWRES = IRES/W
Y= IPRED+W*ERR(1)
$SIGMA
0.2 ; prop
0.5 ; add
$ERROR
IPRED = F
W = SQRT(SIGMA(1)*F*F+SIGMA(2))
IRES = DV-IPRED
IWRES = IRES/W
Y = F+F*EPS(1)+EPS(2)
; Short statement
IF(AMT.GT.0)FLAG0=1
; Longer statement
IF(AMT.GT.0)THEN
FLAG0=1
ENDIF
; Multiple arguments require both to be true
; e.g. set flag0 to 1 if time after dose (TAD) > 0 and matrix equals 1
FLAG0=0
IF(TAD.GT.0.AND.MATRIX.EQ.1)FLAG0=1
; Multiple arguments require only one to be true
; e.g. use THETA(2) only for age <1 or >18, else use THETA(2)*THETA(3)
IF(AGE.LT.1.OR.AGE.GT.18)THEN
CL = THETA(2)
ELSE
CL - THETA(2)*THETA(3)
ENDIF
; Nested statement
; e.g. go through multiple options
FLAG0=0
IF(TAD.LT.1) THEN
FLAG0=1
ELSEIF(TAD.LT.5)THEN
FLAG0=2
ELSE
FLAG0=3
ENDIF
$PK ; Define the occassions and turn occasions on for example by using 'FLAGs'
FLAG0 = 0
FLAG1 = 0
FLAG2 = 0
FLAG3 = 0
FLAG4 = 0
FLAG5 = 0
IF(OCC.EQ.0) FLAG0 = 1
IF(OCC.EQ.1) FLAG1 = 1
IF(OCC.EQ.2) FLAG2 = 1
IF(OCC.EQ.3) FLAG3 = 1
IF(OCC.EQ.4) FLAG4 = 1
IF(OCC.EQ.5) FLAG5 = 1
IOV = FLAG0*ETA(2)+FLAG1*ETA(3)+FLAG2*ETA(4)+FLAG3*ETA(5)+FLAG4*ETA(6)+FLAG5*ETA(7)
CL = TVCL *EXP(ETA(1)+ IOV) ; E.g test the IOV on CL
$OMEGA 0.127 ; IIV for CL
$OMEGA BLOCK(1) 0.01 ; IOV for CL
$OMEGA BLOCK(1) SAME ;
$OMEGA BLOCK(1) SAME ;
$OMEGA BLOCK(1) SAME ;
$OMEGA BLOCK(1) SAME ;
$OMEGA BLOCK(1) SAME ;
$THETA
(0, 0.1) ; 1 proportional error as a theta (check number)
(0, 0.5) ; 2 additive error as a theta (check number)
$SIGMA
1 FIX ;residual variability
$ERROR
LLOQ = 0.999
IPRED=F
W=1
IF(F.NE.0) W = SQRT((THETA(1)*IPRED)**2+THETA(2)**2)
IRES = DV-IPRED
IWRES = IRES/W
IF(TYPE.EQ.1) THEN
F_FLAG = 0
Y = IPRED+W*EPS(1)
ENDIF
IF(TYPE.EQ.2) THEN
F_FLAG = 1
DEL=0.000001
DUM = (LLOQ - IPRED)/(W+DEL)
CUMD = PHI(DUM)
Y = CUMD
MDVRES = 1
ENDIF
$EST
METHOD=COND INTER NOABORT LAPLACIAN
$ABB COMRES = 4
$PK
IF (NEWIND.LE.1) THEN ; Resets for new individual
COM(1) = 0
COM(2) = 0
COM(3) = 0
COM(4) = 0
ENDIF
MIC = 200 ; Set critical value
$DES
DADT(1)= -ka*A(1)
DADT(2)= ka*A(1) - A(2)*k20
CP = A(2)/S2
DADT(3)= CP
IF(CP.GT.COM(1)) THEN
COM(1) = CP
COM(2) = T
ENDIF
IF(CP.GE.MIC)THEN
COM(3) = T - COM(4) ; Time above fixed conc
ENDIF
IF(CP.LT.MIC)THEN
COM(4) = T - COM(3) ; Time under fixed conc
ENDIF
$ERROR
AUC = A(3)
CMAX = COM(1)
TMAX = COM(2)
CONC = A(2)/S2
TA = COM(3) ; Cumulative time above MIC
TB = COM(4) ; Cumulative time below MIC
$ABB COMRES = 4
$PK
IF (NEWIND.LE.1) THEN ; Resets for new individual
COM(1) = 0
COM(2) = 0
COM(3) = 0
COM(4) = 0
ENDIF
MIC = 200 ; Set critical value
$DES
DADT(1)= -ka*A(1)
DADT(2)= ka*A(1) - A(2)*k20
CP = A(2)/S2
DADT(3)= CP
IF(CP.GT.COM(1)) THEN
COM(1) = CP
COM(2) = T
ENDIF
IF(CP.GE.MIC)THEN
COM(3) = A(3) - COM(4)
ENDIF
IF(CP.LT.MIC)THEN
COM(4) = A(3) - COM(3)
ENDIF
$ERROR
AUC = A(3)
CMAX = COM(1)
TMAX = COM(2)
CONC = A(2)/S2
AUCMIC = COM(3) ; This is the cum AUC above MIC
AUCBMIC = COM(4) ; This is the cum AUC below MIC
$SUBROUTINES
ADVAN5
$MODEL
COMP=(TRNS1,DEFDOS) ;TRANSIT COMP1
COMP=(TRNS2) ;TRANSIT COMP2
COMP=(TRNS3) ;TRANSIT COMP3
COMP=(TRNS4) ;TRANSIT COMP4
COMP=(TRNS5) ;TRANSIT COMP5
COMP=(TRNS6) ;TRANSIT COMP6
COMP=(TRNS7) ;TRANSIT COMP7
COMP=(CIP,DEFOBS) ;CENTR. COMP. CIP
$PK
SIZE = (WT/70)
MTT = THETA(2) * EXP(ETA(3))
TVCL = THETA(3)*(SIZE**0.75)
CL = TVCL * EXP(ETA(1))
TVV = THETA(4)*(SIZE)
V = TVV * EXP(ETA(2))
S8 = V ; make sure to scale the right compartment (observations)
KTR = 7 / MTT
K12 = KTR ; specify the path of the compartments: from 1 to 2, from 2 to 3 etc.
K23 = KTR ; when exceeding 9 compartments use 'T' to separate the numbers of the compartments K20T21 = KTR
K34 = KTR
K45 = KTR
K56 = KTR
K67 = KTR
K78 = KTR
K80 = CL / V
$SUBROUTINES
ADVAN6 TOL=6 ;; transit model
$MODEL
COMP=(ABS) ; transit comp
COMP=(CENT) ; cent comp
$PK
IF(AMT.GT.0.AND.CMT.EQ.1)PODO=AMT ; oral dose
IF(AMT.GT.0)TDOS = TIME ; if dose is given, use time
TAD = TIME - TDOS ; set TAD
;absorption
F1 = 0
F2 = 1
BIO = THETA(4)
MTT = THETA(6) * EXP(ETA(2))
N = THETA(7)
KTR = (N+1) / MTT
LNFAC = LOG(2.5066)+(N+0.5)*LOG(N)-N ;logarithmic transformation
$DES
IF(T.GE.TDOS) THEN
DADT(1) = EXP(LOG(BIO*PODO+.00001)+LOG(KTR)+N*LOG(KTR*(T-TDOS)+.00001)-KTR*(T-TDOS)-LNFAC)-KA*A(1)
ELSE
DADT(1) = EXP(LOG(BIO*PODO+.00001)+LOG(KTR)+N*LOG(KTR*T+.00001)-KTR*T-LNFAC)-KA*A(1) ; dose given
ENDIF
DADT(2) = KA*A(1) - K*A(2) ; central comp
ABSOR = A(1)
$PK
IF (ICALL.EQ.4) ; Only during simulations ICALL=4
CALL RANDOM(2,R) ; Random number between 0-1
UNI = R
CALL RANDOM(3,R) ; An additional one from different seed
UNI2 = R
ENDIF
; first seed is for eta and eps from var-covar set in $OMEGA and $SIGMA.
; The second is for the first random call the third seed for the second random call.
; UNIFORM creates a pseudo-uniform distribution (between 0-1). You can also choose NORMAL for pseudo-normal distr (mean 0 var 1)
$SIM (12345) (5678 UNIFORM) (64561 UNIFORM) ONLYSIM SUBPROBLEMS=1000
IF (ICALL.EQ.4.AND.NEWIND.NE.2) THEN
CALL RANDOM(2,R)
UNI = R
ENDIF
$SIM (12345) (5678 UNIFORM) (64561 UNIFORM) ONLYSIM SUBPROBLEMS=1000
$PK
IF (ICALL.EQ.4) THEN
CALL RANDOM(2,R)
BIN=INT(R*5)+1
ENDIF
$SIM (12345) (5678 UNIFORM) ONLYSIM SUBPROBLEMS=1000