Quick start

First, let's grab some real clinical data collected in the study, Laleh et al. (2022) "Classical mathematical models for prediction of response to chemotherapy and immunotherapy", PLOS Computational Biology":

using TumorGrowth

records = patient_data();
record = records[16]   # storing all measurements for one lesion
keys(record)
(:Pt_hashID, :Study_Arm, :Study_id, :Arm_id, :T_weeks, :T_days, :Lesion_diam, :Lesion_vol, :Lesion_normvol, :response, :readings)

Next, we calibrate the General Bertalanffy model using this particular patient record:

times = record.T_weeks
volumes = record.Lesion_normvol  # volumes normalized by max over dataset

problem = CalibrationProblem(times, volumes, bertalanffy)
solve!(problem, 2000)  # apply 2000 iterations of the calibration algorithm
p = solution(problem)
pretty(p)
"v0=0.0103  v∞=0.00609  ω=0.141  λ=0.114"

For advanced options, see CalibrationProblem or the Calibration workflows extended example.

We can visualize the outcome and make predictions for an extended time period:

using Plots
plot(problem)

extended_times = vcat(times, [46.0, 53.1])
bertalanffy(extended_times, p)
11-element Vector{Float64}:
 0.010256085678952396
 0.007674823296423271
 0.0067335824768277285
 0.0063615647961514305
 0.006192294079198997
 0.006142130249558573
 0.006117447950274238
 0.006103706497416394
 0.006097809709389035
 0.006098481127543786
 0.006095250529578092

And compare several models on a holdout set:

comparison = compare(times, volumes, [bertalanffy, logistic, bertalanffy2], holdouts=2)
ModelComparison with 2 holdouts:
  metric: mae
  bertalanffy: 	0.006516
  logistic: 	0.006485
  bertalanffy2: 	0.005364
plot(comparison)

See compare for more options.