Open-Systems-Pharmacology / Forum

Discussion forum for the Open Systems Pharmacology Project
65 stars 19 forks source link

Bug report: the unit problem in formula #491

Closed jzq90 closed 4 years ago

jzq90 commented 4 years ago

When I use Weibull function in my simulation, I found the calculated alpha doesn't match the beta and disstime50, as shown in the picture below:

图片

I've tried some values and also a small test (parameter test3 in the picture below), test3 = test1^test2, while the answer is 60 when test=1 h and test=2 (dimensionless). It makes no sense for this. Considering this is a simple formula, I wonder if I did somewhere wrong or this is a bug.

图片

jzq90 commented 4 years ago

When test1 = 1 h, the real formula for test3 is test3 = 1×60^(test2-1) When test1 = 2 h, the real formula for test3 is test3 = 2 × 120^(test2-1) When test1 = 3 h, the real formula for test3 is test3 = 3 × 180^(test2-1)

jzq90 commented 4 years ago

Now I want to know if the parameter alpha in Weibull function has an influence on the simulation. Could anyone help me?

Yuri05 commented 4 years ago

MoBi and PK-Sim store all parameters in the base unit of their corresponding dimension. All calculations are carried out using the base units. Calculated values are then displayed in the desired display unit.

Thus e.g. if you define the parameters as following: parameter unit, dimension
p1 = 2 Dimension: Time, Unit: [h]
p2 = p1+30 Dimension: Time, Unit: [h]
p3 = p1+30 Dimension: Dimensionless

Then the calculation is as following:

Now if you would use either p2 or p3 in further calculations: both parameters would be used in their internal value of 150.

This mini model is inconsistent, because the dimension of p3 is obviously wrong (it should be Time and not Dimensionless). If the dimension check is activated, you will get a warning when using it in a simulation: grafik

Now for e.g. Weibull_alpha it's the same situation. ln(2)/t50^shape will be internally calculated as ln(2)/t50_in_minutes^shape. The value of Weibull_alpha used for all calculation will be ln(2)/t50_in_minutes^shape (the internal value).

The displayed value depends on the dimension definition of Weibull_alpha. Because the dimension of Weibull_alpha is defined as InversedTime, this value as interpreted as [1/min] and is converted then to [1/h]. The dimension definition in this case is inconsistent as well (it corresponds to shape=1). However having arbitrary Dissolution shape as time exponent makes definition of the fixed dimension impossible.

jzq90 commented 4 years ago

Thanks very much. I got the internal calculation method. However, I'm still confused about the unit. For one thing, thealpha in software is different from the equation in the instruction. 图片

According to the instruction book of the software, the alpha should be DissTime50^DissShape/ln(2), but not ln(2)/DissTime50^DissShape. The dimension of alpha should be 'Time' so it can be divided by t I'm confused about this.

For another thing, the alpha will change if calculated by different units of the same data, while shape and t50 will keep the same.

For example, if fit the dissolution with hour, alpha1 will be (t50)^shape/ln(2) and the unit is hour. If change the unit to min, alpha2 will change to (t50*60)^shape/ln(2), and the unit is min. Apparently alpha1 does not equal alpha2. I've validated this in DDsolver, with the same data but the different units, alpha will change.

Will the dissolution profile be the same when I input the t50 with the unit of hour or min ?

Yuri05 commented 4 years ago

According to the instruction book of the software, the alpha should be DissTime50^DissShape/ln(2), but not ln(2)/DissTime50^DissShape. The dimension of alpha should be 'Time' so it can be divided by t I'm confused about this.

If you check the Weibull formula in PK-Sim you will see that it is written in the form ...exp(-alpha*(Time-LagTime)^beta), thus "PK-Sim Weibull alpha" = 1/Weibull_alpha

Will the dissolution profile be the same when I input the t50 with the unit of hour or min ?

If you input the same value for t50, the outcome will be the same. E.g. if you enter t50 = 1[h] it will be the same as for t50 = 60[min]. Of course if you enter t50 = 1[min] instead of t50 = 1[h] the outcome will be different, but that's obvious - isn't it?

jzq90 commented 4 years ago

Yes, you're right. Now I get it. Again, thanks for your kind and patient replying. Also thanks for the great software. It's amazing.