How to assess to the simulation data after the parameter estimation in Simbiology

1 view (last 30 days)
Hello team,
I am using command line sbiofit to fit my simbiology model with my experimental data by parameter estimation.
In addition, after I got the fitting results, I know that I could simply plot the fitted results versus the original data by plot(fitResults);
However, I would like to access the simulated results of my best fit to carry out NCA, but I could not find the results in the SimBiology.fit.OptimResults.
Could you please show me a clue on how to get the piece of the simulated data?
Thank you very much.
Have a nice day.
Best,
Jesse

Accepted Answer

Arthur Goldsipe
Arthur Goldsipe on 19 Oct 2021
Hi Jesse,
You can get access to the SimData results used in the plot method by calling the fitted method (described here). If you want to simulate using the parameter estimates but different conditions (for example, different dosing) you can use the predict method (described here). In both cases, the first output will be a vector of SimData of the results.
-Arthur
  2 Comments
Jesse Chao
Jesse Chao on 20 Oct 2021
Edited: Jesse Chao on 20 Oct 2021
Hello Arthur,
Thank you very much, Arthur. I have successfully accessed the simulation data by using fitted method.
However, I could not successfully get the NCA results from the simulated data. I am not sure if I understood something wrong or there's a bug in my code. All the parameters I got from the NCA are all NaN...
Please find my code below. The first half of the codes are from MathWork website. The latter half of the codes are from myself.
Please have a look, and provide me with some feedback. Thank you very much.
Best,
Jesse
%% Code from MathWorks website (url: https://www.mathworks.com/help/simbio/ug/fit-individual-PK-profile-data-to-one-compartment-model.html)
% Load Data and Visualize
load('data15.mat')
plot(data.Time,data.Conc,'b+')
xlabel('Time (hour)');
ylabel('Drug Concentration (milligram/liter)');
% Convert to groupedData Format
gData = groupedData(data);
gData.Properties.VariableUnits = {'hour','milligram/liter'};
gData.Properties
% Construct a One-Compartment Model
pkmd = PKModelDesign;
pkc1 = addCompartment(pkmd,'Central');
pkc1.DosingType = 'Bolus';
pkc1.EliminationType = 'linear-clearance';
pkc1.HasResponseVariable = true;
model = construct(pkmd);
configset = getconfigset(model);
configset.CompileOptions.UnitConversion = true;
% Define Dosing
dose = sbiodose('dose');
dose.TargetName = 'Drug_Central';
dose.StartTime = 0;
dose.Amount = 10;
dose.AmountUnits = 'milligram';
dose.TimeUnits = 'hour';
% Map Response Data to the Corresponding Model Component
responseMap = {'Drug_Central = Conc'};
% Specify Parameters to Estimate
paramsToEstimate = {'log(Central)','log(Cl_Central)'};
estimatedParams = estimatedInfo(paramsToEstimate,'InitialValue',[1 1],'Bounds',[1 5;0.5 2]);
%Estimate Parameters
fitConst = sbiofit(model,gData,responseMap,estimatedParams,dose);
%% Obtain best fitted simulated data for NCA
% Simulation data organization
simData_struct = fitted(fitConst);
simData = array2table(simData_struct.Data);
simData_list = {'Drug_Central'};
simData.Properties.VariableNames = simData_list;
simTime = array2table(simData_struct.Time);
simTime.Properties.VariableNames = {'Time'};
datalength =length(simData_struct.Time);
simGroup = array2table(ones(datalength,1));
simGroup.Properties.VariableNames = {'Group'};
simDose = array2table(zeros(datalength,1));
simDose(1,1) = {dose.Amount};
simDose.Properties.VariableNames = {'Dose'};
simData_table = [simGroup simTime simData simDose];
% Convert to groupedData Format
gData_sim = groupedData(simData_table,'Group','Time');
gData_sim.Properties.VariableUnits = {'Group','hour','milligram/liter','milligram'};
% Categorize the data columns using an NCA options object.
opt = sbioncaoptions;
opt.groupColumnName = 'Group';
opt.concentrationColumnName = simData_list;
opt.timeColumnName = 'Time';
opt.IVDoseColumnName = 'Dose';
% Compute NCA parameters
ncaparameters = sbionca(gData_sim,opt)
Jeremy Huard
Jeremy Huard on 20 Oct 2021
@Jesse Chao Do you mind clicking on my profile and sending me an email so that I have your email address? We can then discuss this offline.

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

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!