How can calculate R-Square using lsqcurvefit

23 visualizaciones (últimos 30 días)
Alain Gil Del Val
Alain Gil Del Val el 28 de Abr. de 2020
Comentada: Star Strider el 11 de Mayo de 2023
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

Respuestas (1)

Star Strider
Star Strider el 28 de Abr. de 2020
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 comentarios
Ha Yin LEE
Ha Yin LEE el 11 de Mayo de 2023
Plain and straightforward. Thanks a lot
Star Strider
Star Strider el 11 de Mayo de 2023
@Ha Yin LEE — My pleasure!

Iniciar sesión para comentar.

Categorías

Más información sobre Nonlinear Optimization en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by