How does the fit function apply the robust method and user defined weights?
1 view (last 30 days)
Show older comments
I want to know how exactly the fit function works. Specifically when the robust option and weights are given. If given some data y measured x with errors, yerr. We can do a robust weighted fit ...
options=fitoptions('poly2');
set(options, 'Robust', 'on');
set(options, 'Weights',yerr);
[best, best2]=fit(x,y, 'poly1', options);
But we could also apply the user defined weights to the data before doing the robust fitting and then do the fitting to get the same results.
options=fitoptions('poly2');
set(options, 'Robust', 'on');
[best, best2]=fit(x.*yerr,y.*yerr, 'poly1', options);
Sadly I don't, this is because I don't understand how the weights are applied when matlab does the robust fitting option.
Hope you can help
0 Comments
Answers (0)
See Also
Categories
Find more on Linear and Nonlinear Regression in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!