Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is sensitivity parameter selection from R more restrictive than from MoBi? #2201

Open
Yuri05 opened this issue Jan 31, 2024 · 1 comment
Assignees
Labels
question RFC Request For Comments

Comments

@Yuri05
Copy link
Member

Yuri05 commented Jan 31, 2024

When starting sensitivity analysis in MoBi: parameters are only added to the sensitivity analysis configuration view if they have CanBeVaried=true and are neither table nor categorical.

https://github.com/Open-Systems-Pharmacology/MoBi/blob/7e68545a23f1b4a54ed9389fa146d756ac4a7ab2/src/MoBi.Core/Services/ParameterAnalysableParameterSelector.cs#L6-L13

      public override bool CanUseParameter(IParameter parameter)
      {
         return parameter.CanBeVaried
                && !ParameterIsTable(parameter)
                && !ParameterIsCategorial(parameter);
      }

Sensitivity calculation also additionally filters out parameters with start value=0 (those parameters are not filtered in the configuration view out because the user could change parameter value in the simulation and then the sensitivity would be calculated).

In R, parameters available for sensitivity are defined by:

public bool ParameterCanBeUsedForSensitivity(IParameter parameter)
{
return _parameterSelector.CanUseParameter(parameter) && parameter.IsConstantParameter() && !ValueComparer.AreValuesEqual(parameter, 0);
}

with CanUseParameter(parameter) defined as

public class ParameterAnalysableParameterSelector : AbstractParameterAnalysableParameterSelector
{
public override bool CanUseParameter(IParameter parameter)
{
return parameter.CanBeVaried
&& !parameter.Info.ReadOnly
&& !ParameterIsTable(parameter)
&& !ParameterIsCategorial(parameter);
}

and parameter.IsConstantParameter() defined as

public static bool IsConstantParameter(this IParameter parameter)
{
return parameter.IsFixedValue || parameter.Formula.IsConstant() || parameter.Formula.IsDistributed();
}

Thus comparing parameter filter criteria in R vs. MoBi, there is a bunch of additional restrictions in R which define if a parameter can be used in sensitivity calculations:

  1. Parameter value is not zero
  2. Parameter is not defined as read-only
  3. Parameter is constant (➡️ either defined by const value or distributed or the formula was overwritten by a const value)

While the first restriction perfectly makes sense for me: I don't see any reason for the restrictions 2. and 3.
Especially the restriction "Parameter is not defined as read-only" is problematic, because the read-only flag can be changed neither in R nor in MoBi nor in PK-Sim. So if I want to calculate sensitivity for such a parameter - my only chance is to change the flag value in a pkml file (which is errore prone, especially because the flag is a bit field).

So: why do we have those restrictions in R and can we remove them?

@PavelBal
Copy link
Member

PavelBal commented Feb 1, 2024

So: why do we have those restrictions in R and can we remove them?

I think we should remove them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question RFC Request For Comments
Projects
None yet
Development

No branches or pull requests

4 participants