Coefficient of Determination Calculator (R-Squared)

By Easy Stat CalcLast updated November 22, 2026

The coefficient of determination, written R² and also called R-squared, is the share of variation in y that a straight-line model based on x accounts for. An R² of 0.90 means 90% of the variation in y is explained by x and 10% is not. Enter paired raw X and Y data, or a correlation r, or sums of squares below, and this coefficient of determination calculator, which also works as an r squared calculator or r2 calculator, returns R², adjusted R², a plain sentence, a scatter plot with the fitted line and the working.

Loading calculator…

What is the coefficient of determination?

Coefficient of determination definition: the proportion of the variation in the dependent variable (y) that is explained by the independent variable (x) in a linear model. So what is r squared? It is the same number under a shorter name, and its meaning is the same: the share of variation explained. It is a regression measure that ranges from 0 to 1, on a scale from 0 (no explanatory power) to 1 (a perfect fit). The coefficient of determination range is therefore 0 to 1, and the r squared meaning is the same in every field. R², R-squared, r squared and r2 all name it. What is r squared in statistics, in one line? It is the square of the correlation coefficient in a simple linear regression with one predictor, fitted by the ordinary least squares model, and a linear model’s share of explained variation. In statistics courses, including Advanced Placement (AP) Statistics, the coefficient of determination r squared is one of the first goodness-of-fit measures taught.

A plain reading: if hours studied and exam score give R² = 0.64, then 64% of the differences in scores go with differences in hours studied. The other 36% come from everything else, such as sleep, prior knowledge and luck. The value describes how well the line fits the observed data you entered. It does not say the line is the right model, and it does not say x causes y.

Coefficient of determination formula

The coefficient of determination equation has three equivalent forms, so there are three ways to reach the same R², depending on what you already have. The r squared formula most people learn first is the square of r. The calculator has a tab for each form.

From the correlation coefficient r

R² = r². The correlation coefficient (Pearson’s r, the Pearson correlation coefficient) is r = Σ[(x − x̄)(y − ȳ)] / √[Σ(x − x̄)² · Σ(y − ȳ)²], which is the covariance of X and Y divided by the product of their standard deviations. A correlation of r = 0.9 gives R² = 0.81, so X accounts for 81% of the variability in Y. A correlation of −0.6 gives R² = 0.36. The sign of r disappears when you square it, so R² cannot tell you whether the relationship goes up or down.

From sums of squares

R² = SSR / SST, where SSR is the regression sum of squares (also called the model sum of squares, MSS, or the explained sum of squares) and SST is the total variation in y (the total sum of squares, also written TSS or SS_tot). With SSR = 72 and SST = 90, R² = 0.80.

R² = 1 − SSE / SST, where SSE is the error sum of squares (also called the residual sum of squares, RSS, or SS_res), the part the line fails to explain. This is the same as (TSS − RSS) / TSS, or R² = 1 − SS_res / SS_tot, and the first form is R² = MSS / TSS. With SSE = 14 and SST = 56, R² = 1 − 0.25 = 0.75. This is the regression method, in contrast to the correlation method above. The three sums are linked by SST = SSR + SSE. If you need SST from raw numbers, the sum of squares calculator shows it with the working.

Adjusted R-squared

What is adjusted r squared? It is R² corrected for the number of predictors. The adjusted r squared formula is adjusted R² = 1 − (1 − R²)(n − 1) / (n − k − 1), where n is the number of observations and k is the number of predictors. When predictors are added, plain R² never falls, so the adjusted version penalizes extra terms that do not help, which makes it the better value for comparing models. With R² = 0.75, n = 10 and k = 2, adjusted R² = 1 − 0.25 × 9 / 7 = 0.6786.

Coefficient of determination formulas: R squared from r, from SSR and SST, from SSE and SST, and adjusted R squared
The three ways to find R², plus the adjusted R² formula.

How to use the coefficient of determination calculator

  1. Pick a tab (the summary inputs are r, SSR and SST, or SSE and SST, for when you do not have raw data): Raw data, From r, SSR and SST, or SSE and SST.
  2. In Raw data, enter two data sets, the X values and the Y values as (x, y) data points, one y for every x in the same order, with at least 3 pairs. Commas, spaces, new lines and Excel paste all work.
  3. In the other tabs, enter r, or the two sums of squares.
  4. Optional: enter n and k to get adjusted R². In raw data, n comes from your data and k is 1 unless you change it.
  5. Click Calculate. Reset clears the inputs. The preset buttons fill an example for you.

