Solved – Why does matlab show r squared for non-linear

curve fittingMATLAB

Inspired by the comments here https://stackoverflow.com/questions/27288483/python-multiple-curve-fitting-models

In matlab, why is the R squared value displayed if it is meaningless for non-linear equations?

Is there a different use for it than those comments suggest?

This is the comment:

R.sq is meaningless for non-linear models. For linear models, R.sq is
the fraction of variability explained by the model. For non-linear
models this is not the case. Within a family (say, polynomials),
models with more parameters will always produce larger R.sq, so this
metric is useless to assess goodness of fit

Best Answer

$R^2$ is a good measure of explained variance in both linear and nonlinear models. It has its issues, such as not being between 0 and 1, but it's still useful.

A minor problem can arise in evaluating the fit of the regression in that the familiar measure, $R^2 = 1 − \frac{\sum_{i=1}^ne^2_i}{\sum_{i=1}^n(y_i-\bar{y})^2}$ , (7-17) is no longer guaranteed to be in the range of 0 to 1. It does, however, provide a useful descriptive measure.

Greene,William H., Econometric analysis, 7th ed., 2012