R2 score can be negative. Then how is R2 square of correlation coefficient?

  • 3
    $\begingroup$ That is because there is more than a single definition for $R^2$. Check the Wikipedia entry. $\endgroup$ – Ami Tavory Dec 1 '17 at 11:23

$R^2$ can only be negative if your model (erroneously) doesn't include an intercept, or if you're computing it on a data set independent to the data that the model was estimated on, and the model doesn't generalize well to that new data set.

A correlation coefficient, between two variables $(x,y)$, basically describes the goodness-of-fit of a simple linear model, consisting of a single predictor ($x$) and an intercept. The way the correlation coefficient is computed is equivalent to fitting this linear model to some data, and computing its goodness-of-fit on the same data. Therefore, the correlation coefficient does not meet either of the criteria above, and thus $R^2$ values derived from correlation coefficients are positive by definition.

Another way to see this is that at worst, a correlation coefficient can be 0, which means the univariate linear model implied in the correlation analysis explains no variance. Explaining no variance is equivalent to an $R^2$ of 0. But it is impossible for the correlation model to explain negative variance, i.e. to perform worse than the sample mean, since the correlation model includes the sample mean through its intercept.

For a correlation analysis, $R^2$ can be computed as the square of the correlation coefficient, and will then behave as described above. But as Ami Tavory pointed out, $R^2$ has other definitions, and in general, can be computed for any model, not just correlations. In those cases, one of the scenarios may occur that I described at the beginning, and then $R^2$ can be negative.


It is probably because you are looking at an adjusted R-squared, not the R-squared itself. You can find definition and a formula here: https://en.wikipedia.org/wiki/Coefficient_of_determination#Adjusted_R2

The idea is that R-squared will always increase in you include more variables in your model, even if the new variables you include do not have any real predictive power. The adjusted R-squared is a way to try to make a correction to that effect, and a side-effect of the correction is that it sometimes gives a negative value.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.