How can I get confidence intervals in matlab using fmincon?

12 次查看(过去 30 天)
I have a model that is a series of ODEs with parameters. My question is, how could I determine the confidence intervals of my parameters using the fmincon function which allows me to put bounds on my parameters? If I cannot use fmincon to do this, is there another function or program I can use that will do this? I have seen the ci=nlparci function but I am not sure if I can use that for what I am doing.
Thanks!
  4 个评论
Sean Quinn
Sean Quinn 2017-7-6
I am trying to estimate a group of parameters from the equations. The output of the model is given in my objective function as well as the data and I am using a least squares approach. I have used fmincon to minimize the objective function and determine the parameters I choose to estimate (represented as p in the equations). The code is below for the ODEs.
function xdot = SteppingModel2(~, x, p)
xdot(1) = -p(1)*x(1)*x(2) - p(2)*x(1)*x(2) + p(3)*x(3) + p(4)*x(4);
xdot(2) = -p(1)*x(1)*x(2) - p(2)*x(1)*x(2) + p(3)*x(3) + p(4)*x(4);
xdot(3) = p(1)*x(1)*x(2) - p(3)*x(3) - p(5)*x(3);
xdot(4) = p(2)*x(1)*x(2) - p(4)*x(4) - p(6)*x(4);
xdot(5) = p(5)*x(3) + p(6)*x(4) + p(7)*x(6) + p(8)*x(7);
xdot(6) = p(5)*x(3) - p(7)*x(6);
xdot(7) = p(6)*x(4) - p(8)*x(7);
xdot(8) = p(7)*x(6);
xdot(9) = p(8)*x(7);
xdot = xdot';
george hargenrader
george hargenrader 2020-11-11
Hi Sean Quinn
Did you ever figure this out? I am having the same problem where I don't know how to get confidence intervals for my fitted parameters from a set of ODEs using solve which is choosing to use fmincon.

请先登录,再进行评论。

回答(1 个)

John D'Errico
John D'Errico 2020-11-11
@george hargenrader, as well as @Sean Quinn, but probably too late for the OP...
You are using fmincon because there are constraints. If there are no constraints, then why use the wrong tool? However, those constraints would invalidate the assumptions necessary to produce confidence intervals using the standard methods, at least if one or more of the constraints are active. This is the case for inequality constraints, which would include bound constraints. (If there were equality constraints, at least linear equality constraints among the parameters and nothing else, there would be things you could do by reducing the model, projecting into a subspace. But any active inequality constraints blow anything you would do using traditional methods out of the water.
And no. You CANNOT use nlparci.
Is there anything you could do? Well, jackknife & bootstrapping methods are avavilable for problems like this, at least if you have the stats toolbox. You will find the function bootstrp in there.
  3 个评论
george hargenrader
george hargenrader 2020-11-11
So I think I understand the idea of bootstrating a little better. If I understand this correctly then to obtain confidence intervals for my fitted rate constants what I need to do is:
1) randomly sample my dataset with replacement
2) fit that randomly selected dataset
3) record the fitted rate constant
4) repeat steps 1-3 many times until I get a distibution of fitted rate constants
5) determin the 2.5 and 97.5 percential of my rate constants, which tells me the 95% confidence interval.
Is that correct?
John D'Errico
John D'Errico 2020-11-12
If the only reason for using fmincon was to apply bound constraints, then lsqnonlin would be a better choice.
I'd just use bootstrp, rather than writing code, but based on my memory from long ago, that sounds reasonable.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by