Adding an Error Model to a Nonlinear Mixed Effects Model

1 次查看(过去 30 天)
Hello all,
First, I used SimBiology Model Builder to restore the PPK model that had been established in NONMEM. Since SimBiology Model Builder cannot add parameters for inter-individual variation and error models, I added them using code. But I found that the exponential error model has not been added to the model.
I would like to ask how to add the exponential error model to the following code and how to optimize the simulation process code? Thank you for your help!
opts = spreadsheetImportOptions("NumVariables", 3);
opts.Sheet = "Sheet1";
opts.DataRange = "A2:C237";
opts.VariableNames = ["ID", "TIME", "DV"];
opts.VariableTypes = ["double", "double", "double"];
Dose = readtable("Dose.xls", opts, "UseExcel", false)
data = groupedData(Dose);
sbiotrellis(data,@semilogy,"ID","TIME","DV",Marker="+",LineStyle="--");%%@semilogy
% Extract the model overall model file
s = sbioloadproject("Version-2-20241218.sbproj");
model = s.m1;
covModel = CovariateModel;
covModel.Expression = {'V1 = exp(theta1 + eta1)',' V2 = exp(theta2 + eta2)','F1 = exp(theta3 + eta3)','CL = exp(theta4 + eta4)'};
covModel.FixedEffectNames
covModel.FixedEffectDescription
options.ErrorModel = 'exponential';
options.ErrorModelParameters = struct('sigma', 1.0928)
thetas = table(4.0056,-20.3634,-7.9054,7.0873,'VariableNames',["theta1","theta2","theta3","theta4"])
omega = table([2.4432;0;0;0],[0;0.0534;0;0],[0;0;9.4391;0],[0;0;0;0.0729],'VariableNames',["eta1","eta2","eta3","eta4"])
phi = sbiosampleparameters(covModel.Expression,thetas,omega,Dose)
f = createSimFunction(model,covModel.ParameterNames,'Drug_Central',[])
simresults = f(phi,24)
t = sbiotrellis(simresults,[],'Time',' Drug_Central');
t.hFig.Position(3:4) = [800 500];
set(t.plots,'XGrid','on','YGrid','on');
set(t.plots,'YScale','log');
lh = findobj(t.plots,'Type','line');
set(lh,'LineWidth',2);

采纳的回答

Jeremy Huard
Jeremy Huard 2025-3-20
Assuming you want to add noise to the simulation data based on the exponential error model, you could use sbiosampleerror:
noisysimresults = sbiosampleerror(simresults, 'exponential', 1.0928);

更多回答(0 个)

社区

更多回答在  SimBiology Community

类别

Help CenterFile Exchange 中查找有关 Import Data 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by