Jump to content


Photo

Modelling ER data as 3 dept injection using transit model

Transit modelling

  • Please log in to reply
9 replies to this topic

#1 harishkk

harishkk

    Advanced Member

  • Members
  • PipPipPip
  • 47 posts

Posted 27 February 2017 - 06:05 AM

Hello,

I have data of ER injection which would release the drug over longer period of time.I have modelled the data using transit compartment modelling.I am attaching phx prj file in which i have tried 2 different approaches (2cmt_2 depot_estKel_add & 2cmt_3depot_estKel_add)

  1. 2cmt_2 depot_estKel_add: In this approach i have divided the dose into 2 different fractions ie 1 fraction directly reaches the central cmt and another fraction reaches through transit comp and then reaches the central comp. My data fitting using the model seems to be ok.I need help in further optmising this model
  2. 2cmt_3depot_estKel_add: In this approach i have divided the dose into 3 different fractions ie 1 fraction directly reaches the central cmt and another 2 fraction's reaches through 2 transit comp's and then reaches the central comp.I have fitted the data to this model but overall the fitting remains the same as that of earlier approach. I need help here in optimising the model and whether my model is correctly written based on my hypothesis stated above.

I need support from people to optmise the models further, your response will be of great help

 

Regards

HK 

Attached Files



#2 serge guzy

serge guzy

    Advanced Member

  • Members
  • PipPipPip
  • 485 posts

Posted 27 February 2017 - 07:56 AM

Dear HK

Indeed you had a problem with your coding.

You need 4 constraints

0<F1<1

0<F2<1

0<F3<1

F1+F2+F3=1

 

You code did not guarantee all constraints.

I changed the code to insure these constraints are respected.

Let me know if it helps.

Now for sure all the constraints are respected.

-2LL is better too.

Best Regards

Serge

 

test(){
 transit(Aa2, mtt1, ntr1, max = 50, out = -Aa2 * Ktr1)
 transit(Aa3, mtt2, ntr2, max = 50, out = -Aa3 * Ktr2)
# need to make sure all F are positive and sum=1
 bio1=ilogit(F1_direct)
 dosepoint(Aa1, bioavail = bio1)
# dosepoint(Aa1, bioavail = F1_direct)
 
 
# dosepoint(Aa2, bioavail = F2_direct)
bio2=(1-bio1)*ilogit(F2_direct)
dosepoint(Aa2, bioavail = bio2)
 bio3=1-bio1-bio2
 dosepoint(Aa3, bioavail =bio3)
 deriv(A1 = - (Kel * A1) +(Aa3*Ktr2)+(Aa1 * Ka) + (Aa2 * Ktr1)-(K12*A1)+(K21*A2))
 
 deriv(Aa1 = - (Aa1 * Ka))
 deriv(A2 = (K12*A1)-(K21*A2))
 
 C = A1 / V1
 C2=A2/V2
 mtt1=(ntr1+1)/Ktr1
mtt2=(ntr2+1)/Ktr2
 error(CEps = 1)
 observe(CObs = C + CEps)
 stparm(V1 = tvV1 * exp(nV1))
 stparm(V2 = tvV2 * exp(nV2))
 stparm(Kel = tvKel * exp(nKel))
 stparm(Ka = tvKa * exp(nKa))
 stparm(K12 = tvK12 * exp(nK12))
 stparm(K21 = tvK21 * exp(nK21))
 stparm(Ktr1 = tvKtr1 * exp(nKtr1))
 stparm(Ktr2 = tvKtr2 * exp(nKtr2))
 stparm(ntr1 = tvntr1 * exp(nntr1))
 stparm(ntr2 = tvntr2 * exp(nntr2))
    stparm(F1_direct = tvF1_direct)
  stparm(F2_direct = tvF2_direct)
  
 fixef(tvV1 = c(0, 12,30 ))
 fixef(tvV2 = c(0, 211,300 ))
 fixef(tvKel= c(0,0.00013, ))
 fixef(tvK12 = c(0, 0.744, ))
 fixef(tvK21 = c(0, 0.0429, ))
 fixef(tvKa = c(0, 0.75, ))
 fixef(tvKtr1 = c(0, 0.05, ))
 fixef(tvntr1 = c(0, 4, ))
 fixef(tvKtr2 = c(0, 0.05, ))
 fixef(tvntr2 = c(0, 4, ))
 fixef(tvF1_direct = c(,  0,)) 
 fixef(tvF2_direct = c(,  0,))
 ranef(block(nV1, nKel) = c(0.060069234, 0.031922021, 0.042022708),
      block(nKa, nKtr1) = c(0.32744575, -0.033038011, 0.046767492),
 block(nKtr2) = c(0.033038011),
 block(nV2) = c(0.32744575),
  block(nK12, nK21) = c(0.32744575, -0.033038011, 0.046767492))
    ranef(diag(nntr1,nntr2) = c(0.1,0.1))
}
 
 

 

