Hi Robin,
I have used the DECLARE option in the $ABBREVIATED block to initialize DOSE
as a global variable.
Then I used MTIME()/MPAST() to flexibly deliver dose into a DEPOT
compartment from a patch, assuming different infusion durations after
detachment and reattachment of the patch.
See the code below.
Best
Eliford

```
$PROBLEM One compartment model with erratic absorption from a patch

$INPUT ID TIME DV AMT CMT EVID MDV

$DATA ../data/erratic_patch.csv IGNORE=@

$SUBROUTINE ADVAN6 TRANS1 TOL=6

$MODEL
COMP = (DEPOT)
COMP = (CENTRAL)
COMP = (ADMINDOSE)       ;; Accumulate total dose delivered to depot
compartment

$ABBR DECLARE DOSE(10)   ;; Declare DOSE as a global variable with 10
dimensions as place holder

$THETA
(0, 0.3)   ; KA
(0, 3)     ; CL
(0, 15)    ; Vc
(0, 3)     ; DT1         ;; Detach and re-attach time can be estimated
(0, 6)     ; DT2         ;;
(0, 15)    ; DD1
(0, 12)    ; DD2         ;; Variable durations of zero order delivery to
depot compartment can be estimated
(0, 4)     ; DD3
(0, 1)     ; ADD
(0, 0.1)   ; PROP

$OMEGA BLOCK(1) 0.1 ; EKA
$OMEGA BLOCK(1) 0.1 ; ECL
$OMEGA BLOCK(1) 0.1 ; EVC
$OMEGA BLOCK(1) 0.1 ; EDT1
$OMEGA BLOCK(1) 0.1 ; EDT2
$OMEGA BLOCK(1) 0.1 ; EDD1
$OMEGA BLOCK(1) 0.1 ; EDD2
$OMEGA BLOCK(1) 0.1 ; EDD3

$SIGMA 1 FIX

$PK
TVKA   = THETA(1) ; Absorption rate constant from depot
TVCL   = THETA(2) ; Clearance from central cmpt
TVVC   = THETA(3) ; Distribution volume of central cmpt
TVDT1  = THETA(4) ; Detach time 1
TVDT2  = THETA(5) ; Detach time 2
TVDUR1 = THETA(6) ; Delivery duration 1
TVDUR2 = THETA(7) ; Delivery duration 2
TVDUR3 = THETA(8) ; Delivery duration 2

KA = TVKA * EXP(ETA(1))     ;
CL = TVCL * EXP(ETA(2))     ;
VC = TVVC * EXP(ETA(3))     ;
DT1= TVDT1 * EXP(ETA(4))    ;
DT2= TVDT2 * EXP(ETA(5))    ;
DUR1= TVDUR1 * EXP(ETA(6))  ;
DUR2= TVDUR2 * EXP(ETA(7))  ;
DUR3= TVDUR3 * EXP(ETA(8))  ;
K  = CL/VC                  ;
F1 = 0                      ; Prevent NONMEM from adding dose into depot

ADMDOSE = A(3)              ; Total Dose delivered to depot compartment at
any time after dose


MTIME(1) = DT1              ; Model event time for detachment
MTIME(2) = DT2              ; MOdel event time for reattachment

IF(EVID.EQ.1) THEN
  DOSE(1) = AMT             ; Give value to the global dose variable
created with $ABBR DECLARE
ENDIF


$DES

DOSE1 = DOSE(1)             ; Make the dose global
RATE1 = DOSE1/DUR1          ; Initial rate of drug delivery into depot cmpt

IF(T.GE.DT1) THEN
 DOSE2 = DOSE(2)            ; Remaining dose in the patch just before
detachment
 RATE2 = DOSE2/DUR2         ; rate of drug delivery into depot cmpt after
detach 1
ENDIF

IF(T.GE.DT2) THEN
 DOSE3 = DOSE(3)            ; Remaining dose in the patch just before
re-attachment
 RATE3 = DOSE3/DUR3         ; rate of drug delivery into depot after
reattachment
ENDIF


RATE = RATE1 * (1 - MPAST(1))                ; FLEXIBLE RATE BASED ON MODEL
EVENT TIMES
RATE = RATE + RATE2 * (MPAST(1) - MPAST(2))  ;
RATE = RATE + RATE3 * MPAST(2)               ;

IF(ADMDOSE.GT.DOSE1) RATE= 0                 ; Switch off delivery to depot
when all dose has been consumed

ADMDOSE1 = RATE1*DT1                         ; Calculate remaining dose in
the patch
ADMDOSE2 = RATE2*(DT2-DT1)                   ;

DOSE(2) = DOSE1 - ADMDOSE1                   ;
DOSE(3) = DOSE1 - (ADMDOSE1+ADMDOSE2)        ;


DADT(1) = RATE - KA*A(1)                     ; Differential equations
DADT(2) = KA*A(1) - K*A(2)                   ;
DADT(3) = RATE                               ;

$ERROR
IPRED = F                                    ; CENTRAL is default
observation compartment
ADD   = THETA(9)                             ; Additive residual
PROP  = IPRED * THETA(10)                    ; Prop residual
W     = SQRT(ADD**2 + PROP**2)               ; Weighting factor
Y = IPRED + W*EPS(1)                         ;
IRES  = DV-IPRED
IWRES = IRES/W

DEPOTA = A(1)

NREPLICATE = NREP
IREPLICATE = IPRED

$SIMULATION (82536690) SUBPROBLEM=1 ONLYSIMULATION

$TABLE ID TIME DV IPRED EVID KA CL VC DT1 DT2 DUR1 DUR2 DUR3
       RATE1 RATE2 RATE3 RATE DOSE1 DOSE2 DOSE3 DEPOTA ADMDOSE NREPLICATE
IREPLICATE
       NOPRINT ONEHEADER APPEND FILE=MYTAB1

```

