How can calculate R-Square using lsqcurvefit
24 次查看(过去 30 天)
显示 更早的评论
Dear Sir/Madam,
I would appreciate how can calculate R-Square using lsqcurvefit or how can calculate this parameter between the real profile and adjusted profiles.
Thanks
Regards
0 个评论
回答(1 个)
Star Strider
2020-4-28
You have to calculate it yourself, however the calculation (for vector independent and vector dependent variables) is straightforward:
SStot = sum((y-mean(y)).^2); % Total Sum-Of-Squares
SSres = sum((y(:)-yfit(:)).^2); % Residual Sum-Of-Squares
Rsq = 1-SSres/SStot; % R^2
Here, ‘y’ is the dependent variable, and ‘yfit’ is the fitted value of the dependent variable from the regression.
3 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Nonlinear Optimization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!