AZTest
Statistics study guide · step 7 of 7

Correlation and regression line problems: predictions and residuals

A regression line is the best straight line through a scatter of points; the correlation coefficient r, from −1 to 1, measures how close the points lie to a line.

Key ideas

Watch out: The regression line always passes through the point of means (x̄, ȳ).

Practise this step

5 questions from this step only, in 8 minutes: new numbers and stories every time, of exactly the types worked out below. Marked at the end, with every question worked out.

Start the 5-question quiz

Every question type in this step, worked out

6 types of question. Try each one yourself before you open the hint or the solution.

Example 1 · level 7

A kiosk's daily ice-cream sales y follow the line y = −33 + 6t, where t is the temperature in °C. On a day of 27 °C the kiosk sold 96 ice creams. What is the residual for that day?

°Csoldt = 27y = 96e = ?
Hint

The residual is the actual value minus the value the line predicts. It is negative when the point lies below the line.

Worked solution
°Csoldt = 27y = 96e = −33
e=y−(a+bt)
  1. Predicted: −33 + (6 × 27) = −33 + 162 = 129
  2. Actual: 96
  3. Residual: 96 − 129 = −33

Answer: −33 ice creams

Example 2 · level 8

For a class, the mean revision time was 5.5 hours and the mean test score 72. The regression line of score on revision time crosses the score axis at 50. What score does the line predict for 5 hours of revision?

hoursscorea = 50x̄ = 5.5ȳ = 72x = 5y = ?
Hint

The regression line always passes through the point of the two means.

Worked solution
hoursscorea = 50x̄ = 5.5ȳ = 72x = 5y = 70
y=a+bxb=y¯−ax¯
  1. Slope: (72 − 50)/5.5 = 22/5.5 = 4
  2. The line: y = 50 + 4x
  3. Prediction: 50 + (4 × 5) = 50 + 20 = 70

Answer: 70 points

Example 3 · level 10

For the heights x and arm spans y of a group of people, the sum of the squared deviations of x from its mean is 64, that of y is 100, and the sum of the products of the deviations is 56. What is the correlation coefficient r?

−1−0.500.51r = ?Sxx = 64Syy = 100Sxy = 56
Hint

r is the sum of the products divided by the square root of the product of the two sums of squares.

Worked solution
−1−0.500.51r = 0.7Sxx = 64Syy = 100Sxy = 56
r=SxySxxSyy
  1. 64 × 100 = 6400
  2. √6400 = 80
  3. r = 56/80 = 0.7

Answer: 0.7

Example 4 · level 10

A shop tried 10 different prices for a drink. For the prices x (in euros) and the numbers sold y, the sum of the x's is 90, the sum of the y's is 360, the sum of the products xy is 3275 and the sum of the squares of x is 830. What number of sales does the least-squares line predict at a price of 7 euros?

eurossoldx = 7y = ?
Hint

The slope is (n·Σxy − Σx·Σy)/(n·Σx² − (Σx)²), and the line passes through the two means.

Worked solution
eurossoldx̄ = 9x = 7y = 32.5
b=n∑xy−∑x∑yn∑x2−(∑x)2y=y¯+b(x−x¯)
  1. Slope: 350/200 = 1.75
  2. Means: x̄ = 90/10 = 9 and ȳ = 360/10 = 36
  3. Prediction: 36 + (1.75 × (−2)) = 36 − 3.5 = 32.5

Answer: 32.5 drinks

Example 5 · level 10

On many days a café recorded the highest temperature and the number of cold drinks it sold. The temperature has a mean of 15 °C and a standard deviation of 2 °C; the number of cold drinks sold has a mean of 200 and a standard deviation of 30. The correlation between them is 0.15. How many cold drinks does the regression line of sales on temperature predict for a day of 19 °C?

x̄ = 15ȳ = 200x = 19ŷ = ?r = 0.15
Hint

The slope of the regression line is r times the standard deviation of y divided by that of x, and the line passes through the two means.

Worked solution
x̄ = 15ȳ = 200x = 19ŷ = 209 drinksr = 0.15
y^=y¯+rsysx(x−x¯)
  1. Slope: 0.15 × 30/2 = 2.25
  2. 19 is 4 from the mean, so the sales are 2.25 × 4 = 9 from their mean
  3. Prediction: 200 + 9 = 209

Answer: 209 drinks

Example 6 · level 10

Two judges ranked the same five cakes, A to E. The first judge gave them the ranks 2, 3, 5, 1 and 4 and the second judge the ranks 5, 2, 1, 4 and 3, in that order. What is Spearman's rank correlation between the two judges?

judge 1judge 2ABCDE1122334455r = ?
Hint

For each cake, square the difference d of its two ranks. Then r = 1 − 6Σd²/(n(n² − 1)) with n = 5.

Worked solution
judge 1judge 2ABCDE1122334455r = −0.8
rs=1−6∑d2n(n2−1)
  1. Squared differences, A to E: 9, 1, 16, 9 and 1, together 36
  2. n(n² − 1) = 5 × 24 = 120, and 6 × 36 = 216
  3. r = 1 − 216/120 = −0.8

Answer: −0.8

Ready for the quiz?

Check yourself on this step: 5 questions, 8 minutes.

Start the quiz

All steps of the Statistics study guide

  1. Mean and median

    The score you still need, a combined mean, a wrong entry, and means and medians from tables.

  2. Spread: range, IQR and standard deviation

    Quartiles and outliers, mean absolute deviation, standard deviation and what scaling does to it.

  3. Grouped data and histograms

    Estimate a mean or median from class intervals and read histograms with frequency density.

  4. Index numbers, growth rates and tables

    Price indices, chained percentage changes, average growth rates, moving averages and two-way tables.

  5. The normal distribution

    z-scores, the 68-95-99.7 rule, percentages above a value and finding the mean or SD.

  6. Sampling and confidence intervals

    Estimate a population, share a sample out fairly, and build or plan a confidence interval.

  7. Correlation and regression

    Predict from a regression line, find it from sums or from r, residuals and Spearman's rank.

When every step feels easy, take the whole Statistics test: 10 questions in 15 minutes.