Regression & correlation
R-Squared Calculator
The share of the variation in y that the model explains — and the adjustment for how many predictors it took.
Also called coefficient of determination calculator, R2 calculator, adjusted R squared calculator.
Have a spreadsheet? Drop a CSV here
Or . CSV, TSV or plain text. You pick which column is which after it loads — the names in your file do not have to match ours. The file is read in your browser and never uploaded.
How to read this result
R² is the proportion of variance explained. Total variation in y is the sum of squared deviations from ȳ; the model accounts for some of it and leaves the rest as residual. R² is the first divided by the total, so it runs from 0 to 1.
It never falls when you add a predictor — even a column of random numbers raises it slightly. That is why adjusted R² exists: it charges a penalty per predictor, can decrease, and is the version to compare models with.
A high R² does not mean the model is right. A curved relationship fitted with a straight line can produce R² above 0.95 while being systematically wrong at both ends. The residual plot is the check that R² cannot provide.
A low R² does not mean the model is useless. In fields where outcomes are genuinely noisy — individual human behaviour, market returns — an R² of 0.1 with a well-estimated slope can be an important finding. R² measures noise as much as it measures the model.
The formula
- the residual sum of squares — what the model does not explain
- the total sum of squares — variation around the mean of y
Adjusted for the number of predictors
- the number of predictors
- the sample size
Unlike R², this can fall when a predictor earns less than its cost in degrees of freedom.
Worked example
R² for the advertising line
The linear regression example: ten months of spend against sales, fitted with y = 0.30 + 2.015x.
- Total variation in y around its mean of 11.38.SS_tot = 335.656
- Variation left over after the line.SS_res = 0.8385
- The model accounts for the difference.SS_reg = 335.656 − 0.8385 = 334.818
- R² is the explained share.334.818 / 335.656 = 0.99750
- Adjusted for one predictor and ten observations.1 − (1 − 0.99750) × 9/8 = 0.99719
An R² of 0.9975 is the kind of number that only appears with tidy data over a wide range of x. Real observational data rarely gets close, and an R² this high on messy data is usually a sign that x and y are two measurements of the same thing.
Checked against R's summary(lm(y ~ x))$r.squared.
The calculator above is loaded with these numbers by the Load the worked example button.
Assumptions, and when to use something else
R² inherits every assumption of the model it summarises. For linear regression that means linearity, independence and constant variance; when those fail, R² is still computable and no longer means what it appears to.
Two specific traps. R² has no meaning for a model fitted without an intercept — some software reports a very high value that is not comparable. And R² computed on the same data the model was fitted to is optimistic; the honest version is out-of-sample, which needs a held-out set.
- You want the full regressionLinear regressionCoefficients, standard errors, p-values and the residual plot.
- You have several predictorsMultiple regressionWhere adjusted R² starts to matter.
- You want the correlation insteadCorrelation coefficientR² is r² for a single predictor.
Questions people ask
What is the difference between R² and adjusted R²?
R² rises whenever a predictor is added, even a useless one. Adjusted R² subtracts a penalty for each predictor and can fall, which makes it the right one for comparing models with different numbers of terms.
Is R² the same as r squared?
For simple linear regression with one predictor, yes exactly. In multiple regression R² is the squared correlation between the observed and fitted values, which generalises the same idea.
Can R² be negative?
Not for an ordinary least-squares fit with an intercept — it is bounded at 0. It can go negative when a model is evaluated on data it was not fitted to, and means the model predicts worse than simply using the mean.
What R² do I need for a good model?
There is no threshold. Compare against what is typical in your field, look at whether the coefficients are sensible, and check the residual plot. A model with R² = 0.2 and a well-estimated, theoretically expected slope beats one with R² = 0.9 and a curve in its residuals.