Coefficient of Determination (R²)

Learn what R² tells you about a regression line, how to calculate it from r or from sums of squares, and why a high R² does not prove causation.

Advanced25 minLesson

Definition

The coefficient of determination, written R2R^2, tells you how much of the variation in the response variable yy is explained by the linear relationship with the explanatory variable xx.
For simple linear regression (one xx, one yy), it is the square of the correlation coefficient:
R2=r2R^2 = r^2
It can also be calculated from two sums of squares:
R2=1−SSresSStotR^2 = 1 - \frac{SS_{\text{res}}}{SS_{\text{tot}}}
  • SStot=∑(yi−yˉ)2SS_{\text{tot}} = \sum (y_i - \bar{y})^2 is the total variation of the yy-values around their mean
  • SSres=∑(yi−y^i)2SS_{\text{res}} = \sum (y_i - \hat{y}_i)^2 is the variation that is left over after using the regression line (the sum of squared residuals, written SSR in the Residuals lesson)
R2R^2 is always between 00 and 11. If R2=0.81R^2 = 0.81, then **81% of the variation in yy is explained by the linear relationship with xx**, and the other 19% is not explained by the line.

Try it now

The correlation coefficient of a data set is r=0.6r = 0.6. What is R2R^2?

Worked Examples

For a group of students, the correlation between daily screen time (xx, hours) and hours of sleep (yy) is r=−0.7r = -0.7. Find R2R^2 and interpret it.
1

Square the correlation coefficient

R2=r2=(−0.7)2=0.49R^2 = r^2 = (-0.7)^2 = 0.49 → R2=0.49R^2 = 0.49
2

Write it as a percent

0.49=49%0.49 = 49\% → 49%
3

Interpret in context

49% of the variation in hours of sleep is explained by the linear relationship with screen time. The other 51% comes from other factors. → 49% explained, 51% not explained

Common Mistakes

Using rr as the percent: "r=0.5r = 0.5, so 50% of the variation is explained"

Why it's wrong: The percent of explained variation comes from R2R^2, not from rr. You must square first.

Correct: R2=0.52=0.25R^2 = 0.5^2 = 0.25, so only 25% of the variation is explained.

Forgetting the sign when going from R2R^2 back to rr

Why it's wrong: 0.49=0.7\sqrt{0.49} = 0.7 is always positive, but rr can be negative. R2R^2 hides the direction of the relationship.

Correct: Take the sign from the slope: if the slope is negative, r=−R2r = -\sqrt{R^2}, for example r=−0.7r = -0.7.

Thinking a high R2R^2 proves that xx causes yy

Why it's wrong: R2R^2 only measures how well a line fits the data. A confounding variable can drive both xx and yy.

Correct: Say "81% of the variation in yy is explained by the linear relationship with xx", never "xx causes 81% of yy". Causation needs a controlled experiment.

Thinking a high R2R^2 means a straight line is the right model

Why it's wrong: Curved data can still give R2=0.96R^2 = 0.96. R2R^2 does not show patterns in the residuals.

Correct: Always look at the residual plot. Random scatter supports the line; a U shape or another pattern means a different model fits better.

Interactive Visual

Scatter Plot

Strong fit: hours studied and test score

123455060708090Hours studiedTest score

ŷ = 9x + 43

r = 0.9, R² = 0.81 · strong positive correlation

Tap a point to see its coordinates.

Scatter Plot

Weak fit: shoe size and test score

36373839405060708090Shoe size (EU)Test score

ŷ = 3x − 44

r = 0.3, R² = 0.09 · weak positive correlation

Tap a point to see its coordinates.

Scatter Plot

Curved data: high R² but the wrong model

123450510152025xy

ŷ = 6x − 7

r = 0.981, R² = 0.963 · strong positive correlation

Tap a point to see its coordinates.

Interactive Sandbox

Expression Calculator

Try these:

History

No calculations yet

Practice Problems

18 problems
Problem 1 of 18
Easy
The correlation coefficient of a data set is r=0.6r = 0.6. What is R2R^2?

Why It Matters

Once you have a regression line, the next question is: how good is it? R2R^2 answers this with one number.
  • Science: researchers report R2R^2 to show how well a model describes their measurements
  • Business: analysts compare sales models and keep the one that explains more of the variation
  • Sports: coaches check how much of the variation in sprint times is explained by training hours
  • Medicine: doctors see how strongly a dose is linked to a change in blood pressure
Knowing what R2R^2 does not say is just as important: a high R2R^2 does not prove that xx causes yy, and it does not prove that a straight line is the right model. You still need to look at the residuals.

Real World Applications

Sports Analytics

Coaches compare training data with race results to see how much of the difference in performance is linked to training.

Example:

If the correlation between weekly training hours and 100 m sprint time is r=−0.85r = -0.85, then R2=0.7225R^2 = 0.7225: about 72% of the variation in sprint times is explained by the linear relationship with training hours.

