My understanding is that $R^2$ cannot be negative as it is the square of R. However I ran a simple linear regression in SPSS with a single independent variable and a dependent variable. My SPSS output give me a negative value for $R^2$. If I was to calculate this by hand from R then $R^2$ would be positive. What has SPSS done to calculate this as negative?

R squared =-.156
B (un-standardized)=-1261.611

Code I've used:

           /CRITERIA=PIN(.05) POUT(.10) /NOORIGIN 
           /DEPENDENT valueP /METHOD=ENTER ageP

I get a negative value. Can anyone explain what this means?

Negative RSquared

enter image description here

  • 3
    $\begingroup$ Does this answer your question? stats.stackexchange.com/questions/6181/… If not, then please provide more information: this is the "SPSS output" of what procedure? $\endgroup$
    – whuber
    Commented Jul 11, 2011 at 17:14
  • 4
    $\begingroup$ Does your linear regression model have an intercept? $\endgroup$
    – NPE
    Commented Jul 11, 2011 at 17:59
  • 3
    $\begingroup$ @Anne Again, which SPSS procedure are you using? $\endgroup$
    – whuber
    Commented Jul 11, 2011 at 18:19
  • 2
    $\begingroup$ @Anne I suggest you disregard the time series reply, because your data are not time series and you're not using a time series procedure. Are you really sure the R squared is given as a negative value? Its magnitude is correct: $(-0.395)^2=0.156$. I have looked through SPSS help to see whether perhaps as a convention the R-squared value for negative R's is negated, but I don't see any evidence that this is the case. Perhaps you could post a screen shot of the output where you are reading the R-squared? $\endgroup$
    – whuber
    Commented Jul 11, 2011 at 20:26
  • 2
    $\begingroup$ @Anne There's nothing the matter with large standard errors: they merely reflect the units in which the dependent variable is measured. However, it is possible the strange results arise from numerical instabilities. Sometimes it helps to re-express the data in a way that reduces the potential effects of floating point error. In this case, the stats suggest you should compute y = (valueP - 100000)/1000 and try again to regress y against ageP. Do you still get a negative R square? $\endgroup$
    – whuber
    Commented Jul 18, 2011 at 12:41

4 Answers 4


$R^2$ compares the fit of the chosen model with that of a horizontal straight line (the null hypothesis). If the chosen model fits worse than a horizontal line, then $R^2$ is negative. Note that $R^2$ is not always the square of anything, so it can have a negative value without violating any rules of math. $R^2$ is negative only when the chosen model does not follow the trend of the data, so fits worse than a horizontal line.

Example: fit data to a linear regression model constrained so that the $Y$ intercept must equal $1500$.

enter image description here

The model makes no sense at all given these data. It is clearly the wrong model, perhaps chosen by accident.

The fit of the model (a straight line constrained to go through the point (0,1500)) is worse than the fit of a horizontal line. Thus the sum-of-squares from the model $(SS_\text{res})$ is larger than the sum-of-squares from the horizontal line $(SS_\text{tot})$.

If $R^2$ is computed as $1 - \frac{SS_\text{res}}{SS_\text{tot}}$. (here, $SS_{res}$ = residual error.)
When $SS_\text{res}$ is greater than $SS_\text{tot}$, that equation could compute a negative value for $R^2$, if the value of the coeficient is greater than 1.

With linear regression with no constraints, $R^2$ must be positive (or zero) and equals the square of the correlation coefficient, $r$. A negative $R^2$ is only possible with linear regression when either the intercept or the slope are constrained so that the "best-fit" line (given the constraint) fits worse than a horizontal line. With nonlinear regression, the $R^2$ can be negative whenever the best-fit model (given the chosen equation, and its constraints, if any) fits the data worse than a horizontal line.

Bottom line: a negative $R^2$ is not a mathematical impossibility or the sign of a computer bug. It simply means that the chosen model (with its constraints) fits the data really poorly.

  • 4
    $\begingroup$ @JMS That's the opposite of what my Googling indicates: "/ORIGIN" fixes the intercept at 0; "/NOORIGIN" "tells SPSS not to suppress the constant" (An Introductory Guide to SPSS for Windows) $\endgroup$
    – whuber
    Commented Jul 13, 2011 at 18:13
  • 21
    $\begingroup$ @whuber Correct. @harvey-motulsky A negative R^2 value is a mathematical impossibility (and suggests a computer bug) for regular OLS regression (with an intercept). This is what the 'REGRESSION' command does and what the original poster is asking about. Also, for OLS regression, R^2 is the squared correlation between the predicted and the observed values. Hence, it must be non-negative. For simple OLS regression with one predictor, this is equivalent to the squared correlation between the predictor and the dependent variable -- again, this must be non-negative. $\endgroup$
    – Wolfgang
    Commented Jul 14, 2011 at 7:17
  • 2
    $\begingroup$ @whuber Indeed. My bad; obviously I don't use SPSS - or read, apparently :) $\endgroup$
    – JMS
    Commented Jul 14, 2011 at 16:56
  • 2
    $\begingroup$ @whuber. I added a paragraph pointing out that with linear regression, R2 can be negative only when the intercept (or perhaps the slope) is constrained. With no constraints, the R2 must be positive and equals the square of r, the correlation coefficient. $\endgroup$ Commented Jul 16, 2011 at 15:55
  • 3
    $\begingroup$ @Nate. Yes, the null hypothesis of linear regression (with no constraints, and equal weighting of all points) is a straight line at Y = Mean $\endgroup$ Commented Dec 16, 2021 at 17:19