Attached Files



#3 harishkk

harishkk

    Advanced Member

  • Members
  • PipPipPip
  • 47 posts

Posted 27 February 2017 - 09:40 AM

Dear Serge, 

As always your insight is always helpful

 

Thanks for your minor tweakings to the code

 

Regards

HK



#4 smouksassi1

smouksassi1

    Advanced Member

  • Members
  • PipPipPip
  • 231 posts
  • LocationMontreal

Posted 02 March 2017 - 06:00 AM

there is several ways to constrain the entities into what Serge mentions:

 

0<F1<1

0<F2<1

0<F3<1

F1+F2+F3=1


one way is this TvF1 >0 ,TvF2 >0 ,TvF3 >0 and the sum is 1 

 

F1 =  tvF1 / ( 1+ TvF1 + TvF2)

F2  =  tvF2 / ( 1+ TvF1 + TvF2)

F3 = 1/(1 + tvF1  + tvF2 ) 

 

 

take an example tvF1 0.25 tvF2 = 0.5

 

 

F1 =  0.25 / ( 1+0.25 +0.5) = 0.25 / 1.75 = 0.142...

F2 =  0.5 / ( 1+0.25 +0.5) = 0.5/ 1.75  = 0.285

F3 = 1/(1 + 0.25   +0.5 )  = 1/ 1.75 =] 0.5714286

 

F1  + F2 + F 3 =   (1 + 0.25   +0.5 ) /(1 + 0.25   +0.5 )   = 1


http://journals.plos...al.pcbi.1003686

 

https://cs.brown.edu...13/mcerlean.pdf



#5 harishkk

harishkk

    Advanced Member

  • Members
  • PipPipPip
  • 47 posts

Posted 02 March 2017 - 11:20 AM

Dear smouksassi1 & Serge,

 

Thanks for your suggestion's,

I have landed into a trouble, i have sc injection formulation which shows 4 different peaks, you can see the plot in the phx project attached

  • I have tried fitting the data using my earlier hypothesis that dose is distributed into 3 different fractions ie 1 fraction directly reaches the central cmt and another 2 fraction's reaches through 2 transit comp's and then reaches the central comp

 

  • i have also tried to increase another transit comp, ie assuming that now dose is distributed into 4 different fractions ie 1 fraction directly reaches the central cmt and another 3 fraction's reaches through 3 transit comp's and then reaches the central comp

but in both cases iam facing an issue in fitting, can any one help me

 

Regards

HK

Attached Files



#6 serge guzy

serge guzy

    Advanced Member

  • Members
  • PipPipPip
  • 485 posts

Posted 02 March 2017 - 12:36 PM

Dear Colleague

Here is the new code.

First your initial estimates were bad. In addition, in the mass balance for A1, (Aa4*Ktr3) term was missing.

Now I got I think a very good fit.

Best Regards

Serge

 

test(){
 transit(Aa2, mtt1, ntr1, max = 50, out = -Aa2 * Ktr1)
 transit(Aa3, mtt2, ntr2, max = 50, out = -Aa3 * Ktr2)
 transit(Aa4, mtt3, ntr3, max = 50, out = -Aa4 * Ktr3)
 bio1=ilogit(F1_direct)
 dosepoint(Aa1, bioavail = bio1)
 bio2=(1-bio1)*ilogit(F2_direct)
 dosepoint(Aa3, bioavail = bio3)
 bio3=(1-bio1-bio2)*ilogit(F3_direct)
 dosepoint(Aa2, bioavail = bio2)
 bio4=1-bio1-bio2-bio3
 dosepoint(Aa4, bioavail = bio4)
 deriv(A1 = - (Kel * A1) +(Aa3*Ktr2)+(Aa1 * Ka) + (Aa2 * Ktr1)-(K12*A1)+(K21*A2)
 +(Aa4*Ktr3))
 
 deriv(Aa1 = - (Aa1 * Ka))
 deriv(A2 = (K12*A1)-(K21*A2))
 
 C = A1 / V1
 C2=A2/V2
 mtt1=(ntr1+1)/Ktr1
mtt2=(ntr2+1)/Ktr2
 mtt3=(ntr3+1)/Ktr3
 error(CEps = 1)
 observe(CObs = C + CEps)
 stparm(V1 = tvV1 * exp(nV1))
 stparm(V2 = tvV2 * exp(nV2))
 stparm(Kel = tvKel * exp(nKel))
 stparm(Ka = tvKa * exp(nKa))
 stparm(K12 = tvK12 * exp(nK12))
 stparm(K21 = tvK21 * exp(nK21))
 stparm(Ktr1 = tvKtr1 * exp(nKtr1))
 stparm(Ktr2 = tvKtr2 * exp(nKtr2))
 stparm(Ktr3 = tvKtr3 * exp(nKtr3))
 stparm(ntr1 = tvntr1 * exp(nntr1))
 stparm(ntr2 = tvntr2 * exp(nntr2))
 stparm(ntr3 = tvntr3 * exp(nntr3))
    stparm(F1_direct = tvF1_direct)
  stparm(F2_direct = tvF2_direct)
  stparm(F3_direct = tvF3_direct)
  
 fixef(tvV1 = c(0, ,100 ))
 fixef(tvV2 = c(0, 126,500 ))
 fixef(tvKel= c(0,0.000121,10 ))
 fixef(tvK12 = c(0, 0.02,5 ))
 fixef(tvK21 = c(0, 0.001855,5 ))
 fixef(tvKa = c(0, 1.25, ))
 fixef(tvKtr1 = c(0, 0.05, ))
 fixef(tvntr1 = c(0, 4, ))
 fixef(tvKtr2 = c(0, 0.05, ))
 fixef(tvntr2 = c(0, 4, ))
 fixef(tvKtr3 = c(0, 0.05, ))
 fixef(tvntr3 = c(0, 4, ))
 fixef(tvF1_direct = c(,-4,  )) 
 fixef(tvF2_direct = c(,-4,  ))
 fixef(tvF3_direct = c(,-4,  ))
 ranef(block(nV1, nKel) = c(0.060069234, 0.031922021, 0.042022708),
      block(nKa, nKtr1) = c(0.32744575, -0.033038011, 0.046767492),
 block(nKtr2) = c(0.033038011),
 block(nKtr3) = c(0.033038011),
 block(nV2) = c(0.32744575),
  block(nK12, nK21) = c(0.32744575, -0.033038011, 0.046767492))
    ranef(diag(nntr1,nntr2,nntr3) = c(0.1,0.1,0.1))
}
 
 

 

Attached Files



#7 harishkk

harishkk

    Advanced Member

  • Members
  • PipPipPip
  • 47 posts

Posted 03 March 2017 - 06:27 AM

Dear Serge,

 

Accepted my minor oversight while writing the code,

 

Thanks for correcting it, however when iam trying to run this in NLME/naive pooled mode/FOCE method with full all subjects data (n=6) the run time is going into many hours.

Is it because of my system configuration or just the model is too complex because of differential equations

 

Iam attaching the full data (n=6) for you to try at your end and check for me

 

Regards

Harish

Attached Files



#8 serge guzy

serge guzy

    Advanced Member

  • Members
  • PipPipPip
  • 485 posts

Posted 05 March 2017 - 09:10 PM

Dear Harish

To me your model is way much too overparametrized.

I suggest you to try to limit the number of transit compartments and not using the max=50.

When using naive pool, the fit was excellent but ntr1 was 178 which means 178 transit compartments, non sense to me. I believe this transit compartments is not necessary. If you change the number for ntr1, you get the same graph, completely insensitive.

Try to start with a simpler model and may be without transit compartments but only 3 extra vascular inputs.

Transit compartments is testing too many scenarios and it can take forever.

Best Regards

Serge



#9 harishkk

harishkk

    Advanced Member

  • Members
  • PipPipPip
  • 47 posts

Posted 13 March 2017 - 06:22 AM

Dear Serge,

Thanks for your suggestion, i tried doing it with simple model using 3 depot extravascular inputs, but the model didn't fit the data well

 

I was wondering is there any way we can use transit compartment to model the data  based on the figure below

 

Regards

Harish



#10 harishkk

harishkk

    Advanced Member

  • Members
  • PipPipPip
  • 47 posts

Posted 13 March 2017 - 06:22 AM

Dear Serge,

Thanks for your suggestion, i tried doing it with simple model using 3 depot extravascular inputs, but the model didn't fit the data well

 

I was wondering is there any way we can use transit compartment to model the data  based on the figure below

 

Regards

Harish

 

Attached Thumbnails

  • transit.jpg





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users