# range of coefficient of determination R^2 (can be negative?)

According to wikipedia, the coefficient of determination is

$$R^2 = 1 - \sum_i{\frac{(y_i - f_i)^2}{(y_i - \bar{y})^2}}$$

where $y_i$ is the $i^{th}$ sample value, $f_i$ is the model predicted value and $\bar{y}$ is the mean value.

I can imagine a simple case with two sample points where the coefficient of determination will be negative. Basically, the problem comes when the regression line is really bad, predicting the regression line as negative of the correlation. But in the places I've read about it, they say that it's range is [0,1]. Can anyone explain?

• Note that the wikipedia page doesn't actually say that $R^2$ is always in [0, 1], just that it's in it in a particular type of case. In the "interpretation" section, it clearly says that values <0 and >1 are possible. – naught101 Apr 21 '13 at 13:23
• Removed irrelevant tag for coefficient of variation and added R-squared tag. – Nick Cox Jan 8 '18 at 12:19

Negative values of $R^2$ may occur when fitting non-linear functions to data.