Nonlinear regression of multiple datasets with different functions but wit some shared parameters between datasets

2 views (last 30 days)
Apologies since I am new to Matlab.
I have a model describing a drug-receptor system with multiple parameters. There are two different observables (binding , activity) for each drug. (I have separate but related equations for predicting the observables). The model has four parameters per drug and four system parameters that are shared for all drugs. I have datasets with a variable number of replicates for each observable (3 binding curves and one response curve per drug). I have data for 12 different drugs. I would appreciate some help setting up global nonlinear regression for all datasets to obtain best estimates of the drug specific and system specific (shared) parameters and their associated 95% confidence intervals. A general example that can handle this type of situation would be helpful to get me started.
  17 Comments
Torsten
Torsten on 16 Jun 2025
It seems that simbiology is not well suited for this type of problem.
As pointed out already: I think the problem is different - the model is not well-suited for your data.
Arthur Goldsipe
Arthur Goldsipe on 16 Jun 2025
@Torsten the issue with long format looks like it might be specific to the display here in MATLAB Anwers. I'll report this to the appropriate developers.
@Jorge thanks for sharing the sample equation and data. It looks like this kind of probelm should be quite easy to implement in SimBiology. It will take me some time to create an example, due to other work obligations. But I hope to share an example in the next day or so.

Sign in to comment.

Accepted Answer

Matt J
Matt J on 11 Jun 2025
Edited: Matt J on 11 Jun 2025
You would probably need to use lsqcurvefit. There is nothing about having multiple data sets, following different functions, that changes the approach to its use. The form of their dependence on the unknown variables and how they are shared is also irrelevant. You just provide a model function F(x,xdata) like in the examples which returns a matrix of your predicted values. The only requirement is that the matrix of predicted values that F(x,xdata) generates has the same size as your matrix of measurements ydata..
Confidence interval post-analysis is not something Matlab has any direct tools for when it comes to regression of vector-valued measurements. However, lsqcurvefit will give you the Jacobian at the solution,
so you can implement confidence interval calculations based on that.
  3 Comments

Sign in to comment.

More Answers (1)

Arthur Goldsipe
Arthur Goldsipe on 16 Jun 2025
Edited: Arthur Goldsipe on 16 Jun 2025
I've attached a SimBiology project (created in R2024b) that illustrates how to set up this sort of problem in SimBiology. If you're not familiar with MATLAB, then it will probably be easiest to build the model in the SimBiology Model Builder app and then fit the data in the SimBiology Model Analyzer app and then calculate 95% Gaussian confidence intervals on parameter estimates and predictions. Just open this project file in the apps to view the model and the fit program.
But since it's easier to illustrate the capabilities here via the command line, here's how you could do the work programmatically.
If you don't want to use the same parameter estimate for each dose, then you just need to add a variable to your data that says which observations use the same esimate, and then update CategoryVariableName to that variable. For example, setting the value to D would result in a different parameter estimate for each unique value of D.
Construct the model
model = sbiomodel("Binding");
addspecies(model, "D", Constant=true);
addparameter(model, "Bmax", 1);
addparameter(model, "Kd", 1);
addspecies(model, "B");
addrule(model, "B - Bmax*D/(D+Kd)", "algebraic");
Construct the data
The data needs to be reformatted for us in SimBiology:
  • Add a time variable (the value is arbitrary, since there are no dynamics).
  • Add a grouping variable that gives a unique identifier to each distinct condition we need to simulate (in this case, each dose amount).
  • Stack all measurements of the same state (B) into a single column.
