R squared for quadratic fitting

Hello,

I noticed that R squared seems to be only available for linear fitting, does anyone know how to get R squared for a quadratic fitting? Thank you very much!

 

Best,
Chu

Hi Chu,

R squared is not valid for nonlinear fitting models. Its not that long ago that I also briefly dealt with this question and I found a few references that might help:

  • Spiess A-N, Neumeyer N. An evaluation of R2 as an inadequate measure for nonlinear models in pharmacological and biochemical research: a Monte Carlo approach. BMC Pharmacology 2010;10(1):6.
  • Kvalseth TO. Cautionary Note about R2. The American Statistician 1985;39(4):279–285.
  • R-squared Is Not Valid for Nonlinear Regression. Statistics By Jim. http://statisticsbyjim.com/regression/r-squared-invalid-nonlinear-regression/ (2017, accessed August 17, 2019).

Greetings,

Klaus

Hi,

I have previously investigated this topic and one aspect to appreciate is that in a polynomial model from a statistical perspective is not non-linear. The argument being is that what is being fitted is the coefficients and if they do not combine in a term then the equation is linear.  The key insight is to focus on the coefficients not the independent parameters.

Y = K0 + K1X + K2Xis linear in the K terms though non-linear in X which is what the scientist is focused on.

Y= K0 + K1X + K0K1X2 would be considered non-linear from statistical perspective fitting the K terms.

That said there are still concerns with R metric but it could be available.  As a side note: JMP statistical package from SAS does return an R statistic from a polynomial fit.

Andy

 

My take also is that R^2 is also a metric to compare the confidence we can have that data follows one linear model versus the data following a different linear model. The worst abuse that I see most frequently is not when folks use R^2 as a metric fitting non-linear models to data. Rather, the worst abuse is when folks claim that a high value of R^2 in a straight line fit to a set of measured data validates their linear model as the right fit to the data. I shudder every time I see this approach.

While a quadratic is "linear in the coefficients", which makes the fitting process linear, the function itself is nonlinear, and that's what's important to r^2.

Even fitting a line with the constraint that it pass through zero causes problems with r^2.