How do I fit PK models to multiple dose datasets using simbiology, specifically using the command line (sbiofit)?

6 views (last 30 days)
I can fit to individual dose data using pooled fiting or mixed effects no problem. However, for some compounds I have multiple doses and I wish to fit to these simultaneously to obtain a single parameter set.
%% PREPARE MODEL
gData = groupedData(data);
gData.Properties.IndependentVariableName = 'Var1';
gData.Properties.GroupVariableName = 'Var3';
gData.Properties.VariableUnits = {'hour','nanogram/milliliter','',''};
gData.Properties;
% One-Compartment Extravascular
pkmd = PKModelDesign;
pkc1 = addCompartment(pkmd,'Central');
pkc1.DosingType = 'FirstOrder';
pkc1.EliminationType = 'linear-clearance';
pkc1.HasResponseVariable = true;
model = construct(pkmd);
configset = getconfigset(model);
configset.CompileOptions.UnitConversion = true;
% Single dose
dose = sbiodose('dose');
dose.TargetName = 'Dose_Central';
dose.StartTime = 0;
dose.Amount = 75;
dose.AmountUnits = 'milligram';
dose.TimeUnits = 'hour';
responseMap = {'Drug_Central = Var2'};
% Use NCA parameter estimates as initial parameter guess
NCA.Central = mean(ncaparameters.V_z,'omitnan');
NCA.CL = mean(ncaparameters.CL,'omitnan');
NCA.ka = 1;
paramsToEstimate = {'log(Central)','log(Cl_Central)','log(ka_Central)'};
% estimatedParams = estimatedInfo(paramsToEstimate,'InitialValue',[5e-4 1e-6 1],'Bounds',[1 5;0.5 2; 1e-3 10]);
estimatedParams = estimatedInfo(paramsToEstimate,'InitialValue',[NCA.Central NCA.CL NCA.ka]);
% Fit [Individual, Pooled, Mixed Effects]
fitConst = sbiofit(model,gData,responseMap,estimatedParams,dose);
pooledFit = sbiofit(model,gData,responseMap,estimatedParams,dose,'Pooled',true);
Here is my code for 1 dose. The multiple dose data is in a table similar to the tutorial for phenobarbital, where the next dose and corresponding data follows the previous dose.
I wish to do this using PK models and the sbiofit or similar commands that utilise simbiology. Please can someone shed some light on this?
Cheers

Accepted Answer

Jeremy Huard
Jeremy Huard on 22 Jul 2022
Hi Ross,
if the dosing information is included in your dataset (table), then you will be doing pretty much what is done in the Phenobarbital example, except that you will use sbiofit instead of sbiofitmixed.
The difference with the code snippet you shared lies in how the dosing schedule is defined:
  • In your code snippet you define a dose object and specify its scheduling. Then, you pass it to sbiofit, which implies that all groups will be simulated with the same dosing schedule.
  • For multiple doses, you can (a) define multiple dosing schedules and provide a column vector of doses to sbiofit (one row per group) if dosing is not defined in the dataset, or (b) extract the dosing information from the dataset with createDoses and pass the resulting array of doses to sbiofit.
  • In the Phenobarbital example this is done with:
sampleDose = sbiodose('sample', 'TargetName', 'Drug_Central');
doses = createDoses(data, 'DOSE', '', sampleDose);
  • Doses are created with information extracted from the DOSE column in the dataset and sampleDose is used as a dose template to define the dose target.
I can also highly recommend to set up the fit in the Model Analyzer App and then, use the View Program Code functionality to generate the code from this program. Then, you can copy/paste what you need instead of typing everyting from scratch.
Best regards,
Jérémy
  3 Comments

Sign in to comment.

More Answers (0)

Communities

More Answers in the  SimBiology Community

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!

Translated by