Issues in fitting a simple tumor growth model

Dear staff,
I'm learning how to implement a TGI model in Simbiology using a scripting approach. For that purpose I started to implement my model (based on the example tumor_growth_fitPKPD_completed.sbproj) just with a modified growth component and I'm trying to fit a dataset. Attached you can find the dataset (synth_data.mat) and the TGI script (test_code.m). As you can see the initial tumor mass of different patients varies quite a lot so I can't use a unique initialization for the variable w0. I would like to understand if (and how) it is possible to pass to the model the initial tumor mass for each ID, in order to avoid to fit this parameter.
Thank you very much for your help.

 Accepted Answer

You can use the Variants property of the fitproblem to specify initial conditions that are specific to each ID. Create one variant for each ID using sbiovariant. I can probably provide sample code later, but I don't have time right now.

7 Comments

I should also have mentioned that you can create the variants from the data using a function called createVariants. So you just need to add the following line to your code to initial the weight to the value of Mass at time=0 for each ID:
problem2.Variants = createVariants(gData, "Mass", Model=model, Names="w0");
Oh, I just realized the above code takes advantage of an improvement we made to createVariants for R2025a (namely, to use the value at time=0 when values vary over time). If you are using R2024b, you will have to extract the values at time=0:
problem2.Variants = createVariants(gData(gData.Time == 0,:), "Mass", Model=model, Names="w0");
Thank you very much indeed Arthur!
Gabriele
Gabriele on 21 Jun 2025
Edited: Gabriele on 23 Jun 2025
@Arthur Goldsipe I have a follow up question (I don't know if I should open another topic): I extended the model to incorporate dosing and efficacy and it seems to run smoothly when I run it in simulation mode.
However, the issue turns out when I want to fit the model. Indeed, even using the data generated by itself and just fitting one parameter it simply does not work. It seems that the drug effect (or dosing?) is not taken into account. I don't really understand where I'm wrong.
Thank you again for your help!
I don't see any obvious issues with how you're setting up the fit. I'll need to set aside some time to step through the code. Just to set your expectations appropriately, that might take me another day or so.
Dear @Arthur Goldsipe I just found which was the issue. The problem.Doses was not declared so the fitting routine was not taking into account any dose. I solved the problem providing problem.Doses = [dose1, dose2]. Thank you very much anyway for your help and your reactivity!
Ah, excellent. Glad you figured it out. If it's any consolation, I completely forgot to check whether you model had active doses. So I was pretty stumped by this myself, even after working on the SimBiology development team for many years.

Sign in to comment.

More Answers (0)

Communities

More Answers in the  SimBiology Community

Products

Release

R2024b

Tags

Community Treasure Hunt

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

Start Hunting!