Jump to content


Photo

Reset Time After Dose?

multiple dosing parameter relative to dose

  • Please log in to reply
9 replies to this topic

#1 jonathanknights

jonathanknights

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 23 April 2015 - 02:05 PM

Hi,

 

I currently have a single dose data set that I am modeling recirculation using:

 

 
#    sequence{
#       sleep(Tbump);
#        EHC=Abile/tau;
#       sleep(tau);
#        EHC=0;
#    }
#
#    stparm( Tbump = tvTbump*exp(nTbump) )
#    stparm( tau = tvtau*exp(ntau) )
 
I'd like to know how to amend this code so that Tbump is executed relative to a dose in a multiple dosing data set, i.e. that the recirculation occurs at a specific time within a given distribution relative to a dosing event. Is there a difference notation that can be used? e.g. is there some way I can define TSLD and perpetuate the circulation effect that way? 
 
Thanks,
Jon

 



#2 serge guzy

serge guzy

    Advanced Member

  • Members
  • PipPipPip
  • 485 posts

Posted 23 April 2015 - 02:28 PM

 

Hi,

 

I currently have a single dose data set that I am modeling recirculation using:

 

 
#    sequence{
#       sleep(Tbump);
#        EHC=Abile/tau;
#       sleep(tau);
#        EHC=0;
#    }
#
#    stparm( Tbump = tvTbump*exp(nTbump) )
#    stparm( tau = tvtau*exp(ntau) )
 
I'd like to know how to amend this code so that Tbump is executed relative to a dose in a multiple dosing data set, i.e. that the recirculation occurs at a specific time within a given distribution relative to a dosing event. Is there a difference notation that can be used? e.g. is there some way I can define TSLD and perpetuate the circulation effect that way? 
 
Thanks,
Jon

 

Dear JON

The following code will define tsld as you requested.

I hope it will help you.

best Regards

Serge

 

test(){
 deriv(tsld=1)
 deriv(A1=-Cl*C)
 dosepoint(A1,doafter={tsld=0})
 C = A1 / V
 error(CEps = 0.1)
 observe(CObs = C*(1+CEps))
 stparm(V = tvV * exp(nV))
 stparm(Cl = tvCl * exp(nCl))
 fixef(tvV = c(, 1, ))
 fixef(tvCl = c(, 1, ))
 ranef(diag(nV, nCl) = c(0.1, 0.1))
}



#3 jonathanknights

jonathanknights

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 23 April 2015 - 02:47 PM

Dear JON

The following code will define tsld as you requested.

I hope it will help you.

best Regards

Serge

 

test(){
 deriv(tsld=1)
 deriv(A1=-Cl*C)
 dosepoint(A1,doafter={tsld=0})
 C = A1 / V
 error(CEps = 0.1)
 observe(CObs = C*(1+CEps))
 stparm(V = tvV * exp(nV))
 stparm(Cl = tvCl * exp(nCl))
 fixef(tvV = c(, 1, ))
 fixef(tvCl = c(, 1, ))
 ranef(diag(nV, nCl) = c(0.1, 0.1))
}

Serge,

 

Thanks. Perhaps I'm missing it, but I'm looking to use TSLD to define the value of Tbump in the sequence statement. is this syntax similar to the NONMEM syntax of using a 'dummy' derivative to define a lag time? I'm just missing how your code extends to the sequence statement and estimating Tbump as a value of TSLD. Apologies for any confusion. Thanks again.

 

-Jon



#4 serge guzy

serge guzy

    Advanced Member

  • Members
  • PipPipPip
  • 485 posts

Posted 24 April 2015 - 10:43 AM

Serge,

 

Thanks. Perhaps I'm missing it, but I'm looking to use TSLD to define the value of Tbump in the sequence statement. is this syntax similar to the NONMEM syntax of using a 'dummy' derivative to define a lag time? I'm just missing how your code extends to the sequence statement and estimating Tbump as a value of TSLD. Apologies for any confusion. Thanks again.

 

-Jon

Dear Jon

Please find attached that shows how I believe you could handle that interesting problem. The issue is that putting on/off without stopping the numerical integration can cause instability. That is why we use the sequence that tells the program to stop after a specified sleeping period.

 

The code is quite tricky. Look at it and come back to me after for clarification.

 

In the code I wrote only one cycle on/off will be performed within each dosage interval which is I think what you want.

 

QRPEM fit very well when starting far away from the true while FOCE ELS had problems. Note that the model I wrote is not physiological at all. I just wanted to show you how to do it.

 

I cannot copy the code in any editor for some reason, then best I can do is to send you the project in 14 of course. We do not use anymore 13.

 

 

 

 

 

 

 

 

Attached Files



#5 jonathanknights

jonathanknights

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 24 April 2015 - 10:57 AM

Dear Jon

Please find attached that shows how I believe you could handle that interesting problem. The issue is that putting on/off without stopping the numerical integration can cause instability. That is why we use the sequence that tells the program to stop after a specified sleeping period.

 

