Bell Statistics

What is R-squared?

R-squared is the share of variance in the outcome that a model accounts for, from zero to one. It measures how closely the fitted values track the observed ones in the data the model was fitted on, and nothing more than that.

Notation
Also called
coefficient of determination, R2, variance explained
Allon Korem

Written by Allon Korem

Chief Executive Officer

Last updated

In plain English

R-squared compares two quantities: how much the outcome varies around the model's predictions, and how much it varies around its own mean. If the model explains nothing, those are equal and R² is zero. If it predicts perfectly, the residual variation is zero and R² is one. So it is a summary of fit — how closely the fitted line tracks the points it was fitted to — and every limitation it has follows from that being all it is.

The first limitation is that it never falls. Adding any predictor, including a column of random numbers, can only reduce the residual sum of squares, so R² rises mechanically with model size. This makes it useless for comparing specifications, and it is why adjusted R² exists: it penalises each additional parameter and can fall when a predictor earns nothing. Even adjusted R² is a weak comparator, and out-of-sample performance is the honest test.

The second is that what counts as a good value is entirely domain-dependent. An R² of 0.95 on weekly sales data is unremarkable, because both the outcome and the predictors trend and share seasonality — a model with nothing in it but a time trend and month dummies will often reach 0.8. An R² of 0.15 predicting individual customer behaviour may be genuinely strong, because individual behaviour is mostly idiosyncratic. Quoting the number without the context is close to quoting nothing.

The third, and the expensive one, is that R² says nothing about whether the coefficients mean anything. A model can fit at 0.9 and carry a badly biased estimate on the single variable you care about, because the fit is being carried by seasonality while the marketing coefficient absorbs confounding. It is entirely normal for R² to rise while the coefficient of interest changes by half, and when that happens the fit statistic is the less informative of the two movements.

A related trap is reading R² as a causal share. "Marketing explains 30% of the variance" is not "marketing drives 30% of revenue" — the first is about variance in this sample, the second about levels in the world, and they are not convertible. Nor is a high R² protection against overfitting: a model with enough parameters can reproduce any dataset exactly and predict nothing. The number worth reporting is out-of-sample error, and the numbers worth arguing about are the coefficients and their intervals.

The formula

One ratio, one penalised version of it, and the out-of-sample measure that should usually replace both.

R-squared
R² = 1 − SS_res / SS_tot = 1 − Σ(yᵢ − ŷᵢ)² / Σ(yᵢ − ȳ)²

The share of variation around the mean that the model accounts for. Bounded in [0, 1] for ordinary least squares with an intercept.

Adjusted R-squared
R²_adj = 1 − (1 − R²) · (n − 1) / (n − k − 1)

Penalises parameters, so it can fall when a predictor adds nothing. Use it whenever comparing models of different size — never plain R².

Relation to correlation
R² = r² (simple regression only)

With one predictor, R² is the squared correlation. r = 0.5 gives R² = 0.25, which is usually less impressive than the correlation sounded.

Out-of-sample R-squared
R²_oos = 1 − Σ(yᵢ − ŷᵢ)² / Σ(yᵢ − ȳ_train)² on held-out data

Can be negative, which is informative: a model worse than the training mean is worse than useless. This is the number that should be reported.

Worked example

Two candidate models for weekly revenue over 104 weeks. Model A contains a time trend and month dummies and nothing else. Model B adds spend across six marketing channels. Both are evaluated in-sample and on a held-out final 26 weeks.

Model A, in-sample R²
0.82
Model B, in-sample R²
0.91
Model A, adjusted R²
0.80
Model B, adjusted R²
0.88
Model A, out-of-sample R²
0.74
Model B, out-of-sample R²
0.61

Model B fits better in-sample and predicts worse out of sample. The marketing variables improved the fit and cost real predictive accuracy.

The first thing to notice is Model A: a trend and twelve month dummies reach 0.82 with no marketing information at all, which sets the bar. Any headline R² on data like this has to be read against that baseline, and 0.91 is a much less impressive number once you know 0.82 was free. The second thing is the reversal out of sample. Model B's six correlated spend series gave it enough flexibility to fit historical noise, and that flexibility did not survive the holdout — a textbook case of [overfitting](/glossary/overfitting) that neither R² nor adjusted R² caught, since both rose. This is the argument for holding data out as a matter of routine rather than reporting in-sample fit and moving on.

Common misconceptions

An R-squared of 0.9 means the model is 90% accurate.
It means 90% of the variance around the mean is accounted for in the data the model was fitted on, which is a different claim and not a statement about prediction error. A model can have R² of 0.9 and produce forecasts that are consistently wrong by a commercially significant margin, especially outside the range of the training data.
Marketing explains 30% of the variance, so it drives 30% of revenue.
Variance explained and contribution to level are different quantities and are not convertible. A variable that barely moves can be responsible for a large share of revenue while explaining almost no variance, and a variable that swings wildly can explain a lot of variance while contributing little. Contribution comes from the coefficients and the spend levels, not from R².
We should choose the model with the highest R-squared.
R² can only rise as predictors are added, so that rule selects the largest model every time. Use adjusted R² for a like-for-like comparison and, better, hold data out and compare predictive error — which is the only comparison that penalises fitting noise rather than rewarding it.

Frequently asked questions

What is a good R-squared value?
There is no threshold worth adopting, because the answer depends on what is being predicted. Aggregate time-series outcomes routinely reach 0.8 or above from seasonality alone, so a high value there is close to meaningless without a baseline model to compare against. Individual-level behaviour is largely idiosyncratic, and 0.15 can represent a genuinely useful model. Always ask what a trivial baseline achieves before judging the number.
Should I report R-squared or adjusted R-squared?
Adjusted, whenever more than one predictor is involved or models of different size are being compared, because plain R² can only rise as variables are added and therefore cannot distinguish a better model from a bigger one. Both are in-sample measures, so for anything that will be used to make forecasts, out-of-sample error on held-out data is the number that matters and should be reported alongside.
Can a model with a low R-squared still be useful?
Frequently. If the goal is estimating a specific effect rather than predicting the outcome, what matters is whether that coefficient is unbiased and precise enough to act on — and a randomised experiment often has a very low R² while giving the most trustworthy effect estimate available. Fit quality and coefficient credibility are independent properties, and conflating them is one of the more expensive habits in applied modelling.

Related terms

  • Correlation

    How tightly two variables move together — bounded, unitless, and silent about cause.

  • Multicollinearity

    When predictors move together the model cannot separate them — good predictions, meaningless coefficients.

  • Overfitting

    A model that memorised the noise — excellent on the data it saw, useless on the data it will meet.

  • Regression analysis

    Fit a line through the data — and the phrase 'holding everything else fixed' is where the trouble starts.

  • Variance

    Spread in squared units — awkward to read, and the quantity every sample-size formula is built on.

Calculate it

  • Correlation test

    Pearson r or Spearman rho, with the Fisher-z interval that says how little a small sample knows.

  • One-way ANOVA

    Three or more independent groups on one continuous outcome — size it, then run the F test.

  • Two-sample t-test

    Compare the average of two independent groups — plan the sample size, then test the result.

Knowing the term is the easy part

Applying it to a live measurement problem is the part that goes wrong. If you are designing an experiment, reading a result you do not trust, or trying to work out what your marketing actually caused, that is the work we do.

References