Not sure which lesson to do first? Find your level and get a plan →

Statistics · Grade 9-12

R-Squared (Coefficient of Determination)

R-squared (the coefficient of determination) is the proportion of variance in the dependent variable that is explained by the independent variable(s) in a regression model.


Quick Answer

R-squared (the coefficient of determination) is the proportion of variance in the dependent variable that is explained by the independent variable(s) in a regression model. It ranges from 0 to 1, where 0 means the model explains none of the variability and 1 means it explains all of it. Report it after fitting a regression to say how much of the spread in y the model accounts for: R2=0.85 means the squared misses left around the line are only 15% of the squared spread around the mean. For a single straight line, R2=r2.

Why This Matters

R-squared tells you how much predicting from x improves on simply guessing the mean of y for everyone. A model of used-car prices from mileage with R2=0.45 leaves more than half the variation to other factors, a warning before anyone prices a car on mileage alone. Misread, it misleads: a perfect R2 can mean a model memorized noise, and a high one never proves cause.

Intuitive Explanation

Suppose you must guess each student's push-up count with no other information. Your best single guess is the mean, 16, and your misses from it, squared and added up, total 34. That total is the variation in y. Now you learn each student's weeks of training and predict with the line y^=10.9+1.7x instead. The squared misses from the line total only 5.1. The line has removed 34−5.1=28.9 of the 34, which is 85%. That fraction is R2.

In symbols, R2=1−SSESST, where SST is the squared spread around the mean and SSE is the squared spread around the line. At R2=0 the line does no better than the mean; at R2=1 every point lies on the line. With one predictor it equals the square of the correlation: here r=17340≈0.92 and r2=0.85. Squaring removes the sign, so R2 says how much, never which direction.

R2 is not the percent of predictions that are right, and higher is not automatically better. A wiggly curve through all five push-up points has R2=1, yet it predicts −2 push-ups at week 6, because it fitted week 3's off day as if it were a pattern. R2 is also comparable only between models of the same y on the same data, and a high value from observational data still says nothing about cause.

Think of it like this. R-squared rates a model the way noise-cancelling headphones are rated: the spread of y around its mean is the noise, and R2=0.85 means the model removes 85% of the noise power, the squared spread. A high rating says how much was removed, not whether the model is the true explanation.

Core idea. Compare the squared misses from the model with the squared misses from guessing the mean: the share removed is R2, a measure of fit on this data that says nothing about direction, about whether the shape is right, or about cause.


When to Use

Use R2 after fitting a regression when the question asks how well the model fits, what percent of the variation in y is explained, or how much better x predicts than the mean does. If you have r for a straight line, square it. If the question asks for the direction of the relationship, use r or the slope; if it asks whether a line is the right shape, look at the residual plot; if it asks about cause, look at the study design.

Tip. Ask: Do you need the share of the variation in y that a fitted model accounts for, from 0 to 1?

How to Recognize It

Before reporting R-squared, make sure a model has been fitted and decide whether the question wants fit, direction, steepness or one point's miss.

  1. Has a regression model already been fitted to these data?

    Yes means R-squared can rate it. Without a model there is nothing doing the explaining; to describe how tightly a scatter plot follows a line, use the Correlation Coefficient.

  2. Should the answer be a percent of variation, with no sign?

    Yes is R-squared, such as 49% of the variation in quiz scores. If you also need to know whether the trend rises or falls, R-squared cannot say, so report the sign of the Correlation Coefficient.

  3. Is the question about the whole model rather than one data point?

    Yes fits R-squared. If it asks how far one student's score landed from its prediction, that single gap is a residual, covered under Residuals.

  4. Does the question ask how much y changes for each extra unit of x?

    No is what R-squared needs, since it says nothing about steepness. A yes, such as 3 quiz points per extra hour of sleep, calls for the slope from Linear Regression.

R-Squared (Coefficient of Determination) vs Correlation Coefficient vs Residuals vs Linear Regression

R-squared, r, residuals and the slope all appear in one regression output, and students swap them. Ask whether you need a share of variation, a signed strength, one point's miss, or a change per unit.

R-Squared (Coefficient of Determination)

Meaning
R-squared is the share of the squared spread of y around its mean that the fitted model removes.
Key test
Between 0 and 1, with no sign and no units; rates a whole model.
Formula
R2=1−SSresSStot
Example
Quiz scores on sleep: R2=0.49, so sleep accounts for 49% of the variation in scores.

Correlation Coefficient

