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

From: Leonid Gibiansky Date: April 04, 2013 technical Source: mail-archive.com
Hi Yaming, I have not done it so I do not have the code, but here is the possible way 1. There is an ADVAN9 routine that allows for equilibrium compartments. Equilibrium compartment is essentially a solution of something like S(t)=u1, or it possibly can be tricked to solving this equation. Another possibility is to add the external fortran code to solve algebraic equation. 2. For dose, I cannot think of the way to have dose event at the dynamically determined time. But this can be implemented by something like a delta function (short impulse with high rate) to the right-hand side of the differential equation. It will not be bolus but it can be short infusion with high rate. The time of infusion start can be controlled on the fly, in $DES block CODE = 0 IF(T > T1 and T < T1+duration) CODE = 1 DADT()= P*CODE where duration is a parameter (1 hour, 1 min, whatever is short in your scale but preferably large relative to the integration steps) and P=DOSE/duration. Not straightforward but doable Leonid -------------------------------------- Leonid Gibiansky, Ph.D. President, QuantPharm LLC web: www.quantpharm.com e-mail: LGibiansky at quantpharm.com tel: (301) 767 5566
Quoted reply history
On 4/4/2013 11:16 AM, Yaming Hang wrote: > Dear Leonid, Nick and Bill, > > Thank you very much for responding to my question! Sorry my original question > 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). > Definition of EC50 is as usual. > > The cumulative hazard H(t) is integral of h(x) from time 0 to t, and the > survival function S(t)=exp(-H(t)). > > Let's make it simple, assume the concentration follows a one-compartment model > and it's a bolus IV dose, CL and V are known. Also assume h0(t) is a constant > 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 (repeated) 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 number 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 concentration coming from > the first dose has not reached zero by time t1, the survival function starting > from t1 could be different than the survival function 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 continue 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 accomplished in > NONMEM. > > Kind Regards, > Yaming > > -----Original Message----- > From: [email protected] [mailto:[email protected]] On > 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 Repeated > Time to Event Data > > Yaming > Could you, please, add some more details about the procedure to determine the time > of the event/dose. Is it some numerical integral of hazard, and when it reaches > some value (integral from 0 to T0) then the dose is given at T0 ? Or you can > determine it earlier, say by time T1 < > T0 (where T1 is known in advance)? > Leonid > > -------------------------------------- > Leonid Gibiansky, Ph.D. > President, QuantPharm LLC > web: www.quantpharm.com > e-mail: LGibiansky at quantpharm.com > 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