NONMEM Users Network Archive

Hosted by Cognigen

[NMusers] $ERROR block for feedback mechanism

From: 이현아 <>
Date: Thu, 1 Aug 2019 15:24:17 +0900

Hello, NMusers.

I have a question about a feedback mechanism in a PK/PD model.

Drug X is an acid reducing agent, and after multiple oral administration, the systemic exposure to drug X decreased. Our previous result suggested that the main cause of the reduced exposure was the reduced solubility of drug X caused by elevated intragastric pH after treatment with drug X. Base on this result, we developed a PK/PD model. The PK/PD profile was best described using a 2 compartment PK model with lagged first-order absorption model and sigmoid Emax model linked with an effect compartment. To address changes in intragastric pH over time affecting the relative bioavailability (F1), we introduced a feedback path such that increased intragastric pH decreases the F1 of drug X.  

I have tried to add feedback path in our NONMEM code, but I need help writing code.

Here is the control stream that I have used:









CL = THETA(1)*EXP(ETA(1))*(WT/70)**THETA(22)

V2 = THETA(2)*EXP(ETA(2))

Q = THETA(3)*EXP(ETA(3))

V3 = THETA(4)*EXP(ETA(4))





EC50 = THETA(18)*EXP(ETA(9))

KE0 = THETA(19)*EXP(ETA(10))

EDMAX = THETA(20)*EXP(ETA(11)) ; maximal reduction of F1

ED50 = THETA(21)*EXP(ETA(12)) ; intragastric pH producing 50% of maximal reduction of F1



DCP = A(2)/V2

DCE = A(4)

DADT(1) = -KA*A(1)

DADT(2) = -K23*A(2)-K20*A(2)+K32*A(3)+KA*A(1)

DADT(3) = -K32*A(3)+K23*A(2)




CP = A(2)/V2

CE = A(4)


Q1 = 1 ; dummy indicator for compartment 2


IF (CMT .EQ. 4) Q1=0

PH = E0*(1+(EMAX*CE)/(EC50+CE)) ; Emax model for pH driven by effect compartment concentration

PHPK = CP*(1-(EDMAX*(PH-7))/(ED50+(PH-7)))  ; Inhibitory effect model for the feedback by pH for plasma concentration of YH4808, 7 is a maximum intagastric pH by drug X treatment.


F1=THETA(PH) <- I’d like to estimate F1 by changing intragastric pH in my $ERROR block.



My question is that how can I make NONMEM code to address changes in intragastric pH affecting the F1 (feedback mechanism to describe a phenomenon that PD (intragastric pH) affects PK (F1)) in my $ERROR block?


Thanks in advance.

Hyun A Lee

Department of Clinical Pharmacology and Therapeutics,

Seoul National University College of Medicine and Hospital

101 Daehak-ro, Jongno-gu, 

Seoul 03080, Korea

Tel: +82-31-888-9574, Fax: +82-31-888-9575

Mobile: +82-10-8629-5014

E-mail: ;

Received on Thu Aug 01 2019 - 02:24:17 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: