Course contentsShow
← Data Science
Lesson 531 of 2,14514. Simple Linear RegressionFree lesson

What is R-Squared?

Define R-squared as the proportion of variance in Y explained by X; understand why it measures model fit.

What is R-Squared?

You'll learn: How R-squared measures how well your linear model explains the variation in your data.

The Core Idea

When you fit a regression line to predict Y from X, some predictions are close to reality and some aren't. R-squared (written as R² or r²) tells you the proportion of variance in Y that is explained by X. It answers: "How much of the up-and-down movement in my outcome variable does my model actually capture?"

Think of it like this: Imagine you're trying to explain why students get different test scores. If study hours (X) perfectly explained score differences (Y), R² = 1.0 (100% explained). If study hours told you nothing useful, R² = 0 (0% explained). Most real models fall somewhere in between.

The Math Behind It

R-squared ranges from 0 to 1 (or 0% to 100%):

  • R² = 0: Your model explains none of the variance; you might as well use the mean of Y as your prediction
  • R² = 0.7: Your model explains 70% of the variance in Y
  • R² = 1: Your model perfectly predicts every Y value (rare in real life!)

R² is directly related to the correlation coefficient: R² = r². If Pearson's r = 0.85, then R² = 0.72, meaning 72% of variance is explained.

Why It Matters

R-squared is your first "goodness of fit" metric. It tells you whether your model is capturing meaningful patterns or just noise. A low R² suggests your predictor variable doesn't explain much, while a high R² indicates strong predictive power.

Key Takeaway: R-squared measures the proportion of variance in your outcome that your model explains—it's the most common metric for assessing how well your regression line fits the data.