Re: help on problem with baseline estimation
hello Pete,
I think you have to instruct NONMEM to remember the variable value when it's looping over the dataset. Could you try if it works if you change the 3rd line in $error to:
IF (TIME .EQ. 0 .AND. CMT .EQ. 3 .AND. EVID .EQ. 0) THEN
BASE2 = Y
ELSE
BASE2 = BASE2
ENDIF
best regards,
Ron
Quoted reply history
On 10/18/11 9:31 PM, Bonate, Peter wrote:
> I am really struggling with something. I am trying to do an adaptive dosing problem. I have a PKPD model with 2-compartment IV pharmacokinetic model (compartment 1 and 2) and an indirect response model for Compartment 3. What I need is a way to get the observed baseline 24 h after dosing and then make a dosing recommendation based on the observed value.
>
> I thought this would work
>
> $INPUT ID AGE WGT GEN CLO V1O QO V2O EVID MDV CMT TIME AMT RATE NSIM GRP DV TRT
>
> $SUB ADVAN8 TOL=5
>
> $MODEL COMP= (CENTRAL) COMP= (PER) COMP= (RESPONSE, DEFOBS)
>
> $PK ;PD parameters (IDR model, Elimination-Inhibition)
>
> CALLFL= -1
>
> IF (NEWIND .EQ. 1) DELTA=0
>
> CL= CLO
>
> V1= V1O
>
> Q= QO
>
> V2= V2O
>
> K= CL/V1
>
> K12= Q/V1
>
> K21= Q/V2
>
> PLA= -THETA(3)*EXP(ETA(3))*TIME
>
> KIN= THETA(1)
>
> BASE= THETA(4)+ETA(2)
>
> KOUT= KIN/BASE
>
> IMAX= 1
>
> IC50= THETA(2)*EXP(ETA(1))
>
> A_0(3)= BASE
>
> F1 = 0
>
> IF (CMT .EQ. 1 .AND. EVID .EQ. 1) F1 = 1
>
> IF (CMT .EQ. 1 .AND. EVID .EQ. 1 .AND. TIME .EQ. 24 .AND. DELTA .LE. 4) F1 = 1
>
> IF (CMT .EQ. 1 .AND. EVID .EQ. 1 .AND. TIME .EQ. 36 .AND. DELTA .LE. 4) F1 = 1
>
> IF (CMT .EQ. 1 .AND. EVID .EQ. 1 .AND. TIME .EQ. 24 .AND. DELTA .GT. 4 .AND. DELTA .LE. 8) F1 = 1
>
> IF (CMT .EQ. 1 .AND. EVID .EQ. 1 .AND. TIME .EQ. 36 .AND. DELTA .GT. 4 .AND. DELTA .LE. 8) F1 = 0
>
> IF (CMT .EQ. 1 .AND. EVID .EQ. 1 .AND. TIME .EQ. 24 .AND. DELTA .GE. 8) F1 = 0
>
> IF (CMT .EQ. 1 .AND. EVID .EQ. 1 .AND. TIME .EQ. 36 .AND. DELTA .GE. 8) F1 = 0
>
> $DES
>
> DADT(1)=-K12*A(1) +K21*A(2) -K*A(1)
>
> DADT(2)= K12*A(1) -K21*A(2)
>
> DADT(3)= KIN+PLA -KOUT*A(3)*(1-IMAX*(A(1)/V1)/(IC50+(A(1)/V1)))
>
> $ERROR
>
> IPRE= F
>
> Y= F + EPS(1)
>
> IF (TIME .EQ. 0 .AND. CMT .EQ. 3 .AND. EVID .EQ. 0) BASE2 = Y
>
> IF (TIME .LT. 24) DELTA = 0
>
> IF (TIME .EQ. 24) DELTA = Y - BASE2
>
> My thought was that I could use F1 to turn on and off a dose.
>
> But this did not work. What I need is for BASE2 to be retained in subsequent records so that it can be used to calculate DELTA.
>
> Here are the first couple of observations for Patient 10001
>
> TABLE NO. 1
>
> ID EVID MDV CMT TIME IPRE DV BASE2 DELTA BASE AMT F1 NSIM
>
> 1.0001E+04 1.0000E+00 1.0000E+00 1.0000E+00 0.0000E+00 1.1433E+02 0.0000E+00 0.0000E+00 0.0000E+00 1.1433E+02 2.7150E+00 1.0000E+00 0.0000E+00
>
> 1.0001E+04 1.0000E+00 1.0000E+00 3.0000E+00 0.0000E+00 1.1533E+02 0.0000E+00 0.0000E+00 0.0000E+00 1.1433E+02 1.0000E+00 0.0000E+00 0.0000E+00
>
> 1.0001E+04 0.0000E+00 0.0000E+00 3.0000E+00 0.0000E+00 1.1533E+02 1.1769E+02 1.1769E+02 0.0000E+00 1.1433E+02 0.0000E+00 0.0000E+00 0.0000E+00
>
> 1.0001E+04 0.0000E+00 0.0000E+00 3.0000E+00 5.0000E-01 1.1546E+02 1.1359E+02 0.0000E+00 0.0000E+00 1.1433E+02 0.0000E+00 0.0000E+00 0.0000E+00
>
> 1.0001E+04 0.0000E+00 0.0000E+00 3.0000E+00 1.0000E+00 1.1567E+02 1.1713E+02 0.0000E+00 0.0000E+00 1.1433E+02 0.0000E+00 0.0000E+00 0.0000E+00
>
> 1.0001E+04 0.0000E+00 0.0000E+00 3.0000E+00 2.0000E+00 1.1593E+02 1.1454E+02 0.0000E+00 0.0000E+00 1.1433E+02 0.0000E+00 0.0000E+00 0.0000E+00
>
> 1.0001E+04 0.0000E+00 0.0000E+00 3.0000E+00 4.0000E+00 1.1616E+02 1.1740E+02 0.0000E+00 0.0000E+00 1.1433E+02 0.0000E+00 0.0000E+00 0.0000E+00
>
> 1.0001E+04 0.0000E+00 0.0000E+00 3.0000E+00 6.0000E+00 1.1628E+02 1.1775E+02 0.0000E+00 0.0000E+00 1.1433E+02 0.0000E+00 0.0000E+00 0.0000E+00
>
> 1.0001E+04 0.0000E+00 0.0000E+00 3.0000E+00 1.2000E+01 1.1640E+02 1.1497E+02 0.0000E+00 0.0000E+00 1.1433E+02 0.0000E+00 0.0000E+00 0.0000E+00
>
> 1.0001E+04 0.0000E+00 0.0000E+00 3.0000E+00 2.3900E+01 1.1611E+02 1.2103E+02 0.0000E+00 0.0000E+00 1.1433E+02 0.0000E+00 0.0000E+00 0.0000E+00
>
> 1.0001E+04 1.0000E+00 1.0000E+00 1.0000E+00 2.4000E+01 1.1610E+02 0.0000E+00 0.0000E+00 1.1656E+02 1.1433E+02 2.7150E+00 1.0000E+00 0.0000E+00
>
> 1.0001E+04 0.0000E+00 0.0000E+00 3.0000E+00 2.4500E+01 1.1623E+02 1.1715E+02 0.0000E+00 1.1656E+02 1.1433E+02 0.0000E+00 0.0000E+00 0.0000E+00
>
> 1.0001E+04 0.0000E+00 0.0000E+00 3.0000E+00 2.8000E+01 1.1688E+02 1.1774E+02 0.0000E+00 1.1656E+02 1.1433E+02 0.0000E+00 0.0000E+00 0.0000E+00
>
> 1.0001E+04 0.0000E+00 0.0000E+00 3.0000E+00 3.6000E+01 1.1697E+02 1.1702E+02 0.0000E+00 1.1656E+02 1.1433E+02 0.0000E+00 0.0000E+00 0.0000E+00
>
> 1.0001E+04 1.0000E+00 1.0000E+00 1.0000E+00 3.6000E+01 1.1697E+02 0.0000E+00 0.0000E+00 1.1656E+02 1.1433E+02 2.7150E+00 0.0000E+00 0.0000E+00
>
> 1.0001E+04 0.0000E+00 0.0000E+00 3.0000E+00 3.6500E+01 1.1697E+02 1.1600E+02 0.0000E+00 1.1656E+02 1.1433E+02 0.0000E+00 0.0000E+00 0.0000E+00
>
> 1.0001E+04 0.0000E+00 0.0000E+00 3.0000E+00 4.0000E+01 1.1687E+02 1.1249E+02 0.0000E+00 1.1656E+02 1.1433E+02 0.0000E+00 0.0000E+00 0.0000E+00
>
> 1.0001E+04 0.0000E+00 0.0000E+00 3.0000E+00 4.8000E+01 1.1645E+02 1.1227E+02 0.0000E+00 1.1656E+02 1.1433E+02 0.0000E+00 0.0000E+00 0.0000E+00
>
> 1.0001E+04 0.0000E+00 0.0000E+00 3.0000E+00 6.0000E+01 1.1556E+02 1.1372E+02 0.0000E+00 1.1656E+02 1.1433E+02 0.0000E+00 0.0000E+00 0.0000E+00
>
> 1.0001E+04 0.0000E+00 0.0000E+00 3.0000E+00 7.2000E+01 1.1460E+02 1.1265E+02 0.0000E+00 1.1656E+02 1.1433E+02 0.0000E+00 0.0000E+00 0.0000E+00
>
> 1.0001E+04 0.0000E+00 0.0000E+00 3.0000E+00 8.4000E+01 1.1367E+02 1.1345E+02 0.0000E+00 1.1656E+02 1.1433E+02 0.0000E+00 0.0000E+00 0.0000E+00
>
> 1.0001E+04 0.0000E+00 0.0000E+00 3.0000E+00 9.6000E+01 1.1283E+02 1.1508E+02 0.0000E+00 1.1656E+02 1.1433E+02 0.0000E+00 0.0000E+00 0.0000E+00
>
> The baseline is 117.7 but DELTA has values of 116.6. I cannot figure out what NONMEM is doing.
>
> Can anyone offer any suggestions. Thanks, pete bonate
>
> Peter L. Bonate, PhD
>
> Senior Director
>
> Global Head - Pharmacokinetics, Modeling, and Simulation
>
> Global Clinical Pharmacology & Exploratory Development
>
> Astellas Pharma Global Development
>
> Three Parkway North
>
> Deerfield, IL 60015
>
> phone: (847) 282-5855
>
> cell: 224-619-4901
>
> email: [email protected]
>
> "Confidence is what you have before you understand the problem" - Woody Allen
>
>