From: Devin Pastoor <*devin.pastoor*>

Date: Sun, 06 Nov 2016 22:34:33 +0000

Hi Paul,

You could probably just resent your FF at each dosing event (amt gt 0)

based on the

ADHERENCE = 0.4

IF (AMT.GT.0) THEN

CALL RANDOM(2, R) # second random number so can access uniform

distribution

IF (R.LT.ADHERENCE) THEN

FF = 0

ELSE

FF = 1

ENDIF

ENDIF

...

$SIM (11111 NORMAL) (234234 UNIFORM)

Note, I'm writing this code on my phone so might have missed something,

however the general principle is sound. It should get you pointed in the

right direction, and if you are still having trouble I can make you a

reproducible example if needed.

Devin

On Sun, Nov 6, 2016 at 5:13 PM Paul Hutson <paul.hutson

*> I have read the RANDOM page in guide VIII and LuAnn’s suggestions=
*

from

*> 2011, and still have questions on how to generate random numbers within a
*

*> range.
*

*>
*

*> I’d like to simulate the effect of erratic, random (not Markov ch=
*

ain)

*> lapses in adherence. I’m using the model of Kim for simvastatin =
*

(also used

*> by Wright, et al).
*

*>
*

*> The control stream and a bit of the input file are below. As you will
*

*> note, I resorted to using the RANDBETWEEN function in EXCEL to generate
*

*> random numbers (RNUM) between 1-10, and to use the test to turn off F1
*

*> for missed doses:
*

*>
*

*>
*

*>
*

*> FF=0
*

*>
*

*> IF(RNUM.LE.4) FF = 1 ;40% ADHERENCE if RNUM is random number between 1=
*

-10

*>
*

*> F1 = F1A * FF
*

*>
*

*>
*

*>
*

*> The problem with this approach is that when I use $SIMULATE and
*

*> nsubproblems >1, the sequence of the missed doses in the input file doesn=
*

’t

*> change with each subproblem as I would like.
*

*>
*

*> How can I use the CALL RANDOM (or other) command to generate a random
*

*> number series for each dosing event, and then a test to use this random
*

*> number to turn off F1 to simulate a missed dose?
*

*>
*

*> Many thanks,
*

*>
*

*> Paul
*

*>
*

*>
*

*>
*

*> $PROB SIMVASTATIN 40PCNT
*

*>
*

*> $INPUT NOTE ID TIME AMT DV LDL0 CMT EVID RNUM
*

*>
*

*> $DATA Simvastatin.CSV
*

*>
*

*> $SUBROUTINES ADVAN6 TOL=3
*

*>
*

*> $MODEL NCOMP=4 NPAR=9
*

*>
*

*> COMP=(GUT DEFDOSE)
*

*>
*

*> COMP=(CENTRAL)
*

*>
*

*> COMP=(ACID)
*

*>
*

*> COMP=(EFFECT, DEFOBS)
*

*>
*

*>
*

*>
*

*> $PK
*

*>
*

*> CALLFL=-2
*

*>
*

*> KA = THETA(1)
*

*>
*

*> K20 = THETA(2)
*

*>
*

*> K23 = THETA(3)
*

*>
*

*> K30 = THETA(4)
*

*>
*

*> Kin = THETA(5)*EXP(ETA(1))
*

*>
*

*> Imax = THETA(6)
*

*>
*

*> IC50 = THETA(7)
*

*>
*

*> F1A = THETA(8)
*

*>
*

*> ALAG1 = THETA(9)
*

*>
*

*> FF=0
*

*>
*

*> IF(RNUM.LE.4) FF = 1 ;40% ADHERENCE if RNUM is random number between 1=
*

-10

*>
*

*> F1 = F1A * FF
*

*>
*

*>
*

*>
*

*> $DES
*

*>
*

*> DADT(1) = - KA * A(1)
*

*>
*

*> DADT(2) = KA * A(1) - A(2) * (K20 + K23)
*