rawDataMatrix = [
1.00E-10 17 22 19
3.16E-10 50 53 64
1.00E-09 146 146 123
3.16E-09 301 276 328
1.00E-08 329 487 412
3.16E-08 372 416 552
1.00E-07 566 527 493
3.16E-07 414 451 481 ];
tableData = array2table(rawDataMatrix, VariableNames=["D", "B1", "B2", "B3"]);
tableData.Time(:) = 1;
tableData.ID = (1:height(rawDataMatrix))';
tableData = stack(tableData, ["B1", "B2", "B3"], ...
NewDataVariableName="B", IndexVariableName="ReplicateID")
tableData = 24×5 table
D Time ID ReplicateID B ________ ____ __ ___________ ___ 1e-10 1 1 B1 17 1e-10 1 1 B2 22 1e-10 1 1 B3 19 3.16e-10 1 2 B1 50 3.16e-10 1 2 B2 53 3.16e-10 1 2 B3 64 1e-09 1 3 B1 146 1e-09 1 3 B2 146 1e-09 1 3 B3 123 3.16e-09 1 4 B1 301 3.16e-09 1 4 B2 276 3.16e-09 1 4 B3 328 1e-08 1 5 B1 329 1e-08 1 5 B2 487 1e-08 1 5 B3 412 3.16e-08 1 6 B1 372
Set up and run the fit problem
prob = fitproblem;
prob.Data = tableData;
prob.Model = model;
prob.Estimated = estimatedInfo( ...
["log(Kd)", "log(Bmax)"], ...
Bounds=[1e-20 0.1; 0.1 1e3], ...
CategoryVariableName=["<None>", "<None>"]);
prob.ResponseMap = "B = B";
prob.Variants = createVariants(prob.Data, "D", Model=model);
prob.ProgressPlot = true;
prob.FunctionName = "scattersearch";
results = fit(prob);
plot(results);
results.ParameterEstimates
ans = 16×7 table
Name Estimate StandardError Bounds Group CategoryVariableName CategoryValue ________ __________ _____________ ______________ _____ ____________________ _____________ {'Kd' } 2.2211e-09 3.9834e-10 1e-20 0.1 1 {'<None>'} <None> {'Bmax'} 492.58 16.912 0.1 1000 1 {'<None>'} <None> {'Kd' } 2.2211e-09 3.9834e-10 1e-20 0.1 2 {'<None>'} <None> {'Bmax'} 492.58 16.912 0.1 1000 2 {'<None>'} <None> {'Kd' } 2.2211e-09 3.9834e-10 1e-20 0.1 3 {'<None>'} <None> {'Bmax'} 492.58 16.912 0.1 1000 3 {'<None>'} <None> {'Kd' } 2.2211e-09 3.9834e-10 1e-20 0.1 4 {'<None>'} <None> {'Bmax'} 492.58 16.912 0.1 1000 4 {'<None>'} <None> {'Kd' } 2.2211e-09 3.9834e-10 1e-20 0.1 5 {'<None>'} <None> {'Bmax'} 492.58 16.912 0.1 1000 5 {'<None>'} <None> {'Kd' } 2.2211e-09 3.9834e-10 1e-20 0.1 6 {'<None>'} <None> {'Bmax'} 492.58 16.912 0.1 1000 6 {'<None>'} <None> {'Kd' } 2.2211e-09 3.9834e-10 1e-20 0.1 7 {'<None>'} <None> {'Bmax'} 492.58 16.912 0.1 1000 7 {'<None>'} <None> {'Kd' } 2.2211e-09 3.9834e-10 1e-20 0.1 8 {'<None>'} <None> {'Bmax'} 492.58 16.912 0.1 1000 8 {'<None>'} <None>
Calculate confidence intervals
ciParam = sbioparameterci(results);
plot(ciParam);
ciPred = sbiopredictionci(results);
plot(ciPred);
  1 Comment
Jorge
Jorge on 17 Jun 2025
Fantastic!
Thank you very much! I see now how to proceed.
I will have to learn a bit more about Simbiology plotting otions to visualize the data, but this is what I needed.
Thank you!

Sign in to comment.

Categories

Find more on Scan Parameter Ranges in Help Center and File Exchange

Products


Release

R2024b

Community Treasure Hunt

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

Start Hunting!