Effect size · Statistics Library

R-squared

R-squared is the share of the variation in the outcome that a regression's fitted values account for, from 0 (none) to 1 (the model reproduces the data exactly). That 0-to-1 reading holds for an ordinary regression with an intercept, judged on the data it was fitted to.

Topic indexA reference reading outside the guided chapter sequence

Understand the idea

After fitting a regression, some of the outcome's variation is captured by the model's predictions and some is left over as unexplained residual variation. R-squared is simply the explained share of the total: an R-squared of 0.65 means the model accounts for 65% of the variation in the outcome, leaving 35% unexplained by the predictors included.

It is a convenient, intuitive single number, but it says nothing on its own about whether the model is CORRECTLY specified, whether individual coefficients are trustworthy, or whether the model will predict well on NEW data: a model can have a high R-squared on the data it was fit to and still be overfit, biased, or built on a violated assumption.

R-squared never decreases when you add more predictors to a model fitted to the same rows, even useless ones, which is why comparing models with different numbers of predictors needs adjusted R-squared, or a test on data the models were not fitted to, instead of plain R-squared.

R-squared is also called the coefficient of determination. R-squared is often described as the proportion of variance explained: the share of the spread in the outcome that the model accounts for. R-squared is written R^2 in formulas and software output.

Practitioner explanation

For ordinary least squares evaluated on the fitting data with an intercept and a nonconstant outcome, R^2 = 1 - SS_residual/SS_total = SS_regression/SS_total. In simple linear regression it equals the squared Pearson correlation between predictor and outcome; in multiple linear regression it is the squared correlation between observed and fitted values when those correlations are defined. With centered total sum of squares, R-squared can be negative for predictions evaluated on other data or for a model fitted without an intercept.

R-squared is silent on whether the model is well-specified: a regression can have a high R-squared while badly violating linearity (if the true relationship is monotone but curved, a linear fit can still correlate strongly with it) or while resting on a spurious relationship between two independently trending time series. It should always be read alongside the residual diagnostics, not as a stand-alone verdict on model quality.

On supported linear-regression cards, KernelStats reports R-squared and adjusted R-squared with the available model tests and diagnostics. Other regression families use different fit measures; logistic regression, for example, reports pseudo-R-squared and likelihood-ratio results. Inspect the diagnostics rather than treating a high fit score as evidence that all relevant checks have passed.

When to use it

Consider it when

To communicate how much of the outcome's variation an ordinary regression explains on the data it was fitted to, alongside (never instead of) the residual diagnostics and the individual predictors.

Use caution when

As a stand-alone measure of model quality or predictive accuracy on new data. Do not select between models of different complexity using ordinary in-sample R-squared alone; consider adjusted measures or suitable out-of-sample validation.

Formulas and symbols

R-squared

R2=1−SSresidualSStotalR^2 = 1 - \frac{SS_{\text{residual}}}{SS_{\text{total}}}

SS_residual is the sum of squared residuals; SS_total is the total sum of squares of the outcome around its mean.

Common misconceptions

Misconception

A high R-squared means the model makes accurate predictions on new data.

Correction

In-sample R-squared measures fit to the data the model was TRAINED on. A model can have a high in-sample R-squared and still perform poorly on new data if it has overfit; cross-validated performance, not R-squared, answers the predictive-accuracy question.

Read more: Misconception: a high R-squared means the model will predict accurately on new data

References

  1. NIST/SEMATECH e-Handbook of Statistical Methods, §4.4.3.3 R-squared, NIST/SEMATECH (2012), §4.4.3.3.