standard deviation of parameters in lsqcurvefit?
35 views (last 30 days)
Show older comments
1-Is there a way to get the standard deviation or any measure of error for the optimized parameters when using lsqcurvefit?
2-can someone tell me how to get the error surface( it could one multi-dimensional depending on the number of parameters you're optimizing) in lsqcurvefit? saying it differently the amount of error in each step it is going through along with the value of parameters at that step.
I've attached a simple example of lsqcurvefit. can you show me the standard deviation on that if possible.
Thanks
0 Comments
Accepted Answer
Star Strider
on 19 Sep 2014
3 Comments
Star Strider
on 24 Sep 2014
The nlparci function will provide those for you, although instead of presenting them as, for instance, 5±0.2, it will present them as [4.8 5.2]. But it will give you the information you want about them.
For lsqcurvefit, you have to request all the outputs, in this syntax:
[beta,resnorm,resid,exitflag,output,lambda,J] = lsqcurvefit(...)
and then to get the confidence intervals from nlinfit, use this syntax for it:
ci = nlparci(beta,resid,'jacobian',J)
The output ‘ci’ are the confidence intervals for each parameter in the sequence you have presented them to nlparci in the ‘beta’ vector.
Benjamin
on 25 Mar 2021
Correct. So in other words,
Standard deviation = SD = (ci(2) - beta)/2
Because nlparci gives the 95% confidence interval which is (+/-)2*SD.
More Answers (1)
Matt J
on 19 Sep 2014
Edited: Matt J
on 19 Sep 2014
1. You could compute parameter covariance estimates from the output Jacobian and residuals,
[x,resnorm,residual,exitflag,output,lambda,J]= lsqcurvefit(...)
xCovariance = inv(J.'*J)*var(residual)
2. Wasn't entirely clear to me what you're asking for, but it sounds like you want to use the PlotFcns input option with @optimplotresnorm.
0 Comments
See Also
Categories
Find more on Interpolation 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!