induwara.lk
induwara.lkStatistics · Education

R-Squared & Adjusted R-Squared Calculator

Work out the coefficient of determination (R²) and adjusted R² for any regression. Fit a line to paired x/y data or compare actual against predicted values, and see the full SST, SSR and SSE breakdown. Free, browser-only, sources cited below.

By Induwara AshinsanaUpdated Jul 9, 2026
R² & Adjusted R²coefficient of determination
NIST formulas

Enter your x and y values below. A least-squares line ŷ = a + b·x is fitted for you (k = 1 predictor).

5 values

Separate with commas, spaces or new lines.

5 values

Separate with commas, spaces or new lines.

Quick actions
R² (determination)
0.6000
Adjusted R²
0.4667
k = 1 predictor
SST (total)
6
SSE (residual)
2.4

About 60.0% of the variance in y is explained by the model — a moderate fit.

Sum-of-squares breakdown

ComponentFormulaValue
SST — totalΣ(yᵢ − ȳ)²6
SSR — explainedSST − SSE3.6
SSE — residualΣ(yᵢ − ŷᵢ)²2.4
R² = SSR / SST1 − SSE / SST0.6000

Fitted least-squares line

ŷ = 2.2000 + 0.6000·x

Pearson r = 0.7746, so r² = 0.6000 — this matches R² (0.6000), the expected identity for a simple linear regression.

Residual table

#xActual yPredicted ŷResidualResidual²
1122.8-0.80.64
2243.40.60.36
335411
4444.6-0.60.36
5555.2-0.20.04
SSE = Σ residual²2.4

Sources cited: definitions of SST, SSE, SSR and R² follow the NIST/SEMATECH e-Handbook §1.4.1 and adjusted R² follows §4.4.1. Everything runs in your browser — nothing is uploaded.

How it works

R-squared, the coefficient of determination, answers one question: how much of the variation in your dependent variable y is explained by the model? It is built from three sums of squares defined in the NIST/SEMATECH e-Handbook of Statistical Methods.

Let n be the number of observations and ȳ the mean of the actual y values. The total sum of squares is the spread of y around its own mean:

SST = Σ(yᵢ − ȳ)²

The model produces a predicted value ŷᵢ for each point. In paired mode the tool fits an ordinary least-squares simple linear regression, choosing the slope b and intercept a that minimise the squared errors:

b = Σ(xᵢ − x̄)(yᵢ − ȳ) / Σ(xᵢ − x̄)² ; a = ȳ − b·x̄ ; ŷᵢ = a + b·xᵢ

In actual-vs-predicted mode you supply the ŷᵢ yourself — for example, the fitted values from a multiple regression run elsewhere. Either way, the residual (error) sum of squares measures what the model misses, and the regression (explained) sum of squares is the rest:

SSE = Σ(yᵢ − ŷᵢ)² ; SSR = SST − SSE

The coefficient of determination is then the explained fraction:

R² = SSR / SST = 1 − SSE / SST

Because R² never decreases when you add another predictor — even an irrelevant one — it can flatter a multi-variable model. Adjusted R² corrects for this by penalising the predictor count k against the sample size n:

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

Two edge cases matter. When every y value is identical, SST is zero and R² is undefined — the tool says so instead of dividing by zero. And when n − k − 1 is zero or negative there are too few observations for the number of predictors, so adjusted R² is undefined and the tool shows a message rather than a misleading number. As a cross-check in paired mode, the calculator also reports the Pearson correlation r and confirms the identity r² = R² that holds for any simple linear regression.

Worked examples

Example 1 — Paired data, one predictor (k = 1)

x = 1,2,3,4,5 · y = 2,4,5,4,5

  1. Means: x̄ = 3, ȳ = 4
  2. Slope b = Σ(x−x̄)(y−ȳ) / Σ(x−x̄)² = 6 / 10 = 0.6
  3. Intercept a = 4 − 0.6·3 = 2.2 → line ŷ = 2.2 + 0.6x
  4. Predictions: 2.8, 3.4, 4.0, 4.6, 5.2
  5. SSE = 0.64+0.36+1.00+0.36+0.04 = 2.40
  6. SST = 4+0+1+0+1 = 6
  7. R² = 1 − 2.40/6 = 0.6000 (Pearson r = 0.7746, r² = 0.6000 ✓)
  8. Adjusted R² = 1 − (1−0.6)(4)/(5−1−1) = 0.4667

Example 2 — Actual vs predicted, multiple regression (k = 2)

y = 10,12,14,16,18 · ŷ = 11,11,15,15,18

  1. Mean ȳ = 14
  2. Residuals: −1, 1, −1, 1, 0
  3. SSE = 1+1+1+1+0 = 4
  4. SST = 16+4+0+4+16 = 40
  5. R² = 1 − 4/40 = 0.9000
  6. Adjusted R² = 1 − (1−0.9)(4)/(5−2−1) = 0.8000

Example 3 — When predictions beat only the mean (negative R²)

y = 1,2,3 · ŷ = 3,2,1 (predictions reversed)

  1. Mean ȳ = 2
  2. SST = (1−2)²+(2−2)²+(3−2)² = 1+0+1 = 2
  3. SSE = (1−3)²+(2−2)²+(3−1)² = 4+0+4 = 8
  4. R² = 1 − 8/2 = −3.0000
  5. A negative R² means these predictions fit worse than guessing the mean.

Frequently asked questions

Sources & references

The formulas on this page were last cross-checked against the NIST e-Handbook on 2026-07-09. R² and adjusted R² are universally-agreed mathematical definitions, so they are stable; this page is reviewed if the cited handbook sections are revised.

Related tools

Rate this tool
Be the first to rate

Comments & feedback

Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.

Found a bug, edge case, or want to suggest an improvement?

Email me at [email protected] — most fixes ship within 24 hours.