# Re: inexplicit equations in PRED

From: Ekaterina Gibiansky <EGibiansky>
Date: Sun, 27 Sep 2009 01:09:02 -0400

Sam,

You can get PRED without the third compartment. Just define the variable that
you need in \$ERROR:

\$DES
K1 = A(1)/V1-A(2)-KD
C = 0.5*(K1+ SQRT(K1*K1+4*KD*A(1)/V1))
DADT(1)= -K10*C*V1 - KINT*C*V1*A(2)/(KD+C)
DADT(2)= KSYN - KDEG*A(2) -(KINT - KDEG)*C*A(2)/(KD+C)

\$ERROR (ONLY OBSERVATIONS)

K11 = A(1)/V1-A(2)-KD
C1 = 0.5*(K11+ SQRT(K11*K11+4*KD*A(1)/V1))

Then, use C1 instead of F everywhere where you used F, and output C1 in the
\$TABLE.

Regards,
Katya

-------------------------
Ekaterina Gibiansky, Ph.D.
CEO&CSO, QuantPharm LLC
Web: www.quantpharm.com
Email: EGibiansky at quantpharm.com
Tel: (301)-717-7032

Sam Liao wrote:
> Dear Katya:
> It works, thanks for your advice. The reason I need the equilibrium
> compartment is to get PRED estimated.
> Best regards,
> Sam
>> Sam,
>> You do not need an equilibrium compartment, you can solve the equation
>> explicitly:
>>
>> \$DES
>> K1 = A(1)/V1-A(2)-KD
>> C = 0.5*(K1+ SQRT(K1*K1+4*KD*A(1)/V1))
>> DADT(1)= -K10*C*V1 - KINT*C*V1*A(2)/(KD+C)
>> DADT(2)= KSYN - KDEG*A(2) -(KINT - KDEG)*C*A(2)/(KD+C)
>>
>>
>> If you would like to use the equilibrium compartment just for the sake
>> of test, E(3) should denote the equation that needs to be solved as
>> E(3)=0. Thus, something like this:
>>
>> \$AESINITIAL
>> INIT=1
>> A(3)=0.001
>> \$AES
>> K1 = A(1)/V1-A(2)-KD
>> E(3) = A(3)-0.5*(K1+ SQRT(K1*K1+4*KD*A(1)/V1))
>> \$DES
>> DADT(1)= -K10*A(3)*V1 - KINT*A(3)*V1*A(2)/(KD+A(3))
>> DADT(2)= KSYN - KDEG*A(2) -(KINT - KDEG)*A(3)*A(2)/(KD+A(3))
>>
>> Regards,
>> Katya
>>
>> -------------------------
>> Ekaterina Gibiansky, Ph.D.
>> CEO&CSO, QuantPharm LLC
>> Web: www.quantpharm.com
>> Email: EGibiansky at quantpharm.com
>> Tel: (301)-717-7032
>>
>> Sam wrote:
>>> Dear nmusers:
>>> I would like to continued this thread started by Robert. I tried the
>>> \$AES method suggested by Katya in my PK model where the first two
>>> compartments are defined in \$DES while the third compartment is
>>> defined as an equilibrium algebraic equation in \$AES. I got error
>>> msg shown below. Could anyone tell what is missing in my code?
>>>
>>> "LUDATN IS UNABLE TO INVERT JACOBIAN (DA) FOR AES
>>> VARIABLES
>>>
>>> ERROR OCURRED WHILE ATTEMPTING TO OBTAIN INITIAL VALUES FOR DY/DT"
>>> Sam Liao
>>> ===== sim02.lst =====================================================
>>> \$PROB A TMDD MODEL
>>> \$INPUT C ID TIME DV AMT RATE DOSE EVID CMT SS
>>> \$DATA sim01.csv IGNORE=C
>>> \$SUBROUTINES ADVAN9 TOL=3
>>> \$MODEL
>>> COMP=(CENTRAL)
>>> COMP=(RTOT)
>>> COMP=(A3 EQUILIBRIUM)
>>> \$PK
>>> CL = THETA(1)* EXP(ETA(1))
>>> V1 = THETA(2)* EXP(ETA(2))
>>>
>>> K10= CL/V1
>>>
>>> KSYN= THETA(3)* EXP(ETA(3))
>>> KDEG= THETA(4)* EXP(ETA(4))
>>> KINT= THETA(5)* EXP(ETA(5))
>>> KD = THETA(6)* EXP(ETA(6))
>>>
>>> BL= KSYN/KDEG
>>> A_0(2)=BL ;BOUNDARY CONDITION FOR EQUATION 3
>>> \$AESINITIAL
>>> INIT=1
>>> A(3)=0.001
>>> \$AES
>>> K1 = A(1)/V1-A(2)-KD
>>> E(3) = 0.5*(K1+ SQRT(K1*K1+4*KD*A(1)/V1))
>>> \$DES
>>> DADT(1)= -K10*A(3)*V1 - KINT*A(3)*V1*A(2)/(KD+A(3))
>>> DADT(2)= KSYN - KDEG*A(2) -(KINT - KDEG)*A(3)*A(2)/(KD+A(3))
>>>
>>> .............
>>>> Robert,
>>>>
>>>> You can do it using ADVAN9 with NEQUILIBRIUM option in \$MODEL, and
>>>> \$AESINITIAL and \$AES blocks. E.g. (where A(13) is what is F in your
>>>> example) :
>>>>
>>>> \$SUBROUTINES ADVAN9 TOL=4
>>>> \$MODEL NEQUILIBRIUM=1
>>>> COMP(COMP1)
>>>> ....
>>>> COMP(COMP13)
>>>>
>>>> \$PK
>>>> ...
>>>>
>>>> \$AESINITIAL
>>>> INIT = 0; 0=APPROXIMATE, 1=EXACT
>>>> A(13)=0.001
>>>> \$AES
>>>> E(13)=A(9)-A(13)-A(13)*A(10)/(KSS+A(13))-A(13)*A(12)/(KSS2+A(13))
>>>>
>>>> \$DES
>>>> ...
>>>>
>>>> \$ERROR
>>>> Y = A(13)+EPS(1)
>>>>
>>>> Regards,
>>>> Katya
>>>>
>>>> --------------------------
>>>> Ekaterina Gibiansky, Ph.D.
>>>> CEO&CSO, QuantPharm LLC
>>>> Web: www.quantpharm.com
>>>> Email: EGibiansky
>>>> Tel: (301)-717-7032
>>>>
>>>>
>>>> Robert Kalicki wrote:
>>>>> Dear NMusers,
>>>>>
>>>>> Most of the models are pre-defined (ADVANx), expressed as a system
>>>>> of differential equations or provided in the form of an explicit
>>>>> mathematical equation (PRED).
>>>>>
>>>>> Is it possible to deal with nonlinear inexplicit equations like y =
>>>>> f(x,y) where both differential equations and explicit solution
>>>>> equation are not known or not obvious.
>>>>>
>>>>>
>>>>>
>>>>> Concretely, using PRED, one would find F on the both sides:
>>>>>
>>>>> F = f(X) + g(F)
>>>>>
>>>>> Y = F+EPS(1)
>>>>>
>>>>>
>>>>>
>>>>> Many thanks in advance
>>>>>
>>>>>
>>>>>
>>>>> Best regards,
>>>>>
>>>>> Robert
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ___________________________________________
>>>>> Robert M. Kalicki, MD
>>>>>
>>>>> Postdoctoral Fellow
>>>>>
>>>>> Department of Nephrology and Hypertension
>>>>>
>>>>> Inselspital
>>>>>
>>>>> University of Bern
>>>>>
>>>>> Switzerland
>>>>>
>>>>>
>>>>>
>>
>>
>>
>
>
Received on Sun Sep 27 2009 - 01:09:02 EDT

The NONMEM Users Network is maintained by ICON plc. Requests to subscribe to the network should be sent to: nmusers-request@iconplc.com.

Once subscribed, you may contribute to the discussion by emailing: nmusers@globomaxnm.com.