R², the coefficient of determination, is the most quoted number in regression. It compares two ways of predicting y: the model, and the naive guess of always predicting the mean ȳ. The total variation SST = Σ(y − ȳ)² is split into the part the model explains, SSR, and the part left in the residuals, SSE. R² = 1 − SSE ÷ SST is then the explained share, from 0 (no better than the mean) to 1 (every point predicted exactly).
For a least-squares fit with an intercept, SST = SSR + SSE exactly and R² equals the squared correlation between y and the fitted values; in simple linear regression it is simply r². If you paste predictions that came from somewhere else – a forecast, a machine-learning model, a formula – that identity no longer holds, and R² can even be negative when the predictions are worse than the mean.
A high R² is not proof of a good model: it rises automatically as you add predictors, it says nothing about bias in the residuals and it depends on how spread out the x values are. That is why the calculator also shows adjusted R², which charges a penalty per predictor, and a table of the squared deviations behind the numbers.
How to use the Coefficient of Determination
- What data do you have?
- Model to fit
- x values
- Observed y values
- Predicted values ŷ — One prediction per observed value
- Number of predictors in the model (p) — Used only for adjusted R²
Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.
How it works
In “fit a model” mode the tool fits the chosen model by least squares and computes SST, SSR and SSE from the observed and fitted values. In “observed vs predicted” mode it uses your predictions directly. R² = 1 − SSE ÷ SST; adjusted R² uses p = number of predictors (the degree of the polynomial, 1 for the exponential model, or the number you enter).
Worked example
Eight students’ study hours (1–8) and test scores (52, 55, 61, 60, 68, 71, 70, 79). The mean score is ȳ = 64.5 and SST = 574. The least-squares line ŷ = 3.595x + 48.32 leaves SSE = 31.12, so R² = 1 − 31.12 ÷ 574 = 0.9458: hours studied explain about 94.6% of the variation in scores. SSR = 542.88, and SSR + SSE = SST as expected. The correlation is r = √0.9458 = 0.9725 and adjusted R² = 0.9367. A cubic raises R² only to 0.9488 while adjusted R² drops to 0.9104 – the extra terms are not worth it.
Rules of thumb for describing R²
| R² | Usual description |
|---|---|
| 0.9 – 1.0 | Very strong |
| 0.7 – 0.9 | Strong |
| 0.5 – 0.7 | Moderate |
| 0.3 – 0.5 | Weak |
| below 0.3 | Very weak or none |
Formula
SST = Σ(y − ȳ)² · SSE = Σ(y − ŷ)² · SSR = Σ(ŷ − ȳ)² · R² = 1 − SSE ÷ SST (= SSR ÷ SST for least squares) · R²adj = 1 − (1 − R²)(n − 1) ÷ (n − p − 1)
Worked example
Inputs — What data do you have?: x and y values – fit a model; Model to fit: Linear y = a + bx; x values: 1, 2, 3, 4, 5, 6, 7, 8; Observed y values: 52, 55, 61, 60, 68, 71, 70, 79.
Results — Coefficient of determination (R²) = 0.94579; What it means = R² = 0.9458: the model explains 94.58% of the variation in y around its mean (a very strong fit by common rules of thumb). The remaining 5.42% is left in the residuals.; Adjusted R² = 0.93675; Correlation coefficient r (linear model) = 0.97252; Fitted equation = y = 3.595x + 48.32; Total sum of squares (SST) = 574.
Key terms
- SST
- Total sum of squares, Σ(y − ȳ)².
- SSR
- Regression (explained) sum of squares, Σ(ŷ − ȳ)².
- SSE
- Residual (error) sum of squares, Σ(y − ŷ)².
- Adjusted R²
- R² corrected for the number of predictors.
Frequently asked questions
What is a good R² value?
It depends on the field. In physics and engineering calibrations R² above 0.99 is common; in social science or finance 0.3 can be useful. Judge it against what is typical for your data.
How do I calculate R² by hand?
Compute ȳ, SST = Σ(y − ȳ)² and SSE = Σ(y − ŷ)², then R² = 1 − SSE ÷ SST. For (0, 1), (2, 4), (4, 4) with the line ŷ = 0.75x + 1.5: SST = 6, SSE = 1.5, R² = 0.75.
Is R² the same as the correlation coefficient?
In simple linear regression R² = r². With several predictors or non-linear models it is the squared correlation between y and ŷ (for least-squares fits).
Can R² be negative?
Yes, when predictions that were not fitted by least squares to these data are worse than predicting the mean.
Why use adjusted R²?
R² never falls when predictors are added. Adjusted R² = 1 − (1 − R²)(n − 1)/(n − p − 1) can fall, so it is fairer for comparing models of different size.
Does a high R² mean the model is correct?
No. A curved pattern can still give a high R² with a straight line; always look at the residuals as well.
What is the difference between SSR and SSE?
SSR is the variation the model explains (fitted values around ȳ); SSE is what is left over (observed values around the fitted ones).