Constant parameter setting throws error, or... if I don't set a parameter to constant, but don't change it, does it stay constant?

1 view (last 30 days)
Jim Bosley
Jim Bosley on 12 Nov 2019
Commented: Jim Bosley on 13 Nov 2019
In another thread, I asked about using subject- (group- in SimBiology) dependent parameter values to allow fitting of one part of a model (say, PD), using subject-specific PK parameters.
It turns out you can. I'm doing this this way:
In my input data file, I duplicate my subject number column and call it "Group". In my model, I've added a species called "Group". I've created a dose object that takes the Group value in that extra column and doses the Group species with that value. So during the fit of any subject, the value in Group is that subject's ID number. I've created a setparvalue.m function that accepts a parameter name and the Group number as inputs. In the code, it reads subject numbers, parameter names, and parameter values from a spreadsheet. These three things are all labeled as persistent so that the time-consuming physical read is done only once.
For each parameter, I have a repeat assignment rule
kmAB_12 = setparvalue('kmAB_12',Group)Gr
For subject-specific operation, this rule is set to active and the parameter value constant flag is set to zero. That is, the parameter is used as a variable.
For normal operation, this rule set to inactive and the parameter value constant flag is set to 1 (that is, the parameter is constant).
The inactive rule generates a little red icon showing that it's inactive. That is as expected and is fine. But even when the rule is inactive, an error icon is generated due to the fact that the rule is modifying a constant parameter.
If the following makes sense, I have a suggestion and a question.
Suggestion: Given that an inactive rule does not affect simulation, I would suggest that any error generated should be suppressed when a rule is inactive.
Question: If I leave the parameter variable all the time, but nothing in the model changes that parameter, does the parameter remain constant? That is, could I just set the parameter constant flag to zero and leave it, to suppress errors? Can you fit parameters that aren't set to constant? I don't observe parameter values changing but I was wondering if it could change under any SimBiology scenario.

Accepted Answer

Arthur Goldsipe
Arthur Goldsipe on 13 Nov 2019
Great feedback as always, Jim.
As for your immediate questions:
"If I leave the parameter variable all the time, but nothing in the model changes that parameter, does the parameter remain constant? That is, could I just set the parameter constant flag to zero and leave it, to suppress errors?"
Yes, you can use this approach so that you have the flexibility of changing the parameter under other scenarios. That's exactly what I would do in the situation you describe.
"Can you fit parameters that aren't set to constant? I don't observe parameter values changing but I was wondering if it could change under any SimBiology scenario."
Yes, when you try to estimate a parameter that is not constant, what you are really estimating is the initial value of that parameter (before application of any rules and doses at time = 0). One annoying thing right now is that SimBiology still allows you to try to estimate this initial value of a parameter that is modified by a repeated assignment or initial assignment rule, even though that doesn't really make sense. It's on my list of issues to improve with our fitting capabilities.
  3 Comments

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!