The code is quite tricky. Look at it and come back to me after for clarification.

 

In the code I wrote only one cycle on/off will be performed within each dosage interval which is I think what you want.

 

QRPEM fit very well when starting far away from the true while FOCE ELS had problems. Note that the model I wrote is not physiological at all. I just wanted to show you how to do it.

 

I cannot copy the code in any editor for some reason, then best I can do is to send you the project in 14 of course. We do not use anymore 13.

Serge,

Is there any way you can paste the code in a text file? I only have 13 and our validation of 14 is still a ways back on the company list. I'm very interested to see your code though. I can get a version to run if I do:

 

# sequence{

#    if (tsld==Tbump) {EHC=Abile/tau}

#    else if (tsld==(Tbump+tau)) {EHC=0}

#    else {EHC=0}

# }

 

but I'm not sure this is effective within the NLME parameters and don't want to let the model run until I see your code as it will likely take around 18hrs.

 

Enjoying the discussion -Jon



#6 serge guzy

serge guzy

    Advanced Member

  • Members
  • PipPipPip
  • 485 posts

Posted 24 April 2015 - 11:32 AM

Dear Jonathan

Unfortunately the code I wrote works only with 14 and the patch that will be released soon. This is because there were bugs that were fixed now in the patch.

Just for your information , here is the code you will be able to use once the patch 14 is released. You will need to first install 14 and then the patch.

 

First bug that was fixed is doafter did not work at a dose point. Second bug was while(1) did nto work and works in the patch. I will see if I can modify the code to have it working on 13 but the problem is the reset of the time to be tme after the dose.

best regards

Serge

 

 

test(){

               deriv(tad=1)

              

               deriv(A1=-Cl*C+EHC)

               Abile=100

               dosepoint(A1,doafter={tad=0})

               C = A1 / V

               error(CEps = 0.1)

               observe(CObs = C*(1+CEps))

               stparm(V = tvV * exp(nV))

               stparm(Cl = tvCl * exp(nCl))

               fixef(tvV = c(, 2, ))

               fixef(tvCl = c(, 0.2, ))

               ranef(diag(nV, nCl) = c(1, 1))

#             Abile=1

               double(EHC)

 

    sequence{

# going through all the records

    while(1)            {

 

# increase delat t by 0.1

                              sleep(0.1)                                                                                      

 

# as long as the time after the dose is less than the total time Tbump + tau

                              # than perform the following. Note that this will happen only one time within

#                            a dose interval which is what you want

               while(tad<Tbump+tau) {

 

# sleep(0.1) as long as tad less than Tbump

       sleep(Tbump);

        EHC=Abile/tau;

       sleep(tau);

        EHC=0;

                                                                           }

                                                                           }

                                                            }

#

    stparm( Tbump = tvTbump*exp(nTbump) )

    stparm( tau = tvtau*exp(ntau) )

               fixef(tvTbump=c(,2,))

               fixef(tvtau=c(,3,))

              

ranef(diag(nTbump, ntau) = c(1, 1))

 

 

}



#7 serge guzy

serge guzy

    Advanced Member

  • Members
  • PipPipPip
  • 485 posts

Posted 24 April 2015 - 04:29 PM

Dear Jonathan

I made it working on 13. The project is attached.

Code explanation

 

 

 

test(){
 deriv(tad=1)

 

# this will create a Y=X line. tad will be equal to tad as long as you do not reset tad to 0

 

tadgraph=tad

# just to see with initial estimates tab what tad profile should be
 
 deriv(A1=-Cl*C+EHC)

# PK profile arbitrary being dependent on a on/off trigger EHC
 Abile=100

# arbitrary
 dosepoint(A1,doafter={tad=0})

# dose given and then tad is reset to 0
 C = A1 / V
 error(CEps = 0.1)
 observe(CObs = C*(1+CEps))

# error model

 

 

 stparm(V = tvV * exp(nV))
 stparm(Cl = tvCl * exp(nCl))
 fixef(tvV = c(0, 2, ))
 fixef(tvCl = c(0, 0.2, ))
 ranef(diag(nV, nCl) = c(1, 1))

 

# structural parameters

 double(EHC)

 

# EHC changes when the program stops (every time at the end of the sleep, the program #stops and you do something. double or real statement are required

 

# we now start to tell the program what to do with time

    sequence{
# going through all the records: does not work with 13. replace with while(t<48)
#    while(1)

 

# means as long as the time is less than 48 (assumed hee to be the largest observed time)

# then do everything that is in curly brackets
 

    while(t<48) 

# open the curly bracket
        {

# increase delat t by 0.1
  sleep(0.1)      

# as long as the time after the dose is less than the total time Tbump + tau
  # than perform the following. Note that this will happen only one time within
#  a dose interval which is what you want
 while(tad<Tbump+tau) {

# sleep(0.1) as long as tad less than Tbump
       sleep(Tbump);
        EHC=Abile/tau;
       sleep(tau);
        EHC=0;
         }
     }
    }
#
    stparm( Tbump = tvTbump*exp(nTbump) )
    stparm( tau = tvtau*exp(ntau) )
 fixef(tvTbump=c(,2,))
 fixef(tvtau=c(,3,))
 
ranef(diag(nTbump, ntau) = c(1, 1))

}

 

 

 

