Re: Storing simulations
From: Nick Holford
Subject: Re: [NMusers] Storing simulations
Date:Fri, 12 Jul 2002 08:39:24 +1200
I doubt if the Users Guides will be of much use.
In the simple case (see my previous email) you do not need to use SIMETA() or SIMEPS() when using
$SIMULATION. But typically one needs to be able to truncate the distribution of ETA or EPS values e.g. If you
use an additive residual error model then sooner or later you will generate a large enough negative EPS to
give you a negative simulated concentration. Same problem with additive models for parameter variability --
you will generate negative clearances. Even if you use an exponential model which cannot generate negative
values you may still wish to impose some reasonable constraints on the simulated DV values or simulated
parameters. This is when you use SIMETA() and SIMEPS().
e.g. this is a simple pharmacodynamic problem that first of all ensures that the DV is positive (the DOWHILE
loop) then makes the DV missing if the simulated value is less than 200.
$SIGMA 100 ; SD
$PRED
E0=E0*EXP(CVE0)
EMAX=EMAX*EXP(CVEMAX)
EC50=EC50*EXP(CVEC50)
EFFECT=E0 + EMAX*THEO/(THEO+EC50)
Y = EFFECT + SD
IF (ICALL.EQ.4) THEN ; simulation
DOWHILE (Y.LT.0)
CALL SIMEPS(EPS)
Y=EFFECT + SD
ENDDO
IF (Y.LT.200) THEN
MDV=1
ENDIF
ENDIF
If you want to control the simulated parameters then it might look like the following code which will throw
away parameters which are less likely than 1 in a 1000 to have arisen from the distribution. Please note that
you must sample all the ETAs at the same time if they are correlated via an OMEGA BLOCK. You will need to be
more creative in making the DOWHILE condition fit in the 80 char line limit if you have more than 3
parameters.
$THETA (0,150.,) ; E0
$THETA (0,200.,) ; EMAX
$THETA (.001,10,) ; EC50
$OMEGA 0.5 ; CVE0
$OMEGA 0.5 ; CVEMAX
$OMEGA 0.5 ; CVEC50
$PRED
E0=E0*EXP(CVE0)
EMAX=EMAX*EXP(CVEMAX)
EC50=EC50*EXP(CVEC50)
IF (ICALL.EQ.4) THEN ; simulation
TRUNC=3.27 ; Z 2tailed alpha=0.01 i.e. include 99.9%
TVE0=E0
E0=TVE0*EXP(CVE0)
LNMU=LOG(TVE0)
DLTA=TRUNC*0.717 ; MUST BE 3.27*SQRT(CVE0)!
L0=EXP(LNMU-DLTA)
H0=EXP(LNMU+DLTA)
TVEMAX=EMAX
EM=TVEMAX*EXP(CVEMAX)
LNMU=LOG(TVEMAX)
DLTA=TRUNC*0.717 ; MUST BE 3.27*SQRT(CVEMAX)!
LM=EXP(LNMU-DLTA)
HM=EXP(LNMU+DLTA)
TVEC50=EC50
C5=TVEC50*EXP(CVEC50)
LNMU=LOG(TVEC50)
DLTA=TRUNC*0.717 ; MUST BE 3.27*SQRT(CVEC50)!
L5=EXP(LNMU-DLTA)
H5=EXP(LNMU+DLTA)
DOWHILE(E0.LT.L0.OR.E0.GT.H0.OR.EM.LT.LM.OR.EM.GT.HM.OR.C5.LT.L5.OR.C5.GT.H5)
CALL SIMETA(ETA)
EMAX=TVEMAX*EXP(CVEMAX)
E0=TVE0*EXP(CVE0)
EC50=TVEC50*EXP(CVEC50)
ENDDO
ENDIF
EFFECT=E0 + EM*THEO/(THEO+C5)
EFFECT=E0 + EMAX*THEO/(THEO+EC50)
--
Nick Holford, Divn Pharmacology & Clinical Pharmacology
University of Auckland, 85 Park Rd, Private Bag 92019, Auckland, New Zealand
email:n.holford@auckland.ac.nz tel:+64(9)373-7599x6730 fax:373-7556
http://www.health.auckland.ac.nz/pharmacology/staff/nholford/