StatsQuest · Science Museum · Statistics

Correlation and Regression

Plot two quantitative variables first. Then r measures the linear strength and the least squares line predicts.

PDFBack to the game

After this guide you can

Key terms

Explanatory variable x
The variable that may explain or predict; on the horizontal axis.
Response variable y
The outcome; on the vertical axis.
Correlation r
Strength and direction of a linear relationship, from −1 to 1.
Least squares line
The line that makes the sum of squared residuals as small as possible.
Slope b
b = r(s_y/s_x); predicted change in y for each 1 unit increase in x.
Residual
Observed − predicted: y − ŷ.
r²
The share of the variation in y explained by the linear model.
Extrapolation
Predicting outside the range of the x data; risky.

The big ideas

Scatterplot of study hours and scores with the least squares line and one residual marked0123456789105060708090100ŷ = 52 + 4.5x(6, 82): residual = 82 − 79 = +3hours studied (x, explanatory)score (y, response)

A residual is the vertical gap from a point to the line.

Worked example

Study hours x and scores y give ŷ = 52 + 4.5x with r = 0.8. Interpret, predict for 6 hours, and find the residual for a student at (6, 82).

  1. Slope: each extra hour predicts 4.5 more points on average.
  2. Intercept: 0 hours predicts 52 points (meaningful only if 0 hours is in the data range).
  3. ŷ = 52 + 4.5(6) = 79. Residual = 82 − 79 = +3, so this student scored 3 points above the line.
  4. r² = 0.64: 64% of the variation in scores is explained by hours.

Answer: Prediction 79; residual +3; r² = 0.64

Common mistakes

Check yourself

  1. r = −0.9. Describe it.
  2. Can r be 1.3?
  3. ŷ = 10 + 2x. Predicted y at x = 7?
  4. Observed 20 at x = 7 with that line. Residual?
  5. r = 0.5. r²?
  6. Ice cream sales and drownings correlate. Why?
  7. A residual plot shows a U shape. What does that mean?
  8. One point far to the right changes the slope a lot. What is it called?

Answer key

  1. Strong negative linear association. Close to −1.
  2. No. r is always between −1 and 1.
  3. 24. 10 + 14.
  4. −4. 20 − 24.
  5. 0.25. 25% of variation explained.
  6. A lurking variable: hot weather. Correlation is not causation.
  7. A line is not the right form. The relationship is curved.
  8. An influential point. High leverage in x.

1 Design2 Describing3 Probability4 Normal5 CLT6 Intervals7 Tests9 Chi-square, ANOVA10 Health stats11 Full review