What is it?

The coefficient of determination, or , is a statistical measure that provides the goodness of fit of a statistical model. It’s most commonly used with Linear Regression models, both in Statistics and Machine Learning.

It takes a value of , with being a model that does not explain any Variance of the predicted variable, and being a model that explains all Variance.

Beware the bias

Even though a model can have a good score, it can still be overly biased. Remember that does not account for bias (or Overfitting).


Calculating R squared

To calculate , one need to already have developed the model, once it uses the residual of the predictions. Given as the residual sum of squares, and as the total sum of squares, one can calculate using:

Which will result in a percentage, with range .

Variables in R^2

The normal takes only two variables. If more are used in the model, then consider using Adjusted R Squared.