Meaning
The correlation coefficient r is a signed number from −1 to 1 describing how tightly paired data follow a rising or falling line.
Key test
Has a sign; for one straight line, squaring it gives R2.
Formula
r=±R2
Example
r=0.7 and r=−0.7 both give R2=0.49, though one trend rises and the other falls.

Residuals

Meaning
A residual is the vertical miss for a single point, the observed value minus the model's prediction.
Key test
Belongs to one point; R-squared combines all of them after squaring.
Formula
ei=yi−y^i
Example
A student predicted to score 72 who scores 65 has a residual of −7.

Linear Regression

Meaning
Linear regression produces the fitted equation, whose slope gives the predicted change in y for each unit of x.
Key test
Gives an equation with units, such as points per hour.
Formula
y^=b0+b1x
Example
y^=50+3x: each extra hour of sleep goes with 3 more quiz points on average.

Formula & Notation

Worked Examples

Example 1 — Compute R-squared for a training log

Easy

For the data (1, 13), (2, 15), (3, 14), (4, 18), (5, 20), with x = weeks of training and y = push-ups, the least-squares line y^=10.9+1.7x has residuals 0.4, 0.7, −2.0, 0.3 and 0.6. Find R2 and interpret it.
Show the steps and the answer
  1. SST: yˉ=16, gaps −3,−1,−2,2,4, squares 9,1,4,4,16, so SST=34.

    SST is the total squared miss you would make by predicting the mean, 16, for every week.

  2. SSE: 0.16+0.49+4.00+0.09+0.36=5.10.

    SSE is the squared miss left over after predicting with the line instead.

  3. Combine them: R2=1−5.1034=1−0.15=0.85.

    The line removes 85% of the squared spread that the mean alone leaves.

  4. Check with r: r=1710⋅34=17340≈0.922, and r2=289340=0.85.

    For a straight line with one predictor, R2=r2, so two routes give the same number.

Answer: R2=0.85: the linear trend with weeks of training accounts for 85% of the variation in push-up counts.

Takeaway: R2 is one minus the ratio of squared misses around the line to squared misses around the mean.

Example 2 — Same strength test, opposite directions

Standard

For the same 200 used cars, Model A predicts price from mileage with r=−0.8, and Model B predicts price from engine size with r=0.6. Which model explains more of the variation in price? What does R2 tell you about direction?
Show the steps and the answer
  1. RA2=(−0.8)2=0.64 and RB2=0.62=0.36.

    Squaring makes both positive, so the size of r, not its sign, decides how much is explained.

  2. Compare: Model A explains 64% of the variation in price, Model B 36%.

    Both models predict the same y for the same cars, so their R2 values can be compared directly.

  3. Note that R2=0.64 would also come from r=+0.8.

    R2 has lost the sign, so direction must be read from r or the slope: price falls as mileage rises.

Answer: Model A explains more (64% against 36%), even though its r is negative. R2 shows no direction; from r, price falls with mileage and rises with engine size.

Takeaway: A negative correlation can give the larger R2; use R2 for how much and r or the slope for which way.

Example 3 — Find the mistake: a perfect R-squared

Application

Ana fits a fourth-degree polynomial through the five push-up points above and gets R2=1.00. She writes: "R2=1 is perfect, so my curve beats the line (R2=0.85). I'll use it to predict week 6." Her curve predicts −2 push-ups at week 6. Find the mistake and correct it.
Show the steps and the answer
  1. Explain the 1.00: a curve with five adjustable coefficients can pass through any five points, so every residual is 0.

    A perfect fit here is guaranteed by the number of coefficients, so it says nothing about the curve being right.

  2. Test the prediction: the curve gives −2 push-ups at week 6, an impossible value.

    The curve bent to follow week 3's dip, which was an off day, and that wiggle sends it plunging just past the data.

  3. Use the line instead: y^=10.9+1.7(6)=21.1.

    The line has some residuals but follows the real trend; week 6 is just past the data, so treat 21 as a cautious estimate.

Answer: The curve's R2=1 comes from overfitting the noise, not from a better model. The line is the better choice and predicts about 21 push-ups at week 6.

Takeaway: R2 measures fit to the data you have; a value of 1 from a very flexible model is a warning sign, not a prize.

