Coefficient of Determination (R²) Calculator
Compute R² from paired data or from observed and predicted values, showing how much of the variation your model explains.
How it works
R² = 1 − SSᵣₑₛ ÷ SSₜₒₜ · for simple regression R² = r²
R² is the share of the variation in the outcome that a model reproduces. It compares the residual sum of squares — the error left after the model’s predictions — with the total sum of squares around the mean. R² of 1 means the predictions land exactly, 0 means the model does no better than always guessing the mean, and for a single-predictor regression it equals the square of Pearson’s r.
Worked example
Fitting a line to X = 1, 2, 3, 4, 5 and Y = 2, 4, 5, 4, 6 gives r = 0.8, so R² = 0.64 — the line explains 64% of Y’s variation. In actual-versus-predicted mode, if the residual sum of squares is 3.6 and the total is 10, then R² = 1 − 3.6 ÷ 10 = 0.64 as well.
Frequently asked questions
Is a higher R² always better?
Not necessarily. Adding predictors can only push R² up, even when they are noise, so a high value can reflect overfitting. Adjusted R² penalises extra predictors, and out-of-sample testing is a better check of real predictive power.
Can R² be negative?
In the actual-versus-predicted formula, yes — if the model predicts worse than simply using the mean, the residual sum of squares exceeds the total and R² drops below zero. For a fitted simple regression on the same data it stays between 0 and 1.
Does R² measure whether the model is correct?
No. It only measures how much variance is explained, not whether the functional form is right. A curved relationship forced into a straight line can still post a moderate R² while systematically mispredicting.
Related calculators
For education — check the assumptions (sample size, independence, distribution) before using these statistics in real decisions.