```From:Yaning Wang
Subject:[NMusers] simulated negative concentration
Date:Thu, 13 Feb 2003 19:17:49 -0500

Dear NM users:
How can I prevent from simulating negative concentrations? My error model is
Y=F(1+EPS(1))+EPS(2). How can I make sure that NONMEM will only simulate
positive concentrations or, even more strictly, within an interval?  An
example will be highly appreciated.
Thanks

Yaning Wang
Department of Pharmaceutics
College of Pharmacy
University of Florida
_______________________________________________________

From:Nick Holford
Subject:Re: [NMusers] simulated negative concentration
Date: Fri, 14 Feb 2003 13:28:24 +1300

Here is an example showing how to truncate distributions for both residual error or parameter
variability:

\$PROB THEOPHYLLINE PHARMACODYNAMICS
\$DATA ..\..\theopd.dat IGNORE #
\$INPUT ID TIME THEO AGE WT GEND RACE DIAG DV
\$SIM (20000625 NORMAL NEW) SUBPROBLEMS=2

\$ESTIM PRINT=0

\$THETA (0,150.,)  ; E0
\$THETA (0,200.,)  ; EMAX
\$THETA (.001,10,) ; EC50

\$OMEGA 0.5  ; CVE0
\$OMEGA 0.5  ; CVEMAX
\$OMEGA 0.5  ; CVEC50

\$SIGMA 100 ; SD 1

\$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)
Y =  EFFECT + SD
IF (ICALL.EQ.4) THEN ; simulation
DOWHILE (Y.LT.0)
CALL SIMEPS(EPS)
Y=EFFECT + SD
ENDDO
ENDIF

\$TABLE ID TIME THEO AGE WT GEND RACE DIAG
E0 EM C5 Y

--
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-7599x86730 fax:373-7556

http://www.health.auckland.ac.nz/pharmacology/staff/nholford/

_______________________________________________________

From:"Kowalski, Ken"
Subject: RE: [NMusers] simulated negative concentration
Date:Fri, 14 Feb 2003 08:13:52 -0500

Yaning,

You must have a large SD for the additive component relative to F at low
concentrations and/or a large CV for the proportional component.  Note that
truncating the concentrations with this error model does result in bias
although it may be negligible (depending on the severity of the trucation
that is required to avoid negative concentrations).  You might consider
refitting your data using a log-transform-both-sides approach which would
restrict simulated concentrations to be positive.  To do this you need to
define the logarithm of the concentrations as your DV and use a statement
like Y=LOG(F)+EPS(1).  Of course you need to avoid situations where the
model can predict F=0.

Ken

```