Coefficient of determination (r²)

By Jude Wallis · Published

The coefficient of determination, r-squared, is the fraction of the variation in the response variable that the regression line explains, from 0 to 1.

r2r^2 (read r squared) is the proportion of the variation in the response variable yy that is explained by the linear relationship with the explanatory variable xx. Equivalently, it measures how much of the squared prediction error is removed by using the least-squares line instead of predicting yˉ\bar{y} for everyone:

r2=1sum of squared residualssum of squared deviations of y from yˉr^2 = 1 - \frac{\text{sum of squared residuals}}{\text{sum of squared deviations of } y \text{ from } \bar{y}}

Six students study 1, 2, 3, 4, 5 and 6 hours and score 60, 72, 65, 78, 71 and 86. The least-squares line is y^=58+4x\hat{y} = 58 + 4x. The scores have mean 72, and their squared deviations from 72 sum to 426. The line leaves residuals of -2, 6, -5, 4, -7 and 4, whose squares sum to 146. So r2=1146/426=0.657r^2 = 1 - 146 / 426 = 0.657: about 66 percent of the variation in scores is explained by the linear relationship with study time, and the other 34 percent is not.

The correlation for these data is r=0.8107r = 0.8107, and squaring it returns the same 0.657, which is where the name comes from. Squaring also throws away the sign, so a data set with r=0.8107r = -0.8107 would report the identical r2=0.657r^2 = 0.657. The statistic reports strength of linear fit and never direction, so quote rr alongside it whenever direction matters.

What 66 percent does not mean: that 66 percent of the points lie on the line, that study time causes 66 percent of the score, or that predictions from the line are 66 percent accurate. It is a statement about variation and about nothing else.

An r2r^2 close to 1 also does not confirm that a line was the right model. A curved relationship can still produce a high r2r^2 while the residual plot shows an obvious arc, and it is that plot, not the size of r2r^2, that decides whether a linear model belongs on the data. r2r^2 is also unitless, which makes it easy to compare across settings but useless for saying how wrong a single prediction is likely to be. The standard deviation of the residuals answers that second question, in the units of yy, and the two statistics are usually reported together.

Where this comes up

More regression and correlation terms, or browse the full statistics glossary.