Open-Systems-Pharmacology / MoBi

MoBi® is a software tool for multiscale physiological modeling and simulation
Other
31 stars 10 forks source link

Different sensitivity analysis results depending on group of parameters being varied #475

Open abdullahhamadeh opened 4 years ago

abdullahhamadeh commented 4 years ago

Here the sensitivity of Q to nu and to nu_part_hyd changes according to whether or not the two parameters are varied with another parameter of the model

sensitivity-analysis-bug.zip

StephanSchaller commented 4 years ago

Yes, this may well be.

e.g. the sensitivity of fat organ volume may increase if the drug is more lipophilic.

abdullahhamadeh commented 4 years ago

Thanks. I understand that that scenario can emerge as a second order effect in a global sensitivity analysis. But in mobi the sensitivity analysis is only first order, isn't it? ie each parameter is perturbed from its nominal value separately from the others, and this process is done parameter by parameter. In such a case I would expect that the sensitivity of the output to a parameter to be the same even if multiple parameters have been selected for perturbation in the analysis.

StephanSchaller commented 4 years ago

@Yuri05, you added the "bug" label. Have you already checked?

Yuri05 commented 4 years ago

But in mobi the sensitivity analysis is only first order, isn't it? ie each parameter is perturbed from its nominal value separately from the others, and this process is done parameter by parameter. In such a case I would expect that the sensitivity of the output to a parameter to be the same even if multiple parameters have been selected for perturbation in the analysis.

Yes. Seems to be a bug.

msevestre commented 4 years ago

@Yuri05 Any idea as to what is happening? Does SimModel keep some memory of previous values?

Yuri05 commented 4 years ago

I don't think so. Interestingly the wrong sensitivity is completely zero. grafik

msevestre commented 4 years ago

Looking at this now...

msevestre commented 4 years ago

So nu is not only a function, but also a function of nu_part_hyd

So when we vary nu, the function of nu_part_hyd is overwritten. Therefor the sensitivity of nu_part_hyd is then 0 as it is not used in the model anymore

@Yuri05 I am not sure what we should do here. Varying formula parameter does not make sense with the current implementation as we are defacto removing the formula

This is also one of the reason why the Add All constant does not add those parameters by default

StephanSchaller commented 4 years ago

Could you group the parameters for the SA and first do the constants and then the formulas, but here again, formulas can depend on formulas and you may get the same result..

But would the formulas not be reset to their original formula after they have been varied?

msevestre commented 4 years ago

@ their original formula after they have been varied? No. We create a population if you want where all parameters are equal to the parameter before the variation except for one entry

Say you vary P1, P2, P3 with original values 1,2,3 and we have 10% variation for each parameter

The "Population" used for SA will look as follow

P1 P2 P3
0.9 2 3
1.1 2 3
1 1.8 3
1 2.2 3
1 2 2.4
1 2 3.6

e.g each parameter will be overwritten. This is ok for constant parameters but creates an issue when varying formula parameters.

Maybe we should rethink this but this is not mega easy

StephanSchaller commented 4 years ago

okay, got it, yes, sth to ponder ;-)

Yuri05 commented 4 years ago

@msevestre

I am not sure what we should do here. Varying formula parameter does not make sense with the current implementation as we are defacto removing the formula

True. In v10 we could show an exclamation mark for all formula parameters selected

Trying to calculate all sensitivities correctly in case some formula parameters were selected would require in general to estimate the hierarchy level of all selected parameters and perform sensitivity calculations for each level independently.