Can I obtain the coefficient of determination from the ROBUSTFIT function in the Statistics Toolbox?
1 view (last 30 days)
Show older comments
I want the ROBUSTFIT function to return the coefficient of determination, usually denoted by "r^2", for the fit.
Accepted Answer
MathWorks Support Team
on 27 Jun 2009
The ability to automatically return the coefficient of determination for the fit when using the ROBUSTFIT function is not available in the Statistics Toolbox.
If you have the Curve Fitting Toolbox, you can turn the "Robust" option to "on" with a linear polynomial fit to perform the same fit and obtain the coefficient of determination. Consider the following example:
x = (1:10)';
y = 10 - 2*x + randn(10,1);
fit_opts = fitoptions('Method', 'LinearLeastSquares', 'Robust', 'on');
[fit_result, goodness, output] = fit(x, y, 'poly1', fit_opts)
0 Comments
More Answers (0)
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!