Simulation dataset
patchdata <- expand.grid(ID=1, TIME=seq(0, 48, 1), DV=".") %>%
mutate(AMT=ifelse(TIME==0, 10, NA), CMT= ifelse(TIME==0, 1, 2), EVID=
ifelse(TIME==0, 1, 2), MDV=1)


On Fri, Aug 6, 2021 at 4:29 PM Robin Michelet <robin.miche...@fu-berlin.de>
wrote:

> Hi Bill,
>
> Thank you for your quick answer. As far as I understand Nonmem's inner
> workings, bio availability is only applied at the onset of dosing and
> adding variability on it would not be able to capture a transient change
> in input. For example in the case of a patch, if it would detach partly
> during the dosing interval one would still need an input (i.e.
> infusion-style input in the depot) but it would just be lower than
> before. Changing F1 would in this case not do much right?
>
> Kind regards,
>
> Robin
>
> Dr. ir. Robin Michelet
> Senior scientist
>
> Freie Universitaet Berlin
> Institute of Pharmacy
> Dept. of Clinical Pharmacy & Biochemistry
> Kelchstr. 31
> 12169 Berlin
> Germany
> Phone:  + 49 30 838 50659
> Fax:      + 49 30 838 4 50656
> Email: robin.miche...@fu-berlin.de
> www.clinical-pharmacy.eu
> https://fair-flagellin.eu/
>
> On 06-08-21 10:15 PM, Bill Denney wrote:
> > Hi Robin,
> >
> > I don't think that I've seen an update.  That said, the need I had then
> was
> > for a very specific need for an unusual drug.  I've only seen this type
> of
> > issue once where it seemed to need time-dependent effects.  Generally,
> > effects similar-- but not identical-- to what I was experiencing at the
> time
> > are better-modeled with simpler systems.  For example, adsorption to
> > infusion sets can almost always be modeled as a decrease in
> bioavailability
> > and/or a lag time (it's not typically time-dependent behavior).
> >
> > I would assume that loss of part of a tablet or detachment of a patch
> could
> > be simply modeled as random variability (or a fixed effect) on
> > bioavailability.  Random pump malfunction would depend on how it
> > malfunctioned, but I would be wary of trying to model random effects as
> this
> > more complex time-dependent bioavailability unless you had data on the
> > malfunction method-- in which case I would suggest putting it into the
> > dataset as a different dosing record.
> >
> > Thanks,
> >
> > Bill
> >
> > -----Original Message-----
> > From: owner-nmus...@globomaxnm.com <owner-nmus...@globomaxnm.com> On
> Behalf
> > Of Robin Michelet
> > Sent: Friday, August 6, 2021 3:38 PM
> > To: nmusers@globomaxnm.com
> > Subject: [NMusers] Time-varying input/flexibility to change input rate on
> > the fly
> >
> > Dear all,
> >
> > I was wondering if any progress has been made on the topic raised
> originally
> > by Bill Denney in 2018:
> >
> > https://www.mail-archive.com/nmusers@globomaxnm.com/msg06990.html
> >
> > Are there any simpler ways in NM 7.5 to adapt input (e.g. infusion
> > rates) in $DES during the integration step without adapting the dataset
> > itself? I.e. to model the malfunctioning of an infusion pump (at random),
> > the loss of part of a tablet, or the detachment of a patch?
> >
> > Thank you! I could not answer to the original topic which is why I just
> > linked to it.
> >
> > --
> > Dr. ir. Robin Michelet
> > Senior scientist
> >
> > Freie Universitaet Berlin
> > Institute of Pharmacy
> > Dept. of Clinical Pharmacy & Biochemistry Kelchstr. 31
> > 12169 Berlin
> > Germany
> > Phone:  + 49 30 838 50659
> > Fax:      + 49 30 838 4 50656
> > Email: robin.miche...@fu-berlin.de
> > www.clinical-pharmacy.eu
> > https://fair-flagellin.eu/
>
>

-- 
Eliford Ngaimisi Kitabi
Pharmacometrician, FDA
mobile: +2405477565
Joy is my target

Reply via email to