From: "Koup, Jeffrey" <>

Subject: Enterohepatic Recirculation Model

Date: Tue, 6 Oct 1998 16:50:32 -0400

About one year ago, Jenny Zheng from the FDA requested help regarding a model for enterohepatic recirculation in NONMEM. It appears that she did not receive any responses. I would like to repeat this request. Has anybody put together code for estimation of the parameters for enterohepatic recirculation for NONMEM, and would they be willing to share this code with the users group?

Jeff Koup

Parke-Davis Pharmaceutical Research


From: alison@c255.ucsf.EDU (ABoeckmann)

Subject: Re: Enterohepatic Recirculation Model

Date: Fri, 9 Oct 1998 14:00:07 -0700 (PDT)

Rik de Greef writes ...

> Recently, I have made an attempt to model the PK of a compound which showed a

> clear enterohepatic recirculation pattern. You'll find the control stream I

> used below; I included it solely to stimulate some discussion on this subject -

> the code is definitely not THE answer to the problem.... etc.

I'll copy his complete email below, after my remarks.

In recent NONMEM Intermediate Level workshops, Stuart Beal has talked about a "change-point" model. This is a pont in time where a state vector or its derivative is discontinuous. A differential equation solver may not integrate properly over a discontinuity. The $DES block should not make discontinous changes in the DADT's based on the value of T. Instead, the discontinuities should ONLY happen at event times and/or at nonevent (i.e., lagged) dose times. Also, the only way that an eta derivative associated with time T (which would arise if there were an eta in the model for TENT) can be computed correctly is if the value of TENT corresponds to a change-point.

We would like to find a nice way that change-points can be modelled in PREDPP. Maybe this will be part of NONMEM someday. Till then, Stuart says:

An absorption lag time with a dose is an example of a change-point. With this change-point, PREDPP knows to use the solver to integrate up to the lag time, to "reset the solver" at the lag time, and then to continue using the solver to integrate beyond the lag time. We can fool PREDPP into thinking that a change-point is an absorption lag time by placing a unit dose into a dummy compartment at time 0 and setting an absorption lag equal for this compartment to the change-point.

Based on these ideas, here's how I would modify Rik's code. The change also provides for the termination of EHC. If you want to let EHC continue indefinitely, delete compartment 6 and its dose, and the code involving ALAG6.

1) Add 2 more compartments to $MODEL:






COMP=(ENT) ; 'bile compartment'


2) Add to the data "dummy" doses to "dummy" compartments 5 and 6.


0 1 5

0 1 6

2) Tell PREDPP to call PK ("evaluate $PK") when the lag times occur and give a model for the lag times:



; with NONMEM V, the above can be coded



ALAG5=THETA(7) ; time gall bladder emptying starts

ALAG6=ALAG5+THETA(8) ; time gall bladder emptying stops

Make sure that the lower bound for theta(8) is 0.

3) Define EHYN in $PK, not $DES:




EHYN=0 ; indicator variable; is gall bladder emptying?



IF (OLDTIM.EQ.ALAG5) EHYN=1 ; if time later than start of gall bladder emptying

IF (OLDTIM.EQ.ALAG6) EHYN=0 ; if time later than stop of gall bladder emptying


In Guide VIII, PROCM2, we say:

DOSTIM>0: this call to PK occurs at a non-event dose time DOSTIM, i.e., at the time of an additional or lagged dose. OLDTIM saves the value of DOSTIM from the previous call to PK EHYN is set to 1 when PREDPP is advancing beyond the first lagged dummy dose. EHYN stays 1 until PREDPP is advancing beyond the second lagged dummy dose.

4) In $DES, eliminate the IF statements. Add d.e.'s for the dummy compartments. Because the statements are getting too long, I define the intermediate variable EHC to save space.









-- Alison Boeckmann


Here is Rik's complete email.


Recently, I have made an attempt to model the PK of a compound which showed a clear enterohepatic recirculation pattern. You'll find the control stream I used below; I included it solely to stimulate some discussion on this subject - the code is definitely not THE answer to the problem.

The code is based on several assumptions/restrictions:

a. the fraction of drug that is excreted into the bile (CMT 4 in the model) is kept there until the gall bladder is emptied (at t=TENT)

b. the drug that returns into the intestine in this way is absorbed at the same rate as it was directly after administration (however, in the model it does not return in CMT 1 (the depot) - after t=TENT it is allowed to return to the central compartment (CMT 2) with k=ka)

c. elimination into the bile occurs at the same speed as the 'other elimination' (e.g. the metabolism)

d. the model does not allow for a second (third, fourth...) recirculation (if someone has any idea how to deal with that...?)

So, the parameters concerning the enterohepatic circulation which are estimated are: (1) fraction of drug following this route and (2) time of gal bladder emptying. Thus, the model looks like (etas have been chosen quite arbitrarily):

$PROB enterohepatic recirculation


$DATA ..... IGNORE='#'







COMP=(ENT) ; 'bile compartment'


K12=THETA(1) ; absorption constant

K20=THETA(2)*EXP(ETA(1)); elimination constant

VC=THETA(3)*EXP(ETA(2)) ; central volume

VP=THETA(4) ; peripheral volume

Q=THETA(5) ; intercompartmental Cl

K23=Q/VC ; rate constant to Vp

K32=Q/VP ; rate constant from Vp

FENT=THETA(6) ; fraction excreted (unchanged) in bile

TENT=THETA(7) ; time of gall bladder emptying

K24=K20 ; elimination rate into bile equals other elimination


K42=K12 ; absorption rate from 'bile compartment' equals

absorption rate from depot



EHYN=0 ; indicator variable; has gall bladder emptying already

taken place? No

IF (T.GT.TENT) EHYN=1 ; if time later than time of gall bladder emptying: Yes


DADT(2)=K12*A(1) - (1-FENT)*K20*A(2) - K23*A(2) + K32*A(3) - FENT*K24*A(2) +





Y =F+F*ERR(1)+ERR(2)


$THETA ....

$OMEGA ....

$SIGMA ....

$EST ....

$TABLE ....

I am curious whether someone has already developed some more advanced code for problems like these.

Rik de Greef

Pharmacokinetics Section

Department of Drug Metabolism and Kinetics

N.V. Organon


From: alison@c255.ucsf.EDU (ABoeckmann)

Subject: EHC model

Date: Tue, 13 Oct 1998 09:50:57 -0700 (PDT)

Last week I sent some suggestions for modelling EHC.

The code in $PK looked like this:








This works with population data.

With population data, NEWIND is 2 except for the first event record of each individual record.

However, it does not work with single-subject data.

It might be imagined that NEWIND is 2 with all event records of a single-subject data set except with the first event record. However, remembering that (with either population or single-subject data) NEWIND is 1 with the first event record of each individual record, and that an individual record is any contiguous set of data records with a common ID value, NEWIND can be 1 with a number of event records of the data set, and not just with the first event record.

OLDTIM will be set to 0 with every record after the first observation, and EHYN will never be set to 1.

The test with single-subject data should be:


which tests for the first event record of the data set.

Now the EHYN flag is set properly.

It is unfortunate that the code I wrote, using NEWIND, must be different for population vs. single-subject data.

It would be better to test some item in the data record. With some data sets, one can use TIME. The test is:



This test works well for both population and single-subject data if each subject's data consist of dose events at TIME=0 followed only by observation events. With other data sets, more complicated code is needed.