Jump to content


Photo

IF(NEWIND.NE.2) equivalent for average concentration calcuation on the fly


  • Please log in to reply
5 replies to this topic

#1 Thomas Klitgaard

Thomas Klitgaard

    Member

  • Members
  • PipPip
  • 15 posts

Posted 09 March 2016 - 04:04 PM

 Hi there,

 

Could you illustrate to make the Phoenix equivalent to this NONMEM twist,  to get the the average concentration calculated on the fly, in period btw. current and since last effect response record.

 

Thx

Thomas

 

$PK

 

IF(NEWIND.NE.2)THEN ; set up variables for new subject

LAUC = 0 ; previous AUC

LTM = TIME ; previous time

LAVE = 0 ; average concentration since previous record

ENDIF

 

KA=THETA(1)

CL=THETA(2)

V=THETA(3)

 

$DES

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

DADT(2)=KA*A(1)-CL/V*A(2)

DADT(3)=A(2)

 

$ERROR

CP=A(2)/V

AUC=A(3)/V

 

DTIM = TIME - LTM ; Time difference

DAUC = AUC - LAUC ; Difference in AUC

IF(DTIM.EQ.0)THEN

CAVE = LAVE ; Time has not changed, average concentration is the same

ELSE

CAVE = DAUC/DTIM

ENDIF

 

; Record current AUC and TIME for next call

LAUC = AUC

LTM = TIME

LAVE = CAVE

BASE = FID1

 

EFF = EM*CAVE**HILL/(EC**HILL+CAVE**HILL)

IPRE = BASE - EFF

IF(IPRE.LT.0) IPRE=0

Y = IPRE + EPS(1)

 


  • RobertGok, Cyharlesbob, Williamwrire and 35 others like this

#2 smouksassi1

smouksassi1

    Advanced Member

  • Val_Members
  • PipPipPip
  • 232 posts
  • LocationMontreal

Posted 10 March 2016 - 04:30 PM

Hi it will be good if you can provide a fully repoducible example with the data and complete control file  so we can reproduce what you did in nonmem on our end and then show you exactly how to do it in pml.

These kind of computations should be possible  using sequence, doafter and dobefore:
 

...

observe(CObs = C*(1+ CEps),doafter={prevAUC=AUC})

...



#3 Thomas Klitgaard

Thomas Klitgaard

    Member

  • Members
  • PipPip
  • 15 posts

Posted 11 March 2016 - 10:28 AM

Hi 

 

Thx - I have sent control stream and data support to suport, as I do not want to post it in public. 

 

But the issue put simply is, how to get the AUC since last timepoint calculated for all timepoints and subjects.

 

What would the IF.NEWIND.NE.2 equivalent would be - ie., the trick to reset the AUC for each subject?

 

BR Thomas

 

Hi it will be good if you can provide a fully repoducible example with the data and complete control file  so we can reproduce what you did in nonmem on our end and then show you exactly how to do it in pml.

These kind of computations should be possible  using sequence, doafter and dobefore:
 

...

observe(CObs = C*(1+ CEps),doafter={prevAUC=AUC})

...

 



#4 Simon Davis

Simon Davis

    Advanced Member

  • Administrators
  • 1,329 posts

Posted 11 March 2016 - 04:14 PM

Hi Thomas, please take a look at the attached project, specifically the last two models where I've calculated Cavg on a simple PK model at each observation time;

time as cov & time as fcov where I tried to illustrate that fcovariate and covariate do different things in comfination with dobefore and doafter statements.

essentially I set up the following;

fcovariate(time2) # carry forward time1 until time2
double(tprev)
double(AUCprev)


then on the observe statement; (there are some extra variables there for illustration)

observe(CObs = C * (1 + CEps), dobefore={tprev=time2 Cprev=C}
doafter={AUCprev=AUC tprev2=time2})
#i.e.lags the previous Timepoint value


and finally;

# calc of Cavg
deriv(AUCinf = C) # simple AUCinf
deriv(AUC = C) # AUC for interval
timeinterval=t-tprev # length of time between Obs
Cavg=(AUC-AUCprev)/timeinterval

I think that is what you were looking for and you can probably code this more elegantly than me now ;0) since there are some redundant code in there I used to illustrate what was happening between dobefore and doafter


Simon

Attached Files


Edited by Simon Davis, 11 March 2016 - 04:18 PM.


#5 smouksassi1

smouksassi1

    Advanced Member

  • Val_Members
  • PipPipPip
  • 232 posts
  • LocationMontreal

Posted 11 March 2016 - 04:28 PM

few comments

 

observe(CObs = C * (1 + CEps), dobefore={tprev=time2 Cprev=C}
doafter={AUCprev=AUC tprev2=time2})
 #i.e.lags the previous Timepoint value


think of doafter AUCprev=AUC like we want to save the "current" cumulative AUC as a variable called AUCprev this "value" will be available to the next observation since we did save it after we read and computed for the previous one.

when the program reaches the new observation then AUCprev will be the value we "saved" from the previous one and so on.

any expression in PML like the once for Cavg below is evaluated at each row.

 

 

Cavg=(AUC-AUCprev)/timeinterval

 

in this example we did not need sequence since we only wanted computation right before or right after an observation is made.

 

I do not have access to what is sent to support



#6 Thomas Klitgaard

Thomas Klitgaard

    Member

  • Members
  • PipPip
  • 15 posts

Posted 14 March 2016 - 09:07 AM

Dear Simon, smoukassi1, 

 

Thx, yes, that was what I was looking for - thank you.

 

Just a bonus question: Say I want to summarize the Cave per x hours, but have a more dense TIME grid (as in NONMEM where I would include EVID =2 time points in between for later simulation) -- how would you do that  more elegantly that by just piecing together from the dAUC from the other example.

 

Suppose that would be some sequence/procedure statement?

 

Thx

Thomas

 

TIME  C  Cave(tau=24)

0         3     .

0.5      7    .   

1        9      .

2        33     .

4        44    .

...

24      34      41432

24.5    57     .

25       92     .

26      102    .

...

48      37       59322

 

etc






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users