- SimBiology scenarios
- Create and simulate a model using SimFunctions
Simulate different dosing amounts with a schedule dose
5 views (last 30 days)
Show older comments
Zinnia Parra-Guillen
on 26 Oct 2021
Commented: Zinnia Parra-Guillen
on 29 Oct 2021
Does anybody know if there is a way to perform a parameter scan of a dose amount if the dose object is a schedule dose? Or do I need to create one dose object manually for each dose level that I want to simulate.
Thanks,
0 Comments
Accepted Answer
Florian Augustin
on 28 Oct 2021
Hello,
parameterized schedule doses are currently not supported (Matlab release R2021b), only repeat doses can be parameterized. As you already mentioned, in order to scan over schedule doses you have to create separate dose objects. Here is an example how you could do it on the MATLAB command line:
% Load example model
modelObj = sbmlimport("radiodecay.xml");
% Define dose amounts to scan over
doseAmountValues = [50, 100, 200];
numAmountValues = numel(doseAmountValues);
% Schedule times
scheduleTimes = [1, 2, 3, 4];
% Create schedule doses
for idx = 1:numAmountValues
scheduleDoses(idx) = sbiodose("dose amount " + doseAmountValues(idx), "schedule"); %#ok<*SAGROW>
scheduleDoses(idx).TargetName = "x";
scheduleDoses(idx).Time = scheduleTimes;
% Here the same dose amount is applied at every scheduled time,
% but the actual dose schedule and parameterization may be more complex.
scheduleDoses(idx).Amount = [1, 1, 1, 1] * doseAmountValues(idx);
end
% Create scenarios to scan over the doses
scenarios = SimBiology.Scenarios("doses to scan over", scheduleDoses);
% Create a simulation function for the model
simFun = createSimFunction(modelObj, scenarios, "x", [], "AutoAccelerate", false);
% Simulate the model for every dosing scenario
simData = simFun(scenarios, 10);
% Plot the results
sbioplot(simData);
Here is a list of references to the documentation that may be helpful
If your schedule doses are regular enough, you could use repeat doses instead; but I assume this is not the case in your application? If this was the case, you could just create one repeat dose, parameterize the Amount property, and then scan over the parameter used for the parameterization of the amount. For repeat doses, you could also use a "Run Scan" program in the SimBiology Model Analyzer app to perform the parameter scan over different dose amounts.
-Florian
3 Comments
Florian Augustin
on 28 Oct 2021
Edited: Florian Augustin
on 28 Oct 2021
Hi Zinnia,
You are right, that will work. It sounds like you may even only need two repeat doses. One for the initial treatment (days 1, 3, 5) and one for the continued treatment (days 8, 29, 50, ...). Here is an example for how you could implement this on the command line:
% Load example model
modelObj = sbmlimport("radiodecay.xml");
% Define dose amounts to scan over
doseAmountValues = [50, 100, 200];
% Add dose parameter to the model
addparameter(modelObj, "doseAmount");
% Create repeat doses
initialTreatment = sbiodose("dose days 1, 2, 3", "repeat");
initialTreatment.TargetName = "x";
initialTreatment.Amount = "doseAmount"; % parameterized amount to scan over
initialTreatment.StartTime = 1; % first dose on day one
initialTreatment.RepeatCount = 2; % repeat application of this dose twice
initialTreatment.Interval = 2; % 2 day interval
continuedTreatment = sbiodose("dose every 21 days", "repeat");
continuedTreatment.TargetName = "x";
continuedTreatment.Amount = "doseAmount"; % parameterized amount to scan over
continuedTreatment.StartTime = 8; % first dose on day eight
continuedTreatment.RepeatCount = 10; % repeat application of this dose ten times
continuedTreatment.Interval = 21; % repeat dose every 21 days
% Create scenarios to scan over the doses;
% this creates scan scenarios for you where the two doses are applied for every
% value (in doseAmountValues) you want to scan over.
% Create scenarios to scan over the doses
doseScenarios = SimBiology.Scenarios("initial treatment", initialTreatment);
add(doseScenarios, "elementwise", "continued treatment", continuedTreatment);
scanScenarios = SimBiology.Scenarios("doseAmount", doseAmountValues);
combinedScenarios = add(doseScenarios, "cartesian", scanScenarios);
% Inspect scenarios:
generate(combinedScenarios)
% Create a simulation function for the model
simFun = createSimFunction(modelObj, combinedScenarios, "x", [], "AutoAccelerate", false);
% Simulate the model for every dosing scenario
simData = simFun(scenarios, 100);
% Plot the results
sbioplot(simData);
With the two repeat doses, you can also use the "Run Scan" program in the SimBiology Model Analyzer app to do the parameter scan over the dose amounts.
I hope this helps.
Best,
-Florian
More Answers (0)
See Also
Categories
Find more on Scan Parameter Ranges in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!