R-Squared Calculator
Calculate R², the coefficient of determination: the share of the variation in a response that a model explains. Paste X and Y data to fit a least-squares line, or paste observed and predicted values from any model. You also get adjusted R², r, and the full sum-of-squares breakdown.
Want to know what your R² means? Read how to interpret R-squared. To test whether the slope is significant, use LinRegTTest.
Related Calculators
R² Formulas
R² = 1 − SSE / SST = SSR / SST
SST = Σ(y − ȳ)², SSE = Σ(y − ŷ)², SSR = SST − SSE
Simple linear regression: R² = r²
Adjusted R² = 1 − (1 − R²)(n − 1)/(n − p − 1), p = number of predictors
For a least-squares line with an intercept, R² always lies between 0 and 1. With predictions from another source — a different model, a forecast, or a line fitted to other data — SSE can exceed SST, and R² becomes negative.
Worked Example: From X and Y Data
Hours studied X = 1, 2, 3, 4, 5, 6, 7, 8 and scores Y = 52, 55, 61, 60, 66, 70, 71, 77. Click Load example to reproduce.
- Fitted line: ŷ = 48.5714 + 3.4286x.
- SST = 508, SSE = 14.2857, so SSR = 493.7143.
- R² = 1 − 14.2857 / 508 = 0.9719; adjusted R² = 0.9672; r = 0.9858.
Study time explains about 97% of the variation in these scores.
Worked Example: Observed vs Predicted
Observed y = 3, 5, 7, 9; a model predicts ŷ = 2.8, 5.3, 6.9, 9.2.
- ȳ = 6, so SST = 9 + 1 + 1 + 9 = 20.
- Residuals: 0.2, −0.3, 0.1, −0.2, so SSE = 0.04 + 0.09 + 0.01 + 0.04 = 0.18.
- R² = 1 − 0.18 / 20 = 0.991.
See the regression calculator for predictions from a fitted line and the sum of squares calculator for SST on its own.
Frequently Asked Questions
What is a good R-squared value?
It depends on the field. In controlled physical experiments R² above 0.9 is common; in social science or finance, 0.2–0.5 can be meaningful. A high R² does not prove the model is correct, and a low R² does not mean the relationship is unimportant.
What is the difference between R² and r?
r is the correlation coefficient, from −1 to 1, and shows direction. R² is the share of variance explained, from 0 to 1. In simple linear regression, R² is exactly r squared, so r = 0.9 gives R² = 0.81.
Why use adjusted R²?
Plain R² never decreases when you add predictors, even useless ones. Adjusted R² penalizes each extra predictor, so it only rises when a new variable improves the fit more than chance would.
Can R-squared be negative?
Not for a least-squares line with an intercept fitted to the same data. It can be negative when predictions come from elsewhere and fit worse than the mean of the observed values — use the Observed and predicted mode to check.
Embed This Calculator
Add this free calculator to your course page or LMS.
Adjust the height value to fit your page.