How can calculate R-Square using lsqcurvefit

14 ビュー (過去 30 日間)
Alain Gil Del Val
Alain Gil Del Val 2020 年 4 月 28 日
コメント済み: Star Strider 2023 年 5 月 11 日
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

回答 (1 件)

Star Strider
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 件のコメント
Ha Yin LEE
Ha Yin LEE 2023 年 5 月 11 日
Plain and straightforward. Thanks a lot
Star Strider
Star Strider 2023 年 5 月 11 日
@Ha Yin LEE — My pleasure!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeNonlinear Optimization についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by