Where You'll See It

  • How much do study hours explain test scores

    If a regression of test score on study hours gives R2=0.64, then 64% of the variation in scores across students is explained by how long they studied; the other 36% comes from sleep, prior knowledge, luck, and everything else.

  • Predicting a used car's price

    A model using mileage to predict price has R2=0.45, meaning mileage explains 45% of why prices differ. The rest depends on brand, condition, and year, so mileage alone is a weak predictor.

  • Plant height vs sunlight

    A science-fair model of plant height from daily sunlight hours reports R2=0.90 — sunlight explains 90% of the height differences among the plants, so it is a strong (but not perfect) predictor.

Common Mistakes

  1. The slip: A higher R2 always means a better model.

    Why it's tempting: Bigger numbers feel like better fit, and R2 never goes down when you add variables.

    Instead: R2 measures only how much variance is explained on THIS data; a model can have high R2 from overfitting and predict new data badly. Judge a model by validation, not R2 alone.

  2. The slip: R2 and the correlation r are the same number.

    Why it's tempting: Both describe how related two variables are, so students treat them as interchangeable.

    Instead: For simple linear regression, R2=r2. Since r ranges from −1 to 1 and R2 from 0 to 1, an r=−0.8 gives R2=0.64, and R2 loses the sign (direction) of the relationship.

  3. The slip: A high R2 proves that X causes Y.

    Why it's tempting: A strong explained-variance number feels like strong evidence of cause.

    Instead: R2 only measures association strength within the data. Causation requires a controlled experiment with random assignment, not a large R2.


Mini Practice

Try these on your own. Tap Reveal when you want to check.

  1. A regression has correlation r=0.9. Find R2 and explain what it means.

    Hint: For a simple linear regression, R2 is r squared.

  2. For car age and resale value, r=−0.7. Find R2.

    Hint: What happens to a negative sign when you square a number?

  3. A regression has total sum of squares SStot=400 and residual sum of squares SSres=100. Find R2.

    Hint: Use R2=1−SSresSStot.

  4. A regression line has a negative slope and R2=0.64. Find the correlation r.

    Hint: Take the square root, then decide on the sign.

  5. A report must say whether sales go up or down as price rises. A model gives R2=0.36. Is R2 enough, or do you need the correlation coefficient r?

    Hint: Can R2 ever be negative?

  6. Mia fits a 9th-degree polynomial to 10 data points and gets R2=1.00. She says, "A perfect fit, so it will predict new data perfectly." Correct her.

    Hint: How many points can a 9th-degree polynomial pass through exactly?

Want the full set?

50 practice questions for this concept — free to try, every one with a complete worked solution showing the why, not just the answer.

Frequently Asked Questions

What counts as a good R-squared?

It depends on what you are modeling. In a physics lab, a line through measured data often has R2R^2 above 0.95, and a much lower value usually means a measuring problem or the wrong model. In studies of people, such as predicting grades or income, behavior varies so much that 0.3 can be useful. A low R2R^2 does not mean the link is fake; it means much of the variation comes from other things.

Can R-squared ever be negative?

For a least-squares line with an intercept, scored on the data it was fitted to, no. But use a model on new data, or force a line through the origin, and the squared misses can be bigger than the squared spread around the mean. Then 1−SSres/SStot1 - SS_{\text{res}}/SS_{\text{tot}} falls below 0, which means the model predicts worse than simply guessing yˉ\bar{y} for everyone.

If adding a variable never lowers R-squared, how do people compare models fairly?

They often use adjusted R2R^2, which charges a penalty for each extra predictor: Radj2=1−(1−R2)n−1n−k−1R^2_{\text{adj}} = 1 - (1 - R^2)\frac{n - 1}{n - k - 1} for nn data points and kk predictors. It rises only when a new variable helps more than chance would. Adding students' shoe sizes to a model of test scores nudges R2R^2 up slightly but usually lowers adjusted R2R^2. Testing on new data is another fair check.

Why does r=0.7 sound strong but explain less than half the variation?

Because squaring a number between 0 and 1 shrinks it: 0.72=0.490.7^2 = 0.49 and 0.52=0.250.5^2 = 0.25. A correlation of 0.5, often called moderate, means the line accounts for only a quarter of the variation in yy. To account for 90% you need ∣r∣≈0.95|r| \approx 0.95. Thinking in R2R^2 is a good check on how much a single predictor really tells you.

Learning Path

R-Squared (Coefficient of Determination)

You are here

Next →

Nothing after this yet
You need Linear Regression (the fitted line and its residuals) and Standard Deviation (spread around a mean). R2 compares the residuals' squared spread with the data's squared spread around the mean, giving one number for how much the line explains. It prepares you to compare competing models of the same data, to read model summaries in science and economics, and to spot overfitting when R2 is suspiciously close to 1.

See Also