1Try It Yourself

For a swimming club, the correlation between weekly training hours and 50 m race time is r=−0.9r = -0.9.

What is R2R^2? Give it as a decimal.

Step 1: Write the mathematical expression

Square the correlation coefficient:

Real Estate Pricing

Real estate analysts build regression models for house prices and use $R^2$ to judge whether a model is good enough to use for valuations.

Example:

A model of price on floor area with R2=0.70R^2 = 0.70 explains 70% of the price variation; the other 30% comes from location, condition and other factors.

2Try It Yourself

For a model of apartment prices on floor area, the total variation is SStot=500SS_{\text{tot}} = 500 and the sum of squared residuals is SSres=75SS_{\text{res}} = 75 (both in squared thousands of dollars).

What is R2R^2? Give it as a decimal.

Step 1: Write the mathematical expression

Use R2=1−SSresSStotR^2 = 1 - \frac{SS_{\text{res}}}{SS_{\text{tot}}}:

Medicine and Dosage

In clinical studies, researchers check how strongly the dose of a medicine is linked to a change in a measurement such as blood pressure.

Example:

If a higher dose goes with lower blood pressure (negative slope) and R2=0.36R^2 = 0.36, then r=−0.6r = -0.6: a moderate negative linear relationship.

3Try It Yourself

A study finds that a higher dose goes with lower blood pressure. The regression line has a negative slope and R2=0.64R^2 = 0.64.

What is the correlation coefficient rr?

Step 1: Write the mathematical expression

Take the square root and choose the sign from the slope:

Key Takeaways

  • 1The coefficient of determination R2R^2 is the share of the variation in yy explained by the linear relationship with xx
  • 2For simple linear regression, R2=r2R^2 = r^2, so squaring the correlation coefficient gives R2R^2
  • 3R2=1−SSresSStotR^2 = 1 - \frac{SS_{\text{res}}}{SS_{\text{tot}}} compares the leftover variation with the total variation
  • 4R2R^2 is between 00 and 11: R2=0.81R^2 = 0.81 means 81% of the variation in yy is explained
  • 5To go back from R2R^2 to rr, take R2\sqrt{R^2} and give it the sign of the slope
  • 6A high R2R^2 does not prove causation or a correct model: always check the residual plot

Frequently Asked Questions

Not for a least squares regression line like the ones in this lesson: SSresSS_{\text{res}} is never larger than SStotSS_{\text{tot}}, so R2R^2 stays between 00 and 11. Squaring rr also always gives a number that is 00 or more.
Not for a least squares regression line like the ones in this lesson: SSresSS_{\text{res}} is never larger than SStotSS_{\text{tot}}, so R2R^2 stays between 00 and 11. Squaring rr also always gives a number that is 00 or more.
It depends on the field. In physics experiments, values above 0.950.95 are common. When studying people (behavior, health, economics), an R2R^2 of 0.300.30 can already be useful, because people are affected by many factors.
Yes for simple linear regression with one explanatory variable, which is what this lesson covers. With several explanatory variables there is no single rr, but R2=1−SSresSStotR^2 = 1 - \frac{SS_{\text{res}}}{SS_{\text{tot}}} still works.
Because squaring removes the sign: r=0.8r = 0.8 and r=−0.8r = -0.8 both give R2=0.64R^2 = 0.64. To know the direction, look at the slope of the regression line or at rr itself.

Glossary

Coefficient of determination (R2R^2)
The share of the variation in yy that is explained by the linear relationship with xx; a number from 00 to 11
Total sum of squares (SStotSS_{\text{tot}})
∑(yi−yˉ)2\sum (y_i - \bar{y})^2: the total variation of the yy-values around their mean
Sum of squared residuals (SSresSS_{\text{res}}, also SSR)
∑(yi−y^i)2\sum (y_i - \hat{y}_i)^2: the variation left over after using the regression line
Residual
The difference between an observed and a predicted value: yi−y^iy_i - \hat{y}_i
Explained variation
The part of the total variation in yy that the regression line accounts for: SStot−SSresSS_{\text{tot}} - SS_{\text{res}}

Formula Card

R² from r

R2=r2R^2 = r^2

For simple linear regression, square the correlation coefficient

R² from sums of squares

R2=1−SSresSStotR^2 = 1 - \frac{SS_{\text{res}}}{SS_{\text{tot}}}

One minus the share of the variation that is left over

Total sum of squares

SStot=∑(yi−yˉ)2SS_{\text{tot}} = \sum (y_i - \bar{y})^2

Squared distances of the y-values from their mean

Sum of squared residuals

SSres=∑(yi−y^i)2SS_{\text{res}} = \sum (y_i - \hat{y}_i)^2

Squared distances of the y-values from the regression line

r from R²

r=±R2r = \pm\sqrt{R^2}

Use the sign of the slope of the regression line

Today's challengeOne problem, three tries

More in This Topic