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.