Regression Word Problems
Reading Slope and Intercept in Context
A café recorded the outdoor temperature $x$ (in °C, from $0$ to $20$) and the number of hot drinks $y$ sold on five mornings. The regression line is $\hat{y} = 110 - 3x$. Interpret the slope and the intercept.
Identify the slope and the intercept: $\hat{y} = -3x + 110$, so $m = -3$ and $b = 110$ = $m = -3$, $b = 110$
Interpret the slope with units: For each 1 °C warmer, the predicted number of hot drinks changes by $-3$ = About 3 fewer hot drinks per extra degree, on average
Interpret the intercept with units: At $x = 0$ °C the model predicts $\hat{y} = 110 - 3 \times 0 = 110$ = About 110 hot drinks on a 0 °C morning
Check that the intercept makes sense: $0$ °C is a real temperature and it is inside the data range $0$ to $20$ = The intercept has a real meaning here
Answer: Slope: for every 1 °C rise in temperature, the café is predicted to sell about 3 fewer hot drinks. Intercept: on a 0 °C morning the model predicts about 110 hot drinks, which makes sense because 0 °C is part of the data.
Building the Least-Squares Line from Data
Five students reported their weekly study hours $x$ and their test score $y$ (out of 100): | Hours $x$ | 1 | 2 | 3 | 4 | 5 | |---|---|---|---|---|---| | Score $y$ | 52 | 60 | 68 | 76 | 74 | Find the least-squares regression line.
Find the means: $\bar{x} = \frac{1+2+3+4+5}{5} = 3$, $\bar{y} = \frac{52+60+68+76+74}{5} = \frac{330}{5} = 66$ = $\bar{x} = 3$, $\bar{y} = 66$
Find the deviations from the means: $x - \bar{x}$: $-2, -1, 0, 1, 2$; $y - \bar{y}$: $-14, -6, 2, 10, 8$ = Deviations listed
Compute the sums for the slope: $\sum(x-\bar{x})(y-\bar{y}) = 28 + 6 + 0 + 10 + 16 = 60$; $\sum(x-\bar{x})^2 = 4 + 1 + 0 + 1 + 4 = 10$ = $60$ and $10$
Find the slope: $m = \frac{60}{10} = 6$ = $m = 6$
Find the intercept: $b = \bar{y} - m\bar{x} = 66 - 6 \times 3 = 48$ = $b = 48$
Answer: The regression line is $\hat{y} = 6x + 48$: each extra hour of study per week goes with about 6 more points on the test, on average.
Interpolation or Extrapolation?
Use $\hat{y} = 6x + 48$ from the study data (hours from $1$ to $5$). Predict the score for a student who studies $2.5$ hours and for one who studies $9$ hours. Which prediction can you trust?
Predict for 2.5 hours: $\hat{y} = 6 \times 2.5 + 48 = 15 + 48 = 63$ = $\hat{y} = 63$ points
Classify the first prediction: $2.5$ lies between $1$ and $5$, inside the data = Interpolation
Predict for 9 hours: $\hat{y} = 6 \times 9 + 48 = 54 + 48 = 102$ = $\hat{y} = 102$ points
Classify and judge the second prediction: $9$ is far above $5$, and $102$ is more than the maximum of $100$ points = Extrapolation, not believable
Answer: For 2.5 hours the model predicts 63 points (interpolation, reasonable). For 9 hours it predicts 102 points, which is impossible on a 100-point test: this is extrapolation far outside the data, so the line should not be used there.
Residuals of Two Students
With $\hat{y} = 6x + 48$, find the residuals of the student who studied $4$ hours and scored $76$, and of the student who studied $5$ hours and scored $74$. What do they tell you?
Predicted score for 4 hours: $\hat{y} = 6 \times 4 + 48 = 72$ = $\hat{y} = 72$
Residual for 4 hours: $e = y - \hat{y} = 76 - 72 = 4$ = $e = 4$ (above the line)
Predicted score for 5 hours: $\hat{y} = 6 \times 5 + 48 = 78$ = $\hat{y} = 78$
Residual for 5 hours: $e = 74 - 78 = -4$ = $e = -4$ (below the line)
Answer: The 4-hour student scored 4 points more than predicted (residual $4$), the 5-hour student 4 points less than predicted (residual $-4$). In the chart above, tap a point to see its residual.
How Well Does the Line Fit? r and R²
For the café data, the residuals are $5, -10, 0, 10, -5$ and the total variation of the sales is $\sum(y - \bar{y})^2 = 2500$. Find $R^2$ and $r$ and explain them in context.
Sum of squared residuals: $25 + 100 + 0 + 100 + 25 = 250$ = $SS_{\text{res}} = 250$
Coefficient of determination: $R^2 = 1 - \frac{SS_{\text{res}}}{SS_{\text{tot}}} = 1 - \frac{250}{2500} = 1 - 0.1 = 0.9$ = $R^2 = 0.90$
Correlation coefficient: $r = -\sqrt{0.9} \approx -0.95$ (negative, because the slope $-3$ is negative) = $r \approx -0.95$
Interpret both in context: $r$: strong negative linear relationship; $R^2$: $90\%$ of the variation in hot drinks sold is explained by temperature = Strong fit, 10% left to other factors
Answer: $R^2 = 0.90$: about 90% of the variation in the number of hot drinks sold is explained by the linear relationship with temperature; the other 10% comes from other factors (weekday, events, chance). $r \approx -0.95$: a strong negative linear relationship, warmer mornings go with fewer hot drinks.
Mistake: Stating the slope as a bare number: "the slope is 6"
Why: A number without context does not answer the question. The slope is a rate: it needs both units and the word "predicted" or "on average", because real points scatter around the line.
Correct: Say: "For each extra hour of study per week, the predicted test score rises by about 6 points."
Mistake: Trusting a prediction far outside the data (extrapolation)
Why: The line was fitted only to the observed range. Outside it the pattern may change, and the line can give impossible values like a score of 120 out of 100 or a negative number of sales.
Correct: Check the range of $x$ first. Inside it: interpolation. Outside it: extrapolation, so say the prediction is unreliable.
Mistake: Computing the residual the wrong way round: $\hat{y} - y$
Why: The sign then flips, and "above the line" becomes "below the line". By convention the residual is actual minus predicted.
Correct: Always use $e = y - \hat{y}$: positive means the model underpredicted, negative means it overpredicted.
Mistake: Reading $R^2 = 0.9$ as "90% of the points lie on the line" or as "the model is right 90% of the time"
Why: $R^2$ measures how much of the variation in $y$ the linear relationship explains. Points can all be off the line and $R^2$ can still be 0.9.
Correct: Say: "90% of the variation in $y$ is explained by the linear relationship with $x$."
Biology Lab: Plant Growth
Biology students measure a seedling every week and fit a regression line to height against time to describe its growth rate.
For $\hat{y} = 2.5x + 4$ (height in cm, $x$ in weeks, data from week 0 to week 8), the slope says the plant grows about 2.5 cm per week and the intercept says it was about 4 cm tall when measuring started.
Delivery Times for an Online Shop
Delivery companies model delivery time from distance to give customers an estimated arrival time and to spot routes that are slower than expected.
With $\hat{y} = 12 + 3x$ (minutes, $x$ = distance in km, data from 1 to 10 km), a 4 km delivery is predicted to take $12 + 12 = 24$ minutes.
Phone Battery Testing
Tech reviewers relate screen-on time to battery drain and report how strongly the two are linked, so readers know how much the regression line can be trusted.
If screen time and battery used have $r = 0.8$, then $R^2 = 0.64$: 64% of the variation in battery use is explained by screen time.
Interpret the slope as a rate with units: for each 1-unit increase in $x$, the predicted $y$ changes by $m$, on average
The intercept is the predicted $y$ at $x = 0$; it only means something if $x = 0$ makes sense and is near the data
Predict by substituting $x$ into $\hat{y} = mx + b$; inside the data range this is interpolation, outside it is risky extrapolation
A residual is actual minus predicted, $e = y - \hat{y}$: positive above the line, negative below it
$r$ shows direction and strength; $R^2 = r^2$ is the share of the variation in $y$ explained by the line
A strong fit shows a link, not a cause: always answer in the words and units of the problem
Q: Does the intercept always have a meaning?
A: No. It is the predicted $y$ at $x = 0$. If $x = 0$ is impossible (a person 0 cm tall) or far from the data (a house with 0 m²), the intercept is only a number that positions the line, not something to interpret.
Q: How far outside the data can I predict?
A: There is no safe distance. A little outside the range may still be fine if the pattern clearly continues, but any extrapolation should be flagged as uncertain, and predictions far away (or impossible values) should not be used.
Q: What is the difference between r and R²?
A: $r$ is between $-1$ and $1$ and shows the direction (sign) and strength of a linear relationship. $R^2 = r^2$ is between $0$ and $1$ and tells you what share of the variation in $y$ the line explains. $R^2$ loses the sign, so check the slope for the direction.
Q: If R² is high, does x cause y?
A: Not necessarily. A high $R^2$ only says the line fits the data well. A third variable or chance can create the pattern; only a controlled experiment can show cause and effect.
Regression Word Problems
1 / 14
Regression Word Problems
Solve complete regression problems: interpret slope and intercept in context, predict, spot extrapolation, compute residuals and read r and R².