Have you forgotten to include an intercept in your regression? I'm not familiar with SPSS code, but on page 21 of Hayashi's Econometrics:

If the regressors do not include a constant but (as some regression software packages do) you nevertheless calculate $R^2$ by the formula


then the $R^2$ can be negative. This is because, without the benefit of an intercept, the regression could do worse than the sample mean in terms of tracking the dependent variable (i.e., the numerator could be greater than the denominator).

I'd check and make sure that SPSS is including an intercept in your regression.

  • 4
    $\begingroup$ NOORIGIN subcommand in her code tells that intercept was included in the model $\endgroup$
    – ttnphns
    Commented Jul 12, 2011 at 10:12
  • 2
    $\begingroup$ that's weird. I would have guessed that NOORIGIN would mean that intercept was not included in the model, just going off the name. $\endgroup$ Commented Nov 8, 2015 at 4:29

This can happen if you have a time series that is N.i.i.d. and you construct an inappropriate ARIMA model of the form(0,1,0) which is a first difference random walk model with no drift then the variance (sum of squares - SSE ) of the residuals will be larger than the variance (sum of squares SSO) of the original series. Thus the equation 1-SSE/SSO will yield a negative number as SSE execeedS SSO . We have seen this when users simply fit an assumed model or use inadequate procedures to identify/form an appropriate ARIMA structure. The larger message IS that a model can distort (much like a pair of bad glasses ) your vision. Without having access to your data I would otherwise have a problem in explaining your faulty results. Have you brought this to the attention of IBM ?

The idea of an assumed model being counter-productive has been echoed by Harvey Motulsky. Great post Harvey !

  • 1
    $\begingroup$ stat. Thanks. No I have not spoken to IBM. The data is not time series. It is from point in time data. $\endgroup$
    – Anne
    Commented Jul 11, 2011 at 19:55
  • 5
    $\begingroup$ @Anne and others: Since your data are not time series and you're not using a time series procedure please disregard my answer. Others who have observed negative R Squares when involved with time series might find my post interesting and tangentially informative. Others unfortunately may not. $\endgroup$
    – IrishStat
    Commented Jul 11, 2011 at 21:36
  • $\begingroup$ @IrishStat: Could you please add a link to the Harvey Motulsky post? $\endgroup$ Commented Aug 27, 2018 at 8:33
  • $\begingroup$ Harvey answered the question here. $\endgroup$
    – IrishStat
    Commented Aug 27, 2018 at 9:22

Here's an explanation for those from the ML field: a negative R squared means that the model is predicting worse than the mean of the target values ($\bar{y}$). In other words, the mean squared error (MSE) of the model is higher than the MSE of a dummy estimator using the mean of the target values as the prediction ($Rˆ2 = 1-\frac{MSE(y,f)}{MSE(y,\bar{y})}$).

As a curiosity, it can happen a counter-intuitive situation there's a high correlation between $y$ (target value) and $f$ (prediction), but still a negative r-squared. I'll demonstrate this using python below:

from sklearn.metrics import r2_score
from scipy.stats import pearsonr
import numpy as np

# True values
y = np.array([10, 20, 30, 50, 90])

# Predictions
f = np.array([20, 40, 60, 75, 135])

# Calculate r-squared
r2 = r2_score(y, f)
print('R-Squared:', r2)
# Output: -0.012

corr = pearsonr(y, f)[0]
print('Pearson Correlation:', corr)
# Output: 0.992

# Here's a way to interpret: r2 is equivalent to the following

mean_squared_error = lambda y, f: np.mean((y-f)**2)
r2_eq = 1-mean_squared_error(y, f)/mean_squared_error(y, [y.mean()]*len(y))
    'R-Squared (from equation):',
# Output: -0.0124

# Hence it is negative as MSE given f is higher than MSE given y.mean() as f

Which prints:

R-Squared: -0.012499999999999956
Pearson Correlation: 0.9929674489269135
R-Squared (from equation): -0.012499999999999956

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