*>
*

*> DADT(3) = K23 * A(1) - K30 * A(3)
*

*>
*

*> DADT(4) = Kin * (1 - (Imax * A(3))/(IC50 + A(3))) -
*

*> (Kin/LDL0) * A(4)
*

*>
*

*>
*

*>
*

*> A1 = A(1)
*

*>
*

*> A2 = A(2)
*

*>
*

*> A3 = A(3)
*

*>
*

*> A4 = A(4)
*

*>
*

*> PCNT = 100*(A4-LDL0)/LDL0 ; Percent change in LDL from baselin=
*

e

*>
*

*>
*

*>
*

*> $THETA
*

*>
*

*> (2.76) ; KA
*

*>
*

*> (0.136) ; K20
*

*>
*

*> (0.058) ; K23
*

*>
*

*> (0.322) ; K30
*

*>
*

*> (1.14) ; Kin
*

*>
*

*> (0.489) ; Imax
*

*>
*

*> (0.0868) ; IC50
*

*>
*

*> 1 FIX; F1
*

*>
*

*> 0.212; ALAG1
*

*>
*

*>
*

*>
*

*> $OMEGA 0.2 ; iiv_Kin
*

*>
*

*>
*

*>
*

*> $ERROR
*

*>
*

*> IPRED = F
*

*>
*

*> IRES = IPRED-DV
*

*>
*

*> Y=IPRED * EPS(1)
*

*>
*

*> $SIGMA 1 FIX ;VARIATION DUE TO RANDOM ERROR
*

*>
*

*>
*

*>
*

*> $SIM (123456) ONLYSIMULATION
*

*>
*

*> $TABLE ID TIME AMT DV LDL0 A1 A2 A3 A4 PCNT RNUM EVID NOPRINT ONEHEADER
*

*> FILE=output.fit
*

*>
*

*>
*

*>
*

*> #NOTE ID TIME AMT DV LDL0 CMT
*

*> EVID RANDNUM
*

*>
*

*> . 1 0 92 .
*

*> 92 4 1 10
*

*>
*

*> . 1 0 100 .
*

*> 92 1 1 1
*

*>
*

*> . 1 24 . 0
*

*> 92 3 0 5
*

*>
*

*> . 1 24 100 .
*

*> 92 1 1 10
*

*>
*

*> . 1 48 . 0
*

*> 92 3 0 8
*

*>
*

*>
*

*>
*

*> (the 92 in the first line sets the baseline LDL concentration, the other
*

*> inputs are the daily simvastatin dose)
*

*>
*

*>
*

*>
*

*>
*

*>
*

*> Paul Hutson, PharmD, BCOP
*

*>
*

*> Professor
*

*>
*

*> UWisc School of Pharmacy
*

*>
*

*> T: 608.263.2496 <(608)%20263-2496>
*

*>
*

*> F: 608.265.5421 <(608)%20265-5421>
*

*>
*

*>
*

*>
*

Received on Sun Nov 06 2016 - 17:34:33 EST

Date: Sun, 06 Nov 2016 22:34:33 +0000

Hi Paul,

You could probably just resent your FF at each dosing event (amt gt 0)

based on the

ADHERENCE = 0.4

IF (AMT.GT.0) THEN

CALL RANDOM(2, R) # second random number so can access uniform

distribution

IF (R.LT.ADHERENCE) THEN

FF = 0

ELSE

FF = 1

ENDIF

ENDIF

...

$SIM (11111 NORMAL) (234234 UNIFORM)

Note, I'm writing this code on my phone so might have missed something,

however the general principle is sound. It should get you pointed in the

right direction, and if you are still having trouble I can make you a

reproducible example if needed.

Devin

On Sun, Nov 6, 2016 at 5:13 PM Paul Hutson <paul.hutson

from

ain)

(also used

-10

’t

-10

e

Received on Sun Nov 06 2016 - 17:34:33 EST