# hope it helps. The only issue with 13 was in fact the while(1) that did not work.

# while(1) means do the loop as long as you have records in your data set (or times you still want to simulate). Here you need in 13 look at your max time point and use it in the loop as while(t<thatmaxtime)

 

Best

SergeAttached File  tad_reset_version13.phxproj   677.88KB   337 downloadsAttached File  tad_reset_version13.phxproj   677.88KB   337 downloadsAttached File  tad_reset_version13.phxproj   677.88KB   337 downloads

 



#8 serge guzy

serge guzy

    Advanced Member

  • Members
  • PipPipPip
  • 485 posts

Posted 24 April 2015 - 04:30 PM

sorry

test(){
 deriv(tad=1)

 

# this will create a Y=X line. tad will be equal to tad as long as you do not reset tad to 0

 

I mean

test(){
 deriv(tad=1)

 

# this will create a Y=X line. t will be equal to tad as long as you do not reset tad to 0



#9 jonathanknights

jonathanknights

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 26 April 2015 - 05:58 PM

Dear Jonathan

I made it working on 13. The project is attached.

Code explanation

 

 

 

test(){
 deriv(tad=1)

 

# this will create a Y=X line. tad will be equal to tad as long as you do not reset tad to 0

 

tadgraph=tad

# just to see with initial estimates tab what tad profile should be
 
 deriv(A1=-Cl*C+EHC)

# PK profile arbitrary being dependent on a on/off trigger EHC
 Abile=100

# arbitrary
 dosepoint(A1,doafter={tad=0})

# dose given and then tad is reset to 0
 C = A1 / V
 error(CEps = 0.1)
 observe(CObs = C*(1+CEps))

# error model

 

 

 stparm(V = tvV * exp(nV))
 stparm(Cl = tvCl * exp(nCl))
 fixef(tvV = c(0, 2, ))
 fixef(tvCl = c(0, 0.2, ))
 ranef(diag(nV, nCl) = c(1, 1))

 

# structural parameters

 double(EHC)

 

# EHC changes when the program stops (every time at the end of the sleep, the program #stops and you do something. double or real statement are required

 

# we now start to tell the program what to do with time

    sequence{
# going through all the records: does not work with 13. replace with while(t<48)
#    while(1)

 

# means as long as the time is less than 48 (assumed hee to be the largest observed time)

# then do everything that is in curly brackets
 

    while(t<48) 

# open the curly bracket
        {

# increase delat t by 0.1
  sleep(0.1)      

# as long as the time after the dose is less than the total time Tbump + tau
  # than perform the following. Note that this will happen only one time within
#  a dose interval which is what you want
 while(tad<Tbump+tau) {

# sleep(0.1) as long as tad less than Tbump
       sleep(Tbump);
        EHC=Abile/tau;
       sleep(tau);
        EHC=0;
         }
     }
    }
#
    stparm( Tbump = tvTbump*exp(nTbump) )
    stparm( tau = tvtau*exp(ntau) )
 fixef(tvTbump=c(,2,))
 fixef(tvtau=c(,3,))
 
ranef(diag(nTbump, ntau) = c(1, 1))

}

 

 

 

# hope it helps. The only issue with 13 was in fact the while(1) that did not work.

# while(1) means do the loop as long as you have records in your data set (or times you still want to simulate). Here you need in 13 look at your max time point and use it in the loop as while(t<thatmaxtime)

 

Best

Sergeattachicon.giftad_reset_version13.phxprojattachicon.giftad_reset_version13.phxprojattachicon.giftad_reset_version13.phxproj

 

Thanks Serge, this is great. I had run into the while(1) problem previously, so it's good to know that it was actually a bug with 13. I have implemented a modified version of your script - it is running about 40min/iteration... Hopefully the results look good! Thanks again!



#10 serge guzy

serge guzy

    Advanced Member

  • Members
  • PipPipPip
  • 485 posts

Posted 27 April 2015 - 12:57 PM

Thanks Serge, this is great. I had run into the while(1) problem previously, so it's good to know that it was actually a bug with 13. I have implemented a modified version of your script - it is running about 40min/iteration... Hopefully the results look good! Thanks again!

You are welcome. Let me know how it goes. I hope you click first on "initial estimates" to make sure you start with a good spot of initial estimates. Do not forget to change the initial estimates in the code if you change those in the "initial estimate"tab.

Best

Serge







Also tagged with one or more of these keywords: multiple dosing, parameter relative to dose

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users