MATLAB Answers

Specifying different variants for different groups in 'sbiofit'

7 views (last 30 days)
Is it possible to specify different variants for different groups when using the 'sbiofit' function in code? From the documentation, it appears that 'sbiofit' only supports the specification of a single set of variants to be applied to all of the groups.
Thank you,
Abed Alnaif


Sign in to comment.

Accepted Answer

Sietse Braakman
Sietse Braakman on 22 Jul 2019
Hi Abed,
We get this question quite regularly - the best way to do this currently is by using dosing. What you have to do:
  1. In your dataset: Create a column in your dataset for each parameter you want to change. For each individual in your dataset, assign a value of your parameter at t = 0. e.g. You have a column 'Dose_ka' with value 3 at t = 0, and NaN's (empties) elsewhere. If you have many parameters that you need to assign values to, you could automate this by exporting your dataset from SimBiology pulling out the
  2. In your model: Create a dummy species, e.g. 'Dose_ka'. Then create a repeated assignment (an initial assignment will not work!) to assign the value of Dose_ka to the parameter ka. So the repeated assignment rule should read ka = Dose_ka. This is assuming you are assigning a value to a parameter or a compartment. If you want to assign an initial value to a species, you can of course just dose the species at t = 0 (make sure the model value of the initial condition is 0).
  3. In your fit task/sbiofit: map the dose column for Dose_ka to the species Dose_ka in your model.
Another solution could be - but this is more involved - to create a simfunction where you specify which model components you want to change the value of, define your own objective function and pass that to the optimization alogrithm. In that case, you are basically doing the work that sbiofit does for you.
We have noted this use case, thanks for asking it here!
Please let us know if you have further questions.


Show 3 older comments
Sietse Braakman
Sietse Braakman on 16 Aug 2019
Hi Abed,
Is the value you are assigning to your parameter(s) coming from your variant or from your dataset? For this solution to work, these values need to be incorporated in your dataset like you would do for a dose.
As to the error you are getting - this is an interesting problem. I hadn't anticipated this! Just a thought, instead of defining T_lag as a parameter in your model, can you change the time (time entry in your dataset) when the dose associated with T_lag is administered? That might be a more direct approach to your problem.
Abed Alnaif
Abed Alnaif on 19 Aug 2019
Hi Sietse,
Thanks for responding on your time off. My solution was to update the model so that it no longer relies on the dose lag parameters.
Sietse Braakman
Sietse Braakman on 3 Oct 2019
One more thing to keep in mind: if you are using this to assign a value to a compartment, you need to make sure that the initial value of the dosing-species is non-zero to avoid divide-by-zero issues (these will result in warnings of NaNs and Infs when you run your simulation).

Sign in to comment.

More Answers (0)



More Answers in the  SimBiology Community

Community Treasure Hunt

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

Start Hunting!