Estimating parameter uncertainty with fminsearch
Show older comments
I have four sets of data that I would like to fit to four lines, but with certain constraints (e.g. the four lines should all have the same slope, etc.). Some of the data sets overlap in x, but not y, i.e. they can't be fit to a single function. Currently I'm fitting all four simultaneously by calculating the sum of squares for each set/line, adding them up, and using fminsearch on the total sum of squares function. It works well, but fminsearch does not return any uncertainty on the fit parameters. Is there a way to either calculate the uncertainty on the parameters returned by fminsearch, or do this fit (with the constraints) without using fminsearch?
I found this post that seems to suggest I can use the Hessian of my sum of squares function: https://stackoverflow.com/questions/38175179/uncertainties-errors-for-non-continuous-minimizer-in-octave However, I'm not very well-versed in statistics and couldn't quite understand whether this is the right approach. Any help is appreciated! Thanks in advance!
2 Comments
John D'Errico
on 7 Aug 2020
Is all you are trying to do is fit a model with a single common slope, but where the intercept term varies for each subset of data?
If so, then using fminsearch is wildly the wrong thing to do for many reasons. But I'm not positive of that, because I wonder if that is really the entire problem. Your description is too vague to be sure here.
If I am correct, then it is also true that computing what you need is also very easy, even arguably for the parameter uncertainty.
Other questions remain however. Even if all that is true, what toolboxes do you have? Two that would be pertinent in this respect would be the stats tool box and the curve fitting toolbox.
Accepted Answer
More Answers (0)
Categories
Find more on Get Started with Curve Fitting Toolbox 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!
