# Modelling ER data as 3 dept injection using transit model

**URL:** <https://forum.certara.com/t/modelling-er-data-as-3-dept-injection-using-transit-model/3138>\
**Category:** Modelling and Simulation\
**Created:** [February 27, 2017, 6:05am UTC](https://forum.certara.com/t/modelling-er-data-as-3-dept-injection-using-transit-model/3138 "2017-02-27T06:05:21Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![harishkk](https://avatars.discourse-cdn.com/v4/letter/h/54ee81/32.png) [@harishkk](https://forum.certara.com/u/harishkk)\
**Post date:** [February 27, 2017, 6:05am UTC](https://forum.certara.com/t/modelling-er-data-as-3-dept-injection-using-transit-model/3138/1 "2017-02-27T06:05:21Z")

</div>

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

[ExMS.phxproj](https://forum.certara.com/uploads/short-url/aCAqBPwwt1YjZQ74TllezatdKGq.phxproj) (968 KB)

---

<div class="post-metadata">

**Author:** ![minhaj](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@minhaj](https://forum.certara.com/u/minhaj)\
**Post date:** [February 27, 2017, 7:56am UTC](https://forum.certara.com/t/modelling-er-data-as-3-dept-injection-using-transit-model/3138/2 "2017-02-27T07:56:28Z")

</div>

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))  
}

[ExMS.phxproj](https://forum.certara.com/uploads/short-url/kLbsqxoo1Ronsrem3uRKD8rFgm9.phxproj) (1.35 MB)

---

<div class="post-metadata">

**Author:** ![harishkk](https://avatars.discourse-cdn.com/v4/letter/h/54ee81/32.png) [@harishkk](https://forum.certara.com/u/harishkk)\
**Post date:** [February 27, 2017, 9:40am UTC](https://forum.certara.com/t/modelling-er-data-as-3-dept-injection-using-transit-model/3138/3 "2017-02-27T09:40:11Z")

</div>

Dear Serge,

As always your insight is always helpful

Thanks for your minor tweakings to the code

Regards

HK

---

<div class="post-metadata">

**Author:** ![Samer\_Mouksassi](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Samer\_Mouksassi](https://forum.certara.com/u/Samer_Mouksassi)\
**Post date:** [March 2, 2017, 6:00am UTC](https://forum.certara.com/t/modelling-er-data-as-3-dept-injection-using-transit-model/3138/4 "2017-03-02T06:00:22Z")

</div>

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.org/ploscompbiol/article?id=10.1371/journal.pcbi.1003686](http://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1003686)

[https://cs.brown.edu/research/pubs/theses/ugrad/2013/mcerlean.pdf](https://cs.brown.edu/research/pubs/theses/ugrad/2013/mcerlean.pdf)

---

<div class="post-metadata">

**Author:** ![harishkk](https://avatars.discourse-cdn.com/v4/letter/h/54ee81/32.png) [@harishkk](https://forum.certara.com/u/harishkk)\
**Post date:** [March 2, 2017, 11:20am UTC](https://forum.certara.com/t/modelling-er-data-as-3-dept-injection-using-transit-model/3138/5 "2017-03-02T11:20:06Z")

</div>

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

[MS.phxproj](https://forum.certara.com/uploads/short-url/tFzBO32IyGpqfJTYEqyPTJRkWIZ.phxproj) (774 KB)

---

<div class="post-metadata">

**Author:** ![minhaj](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@minhaj](https://forum.certara.com/u/minhaj)\
**Post date:** [March 2, 2017, 12:36pm UTC](https://forum.certara.com/t/modelling-er-data-as-3-dept-injection-using-transit-model/3138/6 "2017-03-02T12:36:41Z")

</div>

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) +(Aa3Ktr2)+(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))  
}

[MS.phxproj](https://forum.certara.com/uploads/short-url/4RNODixhe17dMCIzdsjDClZPJEW.phxproj) (1.49 MB)

---

<div class="post-metadata">

**Author:** ![harishkk](https://avatars.discourse-cdn.com/v4/letter/h/54ee81/32.png) [@harishkk](https://forum.certara.com/u/harishkk)\
**Post date:** [March 3, 2017, 6:27am UTC](https://forum.certara.com/t/modelling-er-data-as-3-dept-injection-using-transit-model/3138/7 "2017-03-03T06:27:50Z")

</div>

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

[FULL of removing\_t\_0\_data\_mean bydURUEON MS data1234.xls](https://forum.certara.com/uploads/short-url/vCnFp2rbcJ98QvTjzjGqxfpDvVL.xls) (38 KB)

---

<div class="post-metadata">

**Author:** ![minhaj](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@minhaj](https://forum.certara.com/u/minhaj)\
**Post date:** [March 5, 2017, 9:10pm UTC](https://forum.certara.com/t/modelling-er-data-as-3-dept-injection-using-transit-model/3138/8 "2017-03-05T21:10:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![harishkk](https://avatars.discourse-cdn.com/v4/letter/h/54ee81/32.png) [@harishkk](https://forum.certara.com/u/harishkk)\
**Post date:** [March 13, 2017, 6:22am UTC](https://forum.certara.com/t/modelling-er-data-as-3-dept-injection-using-transit-model/3138/9 "2017-03-13T06:22:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![harishkk](https://avatars.discourse-cdn.com/v4/letter/h/54ee81/32.png) [@harishkk](https://forum.certara.com/u/harishkk)\
**Post date:** [March 13, 2017, 6:22am UTC](https://forum.certara.com/t/modelling-er-data-as-3-dept-injection-using-transit-model/3138/10 "2017-03-13T06:22:38Z")

</div>

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

 ![transit.jpg](https://us1.discourse-cdn.com/certara/original/2X/2/266fd7b29b7872e4dff68d1cdfd961676259c4a3.jpeg)
