NONMEM Users Network Archive

Hosted by Cognigen

RE: seeking help on NONMEM code for simulation of Repeated Time to Event Data

From: Yaming Hang <Yaming.Hang>
Date: Thu, 4 Apr 2013 15:16:21 +0000

Dear Leonid, Nick and Bill,

Thank you very much for responding to my question! Sorry my original questi=
on was not detailed enough, let me try it again:

I have a hazard function h(t) which is concentration dependent: h(t)=h0(t=
)*(1-CP(t)/(EC50+CP(t))), where CP(t) is the drug exposure at time t, h0(t)=
 is the baseline hazard function without drug (may be a constant). Definiti=
on of EC50 is as usual.

The cumulative hazard H(t) is integral of h(x) from time 0 to t, and the su=
rvival function S(t)=exp(-H(t)).

Let's make it simple, assume the concentration follows a one-compartment mo=
del and it's a bolus IV dose, CL and V are known. Also assume h0(t) is a co=
nstant lambda, along with EC50 are known. Every time a dose is introduced,=
 the amount is the same. Here is how I intend to simulate the event (repeat=
ed) history for one subject:

At time 0, a unit dose is introduced, CP(t) can be determined, therefore S(=
t) can be determined (maybe through the $DES, not necessarily a closed form=
). The time of first event will be simulated by first generating a random n=
umber u1 from Uniform[0,1], and then solve the equation S(t1)=u1. That's =
why I need to inverse the survival function. Right at time t1 following the=
 first event, I'll introduce another unit dose. Because most likely the con=
centration coming from the first dose has not reached zero by time t1, the =
survival function starting from t1 could be different than the survival fun=
ction starting from the first dose (time 0). I'll follow the same procedure=
 to simulate a t2, which is the time from first event to second event, and =
another unit dose will be introduced at time t1+t2. This process will conti=
nue until a certain cut-off time point has been met. That's why I said the =
dosing is dynamic.

Hope this time I've stated it clear enough. It's just one thought on how to=
 do the simulation, I'd like to get some advice on how this can be accompli=
shed in NONMEM.

Kind Regards,

-----Original Message-----
From: owner-nmusers
 Behalf Of Leonid Gibiansky
Sent: Wednesday, April 03, 2013 5:39 PM
To: Yaming Hang
Subject: Re: [NMusers] seeking help on NONMEM code for simulation of Repeat=
ed Time to Event Data

Could you, please, add some more details about the procedure to determine t=
he time of the event/dose. Is it some numerical integral of hazard, and whe=
n it reaches some value (integral from 0 to T0) then the dose is given at T=
0 ? Or you can determine it earlier, say by time T1 <
T0 (where T1 is known in advance)?

Leonid Gibiansky, Ph.D.
President, QuantPharm LLC
e-mail: LGibiansky at
tel: (301) 767 5566

On 4/3/2013 4:35 PM, Yaming Hang wrote:
> Dear NONMEM Users,
> I have some questions about how to accomplish the following tasks in
> NONMEM, would you kindly share your experience with me or provide some
> suggestions? I'm trying to make a simulation that involves dynamic
> dosing. Here is the algorithm of simulation: at time 0, a dose is
> given, then the time to the first event will be simulated based on a
> certain survival function which depends on the drug exposure. Next,
> conditioning on that simulated first event time, a second dose will be
> introduced, and again time to the second event will be simulated. This
> will be repeated until a certain cut off time point.
> My specific questions are:
> 1. since the dosing history will be depending on the simulated event
> time, I cannot construct the dosing history in NONMEM data set a
> prior, how can this be done?
> 2. The survival function is a function of the time-varying drug
> exposure, therefore I need to inverse an integral which does not have
> a closed form (i.e. only expressed in differential equation), how can
> I do that?
> Your help will be much appreciated!
> Yaming Hang

Received on Thu Apr 04 2013 - 11:16:21 EDT

The NONMEM Users Network is maintained by ICON plc. Requests to subscribe to the network should be sent to:

Once subscribed, you may contribute to the discussion by emailing: