Skip to main content
1 of 2
Hossein
  • 3.5k
  • 4
  • 20
  • 36

Problem in accepting R-squared (coefficient of determination) as a perfect measure of goodness of fit

R-squared (coefficient of determination) is usually used to assess the goodness of fit of a regression model to the data. Here, I provide two simple datasets that I think their best-fit lines are equally good, but they got two different r-squared values.

x1 = [1,2,3]
y1 = [1,2,3.5]
x2 = [1,2,3]
y2 = [2,4,6.5]

The best fit line to x1,y1 got r2=0.9868, and the best fit line to x2,y2 got r2=0.9959. While the r-squared values are different for these two best-fit lines, the residuals for different points are exactly the same for them: [-0.083,0.167,-0.083]. I think these two lines are equally good in fitting their respective data, while they get different r-squared values. What is wrong with my intuition about coefficient of determination.

Hossein
  • 3.5k
  • 4
  • 20
  • 36