NONMEM Users Network Archive

Hosted by Cognigen

RE: Generating Cmax at end of infusion

From: Elassaiss - Schaap, J. - <jeroen.elassaiss>
Date: Wed, 7 Apr 2010 23:18:28 +0200

Hi Leonid,

Thank you for pointing out that one can use A(*) in $PK. Vladimir once =
told me to request A(*) values in the ERROR block (for good reasons) and =
I never revisited that lesson for refinement ;-)

As far as the MTIME behavior - how I read the help file, one should be =
able to apply the MNOW flag in a meaningful way. During my tests, MNOW =
or MNEXT never reached a non-zero state in $ERROR. Which is not =
according to - at least - the spirit of that particular passage in the =
help.

While I was at it, I tested your code in my previous example (after =
adding a RATE of -2 to the dosing record) but disappointingly the A(1) =
was not updated at the end of the duration. This was not cured when I =
requested CALLFL=-2.

Code snippet:
"
D1=.65
IF(TIME.EQ.0)CMAX=0
C=A(1)/S1
IF(C.GE.CMAX)CMAX=C
"
And result:
"
TABLE NO. 1
          ID TIME CMAX IPRE
  1.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
  1.0000E+00 5.0000E-02 0.0000E+00 1.9535E+03
  1.0000E+00 1.6667E-01 1.9535E+03 4.0312E+03
  1.0000E+00 3.3333E-01 4.0312E+03 4.7959E+03
  1.0000E+00 6.8300E-01 4.7959E+03 3.5742E+03
  1.0000E+00 1.0000E+00 4.7959E+03 1.5137E+02
  1.0000E+00 2.0000E+00 4.7959E+03 7.0535E-03
  1.0000E+00 4.0000E+00 4.7959E+03 1.5315E-11
  1.0000E+00 8.0000E+00 4.7959E+03 7.2205E-29
"
The Cmax obviously was increased after entering an EVID=2 line at 0.65 =
h. So what I did next was inserting a MTIME(1)=DUR and that cured it! =
The recipe is to only include an MTIME at the DUR and read out A(*). =
MTIME alone ensures CALLFL=-2:
"
MTIME(1)=DUR
CP=A(1)/S1
"
is sufficient. The maximum CP that is tabulated will display the =
concentration at the end of infusion. Of course, in other situations one =
might need additional code to ensure that A(*) is read at the desired =
time.

I also went back to my original code, and moved the CP2= lines to $PK. =
But the MTIME alone apparently is not enough to update the A(*) values =
because it did not change the outcome. Therefore the recipe above is =
only valid in combination with another model-event time!

Finally, I have no answer to your question why. But it could make sense =
that rolling back A(*) to a previous event time might affect other =
routines. That it would be $OMEGA only I never would have guessed.

Best whishes,
Jeroen

-----Original Message-----
From: Leonid Gibiansky [mailto:LGibiansky
Sent: Wednesday, 07 April, 2010 16:36
To: Elassaiss - Schaap, J. (Jeroen)
Cc: Eleveld, DJ; prhutson
Subject: Re: [NMusers] Generating Cmax at end of infusion

Hi Jeroen,
The part of the manual that you described did not mention that the call =
to ERROR is done. And indeed, you can use MTIME in any subsequent calls =
to ERROR (that are made at event times). So I do not think this is a =
bug.

Since call to PK is done, you can try to get A() value in the PK block, =
something like

$PK
...
C=A(*)/V1
IF(C.GE.CMAX) THEN
   TMAX=TSTATE
   CMAX=C
ENDIF
...

If the end-of-infusion concentration is CMAX, this code may get it out =
(and TMAX should point to the end-of-infusion; both of them should be =
taken from the first event record following the end-of-infusion) but I =
have not tried it.

-----------
Here is the part of the manual that discussed use of A(*) in the PK =
block:

   A(n) TSTATE

    A(n) are the latest computed compartment amounts, and TSTATE is the
    time at which they were computed. That is, A(n) are the amounts at
    the previous event time, or if at a later time, but before the time
    for which PK is being called, a lagged or additional dose was given,
    or a regular infusion was terminated, or a modeled event occurred,
    then A(n) are the amounts at the latest such time. If there are
    population etas, and A(n) are used in the $PK abbreviated code, then
    any $OMEGA records referring to etas explicitly used in this code
    should precede the $PK record, or if an $MSFI record is used, it
    should precede the $PK record and include the option NPOP=m.

-------------------

Could someone explain why

"If there are
    population etas, and A(n) are used in the $PK abbreviated code, then
    any $OMEGA records referring to etas explicitly used in this code
    should precede the $PK record"

Thanks
Leonid

--------------------------------------
Leonid Gibiansky, Ph.D.
President, QuantPharm LLC
web: www.quantpharm.com
e-mail: LGibiansky at quantpharm.com
tel: (301) 767 5566




Elassaiss - Schaap, J. (Jeroen) wrote:
> Hi Douglas, Paul,
>
> The help on mtime suggests that it should work.
> " When the time is reached, indicator variables are set and a call to
> PK is made. At this call (and/or subsequent to this call) PK or
> DES or AES or ERROR can use the indicator variables to change some
> aspect of the system, e.g., a term in a differential equation, or =

> the rate of an infusion. This feature may be used with any ADVAN
> routine. "
>
> The following code (tested with nm6.2.0) however does not work in the
> $ERROR block, where the model predictions are available. As one can
> see, CP is only set at the data time event, not at the MTIME. CP2 is
> not set at all. So it seems $ERROR is not called upon the MTIME event.
>
> An indicator in $PK works properly (tested, not shown).
>
> Can anyone confirm this behavior? If so, this looks like a bug to me.
>
> Best regards,
> Jeroen
>
> ____model____
> $PROB structural model 1comp.rep single subject $INPUT ID TIME DV AMT
> EVID TRT $DATA iv_ss.csv IGN=I $SUBR ADVAN1 TRANS2
>
> $PK
> TVCL=THETA(1)
> CL=TVCL
> TVV=THETA(2)
> V=TVV
>
> S1=V/1000
>
> ;mtime piece
> MTIME(1)=.075 ; .075 h not in dataset
> MTIME(2)=.5 ; .5 h not in dataset
> IF(TIME.EQ.0)CP=0
> IF(TIME.EQ.0)CP2=0
>
> $ERROR
> IPRED=F
> Y=F+F*ERR(1)
> IF(TIME.EQ.0)MYFLAG=0 ; 0 h IN dataset
> IF(MPAST(1).EQ.1.AND.MYFLAG.EQ.0)THEN
> CP=F
> MYFLAG=1
> ENDIF
>
> CP2=CP2+MNEXT(2)*F
>
> $THETA
> (0,10)
> (0,1)
>
> $OMEGA
> .05
>
> $SIM (123456789)
> $EST PRINT=1 MAXEVAL=9990 SIG=3 NOABORT METHOD=0 ;$COV =
PRINT=E $TABLE
> ID TIME CP CP2 IPRED
> NOPRINT ONEHEADER FILE=1cmp.txt
>
> ____dataset___
> ID,time h,conc nM,amt,evid,dose śmol
> 1,0,.,30,1,10
> 1,0.05,0,.,0,10
> 1,0.166666667,0,.,0,10
> 1,0.333333333,0,.,0,10
> 1,0.683,0,.,0,10
> 1,1,0,.,0,10
> 1,2,0,.,0,10
> 1,4,0,.,0,10
> 1,8,0,.,0,10
> ____table file_____
> TABLE NO. 1 =
    
> ID TIME CP CP2 IPRE =
DV
> 1.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 3.2044E+04 =
0.0000E+00
> 1.0000E+00 5.0000E-02 0.0000E+00 0.0000E+00 1.9459E+04 =
1.6272E+04
> 1.0000E+00 1.6667E-01 6.0768E+03 0.0000E+00 6.0768E+03 =
7.7936E+03
> 1.0000E+00 3.3333E-01 6.0768E+03 0.0000E+00 1.1524E+03 =
1.0149E+03
> 1.0000E+00 6.8300E-01 6.0768E+03 0.0000E+00 3.5213E+01 =
2.8321E+01
> 1.0000E+00 1.0000E+00 6.0768E+03 0.0000E+00 1.4905E+00 =
1.5249E+00
> 1.0000E+00 2.0000E+00 6.0768E+03 0.0000E+00 6.9328E-05 =
7.8605E-05
> 1.0000E+00 4.0000E+00 6.0768E+03 0.0000E+00 1.4999E-13 =
1.5736E-13
> 1.0000E+00 8.0000E+00 6.0768E+03 0.0000E+00 7.0211E-31 =
6.9514E-31
>
> ----------------------------------------------------------------------
> --
> *From:* owner-nmusers
> [mailto:owner-nmusers
> *Sent:* Tuesday, 06 April, 2010 20:22
> *To:* prhutson
> *Subject:* RE: [NMusers] Generating Cmax at end of infusion
>
> Hi,
>
> As others have suggested making an additional record at the known
> desired time is probably the most straightforward manner to get what
> you want. So this should probably be a preferred solution.
>
> If you for some reason you cant to add a record (maybe you dont know
> the time beforehand), I think you can achieve what you want using =
MTIME().
> This has the added advantage of working without going the $DES route
> and the associated slower run-times. I'll see if I can get something
> like that to work tomorrow, just as an excercise.
>
> Can the experts give an opinion as to whether MTIME() should work or =
not?
>
> Regards,
>
> Douglas Eleveld
>
>
> -----Original Message-----
> From: owner-nmusers
> Sent: Tue 4/6/2010 6:11 PM
> To: NMUSERS
> Subject: [NMusers] Generating Cmax at end of infusion
>
> G'day.
> I would like to generate a concentration at the end of an infusion of
> duration DUR.
> I am using ADVAN3 TRANS4 with log transformed data. Here is what I
> have tried, but I am getting an error that the parameter 'T' that I
> understood to be the machine time is undefined. Can anyone suggest a
> proper way to give set Cmax=exp(Y) at the end of the infusion of =
length DUR?
> Many thanks in advance.
> Paul
> $PK
> ...
> TT=TIME
>
> $ERROR
> ;I've also tried
> ;TT=TIME
> ;TT=T
> IPRE=F
> EDV=EXP(DV)
> W=1
> IF(F.GT.0) W=F
> IRES=F-EDV
> IWRE=IRES/W
> LOGF=LOG(0.0001)
> IF (F.GT.0) LOGF=LOG(F)
> Y=LOGF+EPS(1)
> ;GENERATE CMAX AT END OF INFUSION (DUR)
> IF(DUR.EQ.TT) CMAX=EXP(Y)
>
> --
>
>
> Paul R. Hutson, Pharm.D.
>
> Associate Professor
>
> UW School of Pharmacy
>
> 777 Highland Avenue
>
> Madison WI 53705-2222
>
> Tel 608.263.2496
>
> Fax 608.265.5421
>
> Pager 608.265.7000, p7856
>
>
> ----------------------------------------------------------------------
> -- De inhoud van dit bericht is vertrouwelijk en alleen bestemd voor
> de geadresseerde(n). Anderen dan de geadresseerde(n) mogen geen
> gebruik maken van dit bericht, het niet openbaar maken of op enige
> wijze verspreiden of vermenigvuldigen. Het UMCG kan niet aansprakelijk =

> gesteld worden voor een incomplete aankomst of vertraging van dit
> verzonden bericht.
>
> The contents of this message are confidential and only intended for
> the eyes of the addressee(s). Others than the addressee(s) are not
> allowed to use this message, to make it public or to distribute or
> multiply this message in any way. The UMCG cannot be held responsible
> for incomplete reception or delay of this transferred message.
>
> ----------------------------------------------------------------------
> -- This message and any attachments are solely for the intended
> recipient.
> If you are not the intended recipient, disclosure, copying, use or
> distribution of the information included in this message is prohibited
> --- Please immediately and permanently delete.
> ----------------------------------------------------------------------
> --

This message and any attachments are solely for the intended recipient. =
If you are not the intended recipient, disclosure, copying, use or =
distribution of the information included in this message is prohibited =
--- Please immediately and permanently delete.
Received on Wed Apr 07 2010 - 17:18:28 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.