Coefficient of Determination Calculator
Fit a line to paired data and one question outranks all others: how much of the story does the line actually tell? The coefficient of determination, R², answers as a proportion — the share of the variation in Y that the regression on X accounts for. This calculator fits the least-squares line to your paired data and shows its working: the slope and intercept, the total and residual sums of squares, R² itself, and the correlation r it squares. Paste two lists of equal length and the verdict arrives with its arithmetic exposed.
What R² Measures, Precisely
Start from the variation to be explained: SS total = Σ(y − ȳ)², how much Y moves around its own mean — the ignorance baseline, the error of predicting every Y by the average. The regression makes its predictions ŷ = a + bx and leaves leftovers: SS residual = Σ(y − ŷ)², the variation the line failed to capture. The coefficient of determination is the fraction of the baseline ignorance the line removes:
R² = 1 − SS residual / SS total
R² = 1 means the line passes through every point (nothing left over); R² = 0 means the line explains nothing beyond the mean itself; values between are read directly as percentages — R² = 0.60 says 60% of Y's variation is accounted for by its linear relation with X. In simple (one-predictor) regression, R² is exactly the square of Pearson's correlation coefficient, which the calculator also prints: r carries the direction (positive or negative slope), R² carries the magnitude of explanatory success, and confusing the two — reporting r = 0.77 as "77% explained" when the answer is 60% — is the most common misreading in applied reports.
Worked Example: Five Points, R² = 0.60
The defaults are the classroom's favourite five points: X = 1, 2, 3, 4, 5 and Y = 2, 4, 5, 4, 5. Means: x̄ = 3, ȳ = 4. The slope needs Sxy = Σ(x − x̄)(y − ȳ) = 4 + 0 + 0 + 0 + 2 = 6 and Sxx = 4 + 1 + 0 + 1 + 4 = 10, so b = 6/10 = 0.6 and the intercept a = 4 − 0.6 × 3 = 2.2: the line is ŷ = 2.2 + 0.6x, predicting 2.8, 3.4, 4.0, 4.6, 5.2. Residuals (−0.8, +0.6, +1.0, −0.6, −0.2) square and sum to SS residual = 0.64 + 0.36 + 1.00 + 0.36 + 0.04 = 2.40. SS total = 4 + 0 + 1 + 0 + 1 = 6.00. Therefore R² = 1 − 2.40/6.00 = 0.60, and r = √0.60 ≈ 0.775 (positive, matching the rising line). Sixty percent of the Y story is told by the line; the other forty is the scatter the next section teaches you to respect — and if you take one exhibit from this page, take the SS decomposition: it is the difference between quoting R² and understanding it.
Reading R² Without Superstition
There is no universal "good" R², and the calculator's honesty consists partly in refusing to pretend otherwise. In physics-style data (calibration curves, controlled experiments) R² below 0.95 is a raised eyebrow. In human behaviour — predicting purchases, votes, exam scores — R² of 0.10–0.30 can be a genuine, publishable finding, because the systems are noisy by nature. Contexts invert again for time series of growing quantities, where two unrelated trends can produce R² above 0.9 by both merely rising (the spurious-regression trap). The disciplines that keep R² meaningful: judge it against the field's baseline, never across fields; remember it measures linear capture only — a perfect parabola can yield R² near zero while X determines Y completely (plot the data; Anscombe's quartet, four data sets with near-identical R² and wildly different shapes, is the eternal warning); and treat a rising R² from adding predictors with suspicion until it survives the next section's adjustment.
Adjusted R² and the Overfitting Tax
R² has a structural vice: it can never fall when you add a predictor, even a useless one, because least squares will always find some accidental pattern to monetise. The adjusted R² taxes each predictor for its keep: adjusted R² = 1 − (1 − R²)(n − 1)/(n − p − 1), with p predictors. The tax is gentle with one predictor (our example: 1 − 0.40 × 4/3 ≈ 0.467) and severe when predictors crowd a small sample — with enough junk variables adjusted R² can go negative, the statistic's way of announcing that the model explains less than nothing once its complexity is billed. This calculator treats the single-predictor case, where R² and r² coincide; the moment a second X enters, quote the adjusted figure, and when a model brags of R² = 0.99 on thirty observations and twelve predictors, the adjusted arithmetic on this page's formula is the bucket of cold water to reach for.
Anscombe's Quartet: Four Data Sets, One R²
In 1973 the statistician Frank Anscombe published the subject's most durable warning: four small data sets engineered to share nearly identical summaries — the same means, the same fitted line (ŷ ≈ 3.00 + 0.500x), the same correlation r ≈ 0.816 and therefore the same R² ≈ 0.67 — while being four utterly different stories. One is a healthy linear scatter. One is a perfect parabola the line merely bisects. One is a clean line hijacked by a single outlier that manufactures most of the correlation. One is a vertical column plus one far-flung point that creates the slope out of nothing. Every figure this calculator prints would call the four identical, and every plot separates them instantly. The quartet is not an argument against R²; it is the standing order that accompanies it — plot the data, read the residuals — and it is why this hub gives the residuals their own calculator two doors down. A coefficient of determination is a summary of a picture; summaries are not substitutes for looking.
R² Is Not a Prediction Interval
One last distinction protects real forecasts. R² describes the fit to the data in hand; a user usually wants the error on the next prediction, which is wider — it must pay for the line's own uncertainty plus the new point's scatter. For the worked example (SEE = √(2.40/3) ≈ 0.894, n = 5), a 95% prediction interval at x = 3 runs roughly ±3.1 around the predicted 4.0 — an interval from about 0.9 to 7.1, honest and humbling for a data set whose R² sounded respectable. Small samples make wide intervals; that arithmetic, not modesty, is why experienced analysts quote R² and prediction intervals in the same breath, and why a model that fits five points beautifully has earned almost nothing yet.
The No-Intercept Trap
One variant quietly poisons comparisons: regressions forced through the origin (no intercept) redefine R² itself. Without the mean as the baseline, software computes the coefficient against zero instead — inflating it, sometimes grotesquely, and producing values that cannot be compared with ordinary R² at all. A model of Y on X with no intercept can print R² = 0.98 while fitting worse than a horizontal line. If an R² looks too good for the scatter you can see, check whether the fit was allowed an intercept; this calculator's fit always includes one, and its SS decomposition shows the baseline it used — the mean — in plain figures, so the same check can be run on any software's output by hand.
Related Tools
More from the Statistics Calculators hub: the Residual Calculator opens up the leftovers this page sums, the live Correlation Calculator centres on r itself, and the Descriptive Statistics Calculator portraits each variable before they are paired.
Frequently Asked Questions
Is R² the same as correlation?
In simple linear regression R² is exactly r squared — but they answer different questions: r (from −1 to 1) measures the direction and strength of a linear relationship, R² (0 to 1) measures the share of Y's variance the fitted line explains. An r of 0.775 is a strong correlation and an R² of 0.60 — both true, neither interchangeable.
Can R² be negative?
For a least-squares line with an intercept, no — the line always does at least as well as the mean. Negative R² appears when a model is evaluated on new data, forced through the origin, or built by formulas whose predictions underperform the mean — always a red flag worth investigating rather than rounding away.
What R² do I need for a good model?
The field decides: calibration work expects 0.95+, controlled experiments 0.7+, behavioural data often celebrates 0.2. A better question is whether R² beats the naive baseline and the rival models on the same data — and whether the residual pattern (see the Residual Calculator) looks like honest noise.
Why does adding variables always raise R²?
Least squares minimises SS residual over the variables offered, and a new variable can only add fitting freedom, never remove it — so raw R² rewards complexity automatically. Adjusted R² exists precisely to bill for that freedom; out-of-sample validation is the sterner court.
Does a high R² prove X causes Y?
No. R² measures association captured by a line. Ice-cream sales and drowning deaths correlate handsomely (both are driven by summer), and no R², however polished, distinguishes causation from a shared cause or a coincidence of trends. Causal claims need design — randomisation, controls, mechanism — not a bigger coefficient.
What if my relationship is curved?
Linear R² will under-report a strong curved relationship, possibly drastically. Plot first; if the shape is a curve, transform (log Y is the classic), fit the appropriate regression, or summarise the association with a rank correlation — each of which has its own page in this hub's roadmap, and none of which is rescued by quoting the linear R² louder.