How can calculate R-Square using lsqcurvefit

조회 수: 24 (최근 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 CenterFile Exchange에서 Nonlinear Optimization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by