The result shows, with the steps behind it, R², the percentage, r with its sign (raw data), the unexplained share 1 − R², adjusted R², a plain sentence, the least-squares line, a scatter plot you can download as a PNG (the plots also include an explained vs unexplained bar), the working, and lines to repeat the calculation in Excel, R, Python and a TI-84.

How to calculate R-squared step by step

This solved example uses hours studied x = 1, 2, 3, 4, 5, 6, 7 and scores y = 55, 60, 58, 70, 75, 72, 85. Enter the same numbers in the coefficient of determination calculator above and the results match the steps below.

  1. Find the means: x̄ = 4 and ȳ = 67.8571.
  2. Find SSxx, the sum of squared x deviations, Σ(x − x̄)² = 28; SSyy, the sum of squared y deviations, Σ(y − ȳ)² = 690.8571; and SSxy, the sum of cross-products, Σ(x − x̄)(y − ȳ) = 131.
  3. Find the correlation: r = SSxy / √(SSxx × SSyy) = 131 / √(28 × 690.8571) = 0.9419.
  4. Square it: R² = r² = 131² / (28 × 690.8571) = 17,161 / 19,344 = 0.8871.

About 88.7% of the variation in scores is explained by hours studied. The fitted line is y = 4.6786x + 49.1429. As a check, SSE around that line is 77.964, SST is 690.857, and 1 − 77.964 / 690.857 = 0.8871, the same R². With n = 7 and k = 1, adjusted R² is 0.8646. The covariance behind SSxy is explained on the covariance calculator page, and the spread of y on the variance calculator page. More tools for two variables are on the correlation and regression page.

Scatter plot of hours studied against exam score with the least-squares line and R-squared 0.8871
Hours studied against exam score, with the least-squares line (R² = 0.8871).
Worked example, hours studied x = 1 to 7 and scores y = 55, 60, 58, 70, 75, 72, 85.
QuantityValue
Mean of x, mean of y4, 67.8571
SSxx, SSyy, SSxy28, 690.8571, 131
r0.9419
R²0.8871
Adjusted R² (k = 1)0.8646

Interpreting R²: what does R-squared mean?

What does r squared tell you? R² is the share of variance explained, a reading aid for how well the model fits. Multiplying R² by 100 gives the percentage of variance explained: 0.30 means 30% explained and 70% not. R² = 0 means the model explains nothing and is no better than predicting the mean of Y. R² = 1 is a perfect fit, with every point on the line. A value near 1 means a strong linear relationship in the data, and a value near 0 a weak one. That is what r squared means in regression (what does r squared mean in regression? exactly this), and all it says. How to interpret r squared: say how much of the variation in y the model explains and stop there.

What is a good r squared value? What counts as a good R² value, or acceptable values, vary by field; the r squared value that is strong in one area can be weak in another. Physical measurements from a controlled experiment often give R² above 0.95. Studies of people, markets or weather often give 0.10 to 0.40 and are still useful. Judge the number against what is normal for your kind of data, not against a fixed cutoff.

Keep three limits in mind when comparing models or reading a result:

  • A high R² does not prove that x causes y. Causation needs a different kind of evidence.
  • A high R² does not prove a straight line is the right model. A curve can give a high R² and still leave a clear pattern in the errors.
  • A low R² does not mean there is no relationship. A strong curved relationship can give a low R² for a straight line.

R-squared vs r: coefficient of determination vs correlation coefficient

In the correlation coefficient vs coefficient of determination comparison, the correlation coefficient r runs from −1 to 1 and carries the direction. The coefficient of determination R² runs from 0 to 1 and is the share of variation explained. With r = 0.5 the relationship is moderate, but R² is only 0.25: the line explains a quarter of the variation, not half. That is why r vs r squared is a frequent AP Statistics question. Use r to describe direction and strength, and R² to describe how much is explained.

Can R-squared be negative?

For a least-squares line with an intercept, plain R² cannot be negative and stays between 0 and 1. Models fitted without an intercept, or R² computed out of sample, can give values outside that range, and then the standard in-sample formulas no longer apply. Adjusted R² can go below 0 when the model explains very little for its number of predictors. Enter x = 10, 34, 23, 54, 9 and y = 4, 5, 11, 15, 20 in the tool: R² is 0.0021 and adjusted R² is −0.3306. A negative adjusted r squared says the model is no better than using the average of y. Pseudo R² for logistic models is a different measure and is not calculated here.

How to find R-squared in Excel, R, Python and a TI-84

The R² formula in code (the r2 formula in each tool) is printed by the tool with your own numbers. In general:

  • Excel: to find r squared in Excel, use =RSQ(y_range, x_range), or =CORREL(y_range, x_range)^2. This is the coefficient of determination Excel formula; Excel lists y first, then x.
  • R: summary(lm(y ~ x))$r.squared, and $adj.r.squared for adjusted R². To calculate the coefficient of determination in R from a correlation, use cor(x, y)^2.
  • Python: scipy.stats.linregress(x, y).rvalue ** 2.
  • TI-84: turn DiagnosticOn once, then STAT > CALC > 4:LinReg(ax+b) L1, L2 shows r² and r.

Common mistakes

  • Using R² with fewer than 3 points. Two points always fit a line perfectly, so R² is 1 and means nothing.
  • Entering x and y in different orders or with different counts.
  • Reading R² as the correlation. Take the square root and add the sign to get r.
  • Comparing R² across models with different numbers of predictors. Use adjusted R².
  • Treating a high R² as proof that the model is right.

Coefficient of determination calculator FAQs

What is the coefficient of determination?

It is the share of the variation in y that is explained by x, from 0 to 1. It is the same as R-squared.

How do I calculate the coefficient of determination?

Square the correlation r, or divide SSR by SST, or take 1 minus SSE divided by SST. The calculator above does all three, or works it out from your x and y data.

What is the formula for R²?

R² = 1 − SSE / SST, which equals SSR / SST and, in simple linear regression, r².

Is r squared the same as the coefficient of determination?

Yes. R², R-squared, r squared and r2 all name the coefficient of determination. Is the coefficient of determination the same as R²? In simple linear regression, yes: it is the square of the correlation.

Is R² always between 0 and 1? Can it be negative?

For a least-squares line with an intercept it stays between 0 and 1. Adjusted R² can be negative. R² can fall outside the range for models without an intercept or for out-of-sample calculations.

What counts as a good R² value?

That varies by field. Above 0.9 is common in tightly controlled physical work, while 0.1 to 0.4 can be useful for human behavior. Compare with what is typical for your data.

Is R-squared of 0.99 good?

It is a very strong fit, and for physical measurements it is normal. It still does not prove the model is right, so check the scatter plot for curvature and look for outliers.

What does R-squared tell us?

It shows how much of the variation in y goes with x in your model. It does not say the model is correct or that x causes y.

What is adjusted R²?

Adjusted R² is R² reduced for each extra predictor. It can be lower than R² and, rarely, below 0.

R squared vs adjusted R squared: what is the difference?

Adjusted R² reduces R² for each extra predictor, so adding a useless variable lowers it. Use it to compare models with different numbers of predictors.

Is the coefficient of determination the same as the correlation coefficient?

No. The correlation r carries direction and runs from −1 to 1. R² is its square, from 0 to 1, and shows the share explained.

What does the correlation coefficient r indicate?

It shows the direction and strength of a linear relationship, from −1 (perfect downward line) to 1 (perfect upward line). Squaring it gives R².

What is the coefficient of non-determination?

It is 1 − R², the share of variation the model does not explain. The calculator shows it as “Unexplained”.

Can R-squared be more than 1?

Not for a least-squares line with an intercept. If SSR is larger than SST the inputs are wrong, and the calculator flags it.

Is R² valid only for linear regression?

It is defined for any model, but it is most meaningful for linear regression. For curved or logistic models, other measures such as pseudo R² are used and mean something different. This tool fits a straight line.

Is R² the only goodness-of-fit measure?

No. The residual standard error, the root mean squared error (RMSE) and the mean squared error (MSE) are others, and each answers a different question. R² is unit-free, while RMSE is in the units of y.

Does a high R² mean the result is statistically significant?

No. Significance depends on the sample size, the number of predictors and a test statistic, and a high R² from very few points can happen by chance.

What about R² in multiple regression?

With several predictors, R² is the share of variation explained by all of them together. It never falls as you add predictors, so use adjusted R², which this calculator gives when you enter n and k.

How do I find the coefficient of determination in Excel?

Use =RSQ(y_range, x_range). Excel lists y first, then x.

Easy Stat Calc · Results checked against Python, R and Excel formulas · Last updated November 22, 2026 · Methodology