Week 8 — Simple regression
MATH 21003 · Introduction to Statistical Methods · Fall 2026 · Week 8 (Oct 12–16, 2026)
Warm-up: what is an extra thousand steps worth?
Two adults live similar lives, except that one averages about 4,000 steps a day and the other about 10,000. How much lower would you guess the second person’s resting heart rate is? Write down a number of beats per minute. Then ask two harder questions: what evidence would you want before trusting your guess, and if the more active person does have a lower heart rate, does that show that walking caused it?
In Week 5 you described relationships like this with a scatterplot and a correlation . The correlation gives the direction and strength of a straight-line pattern, but not how much the response changes when the explanatory variable changes. This week supplies that piece: a straight line fitted to the data, called a regression line.
Why a fitted line matters for evidence
Fitted lines sit behind many quantitative claims: that each extra hour of weekly exercise goes with lower average blood pressure, that counties with higher smoking rates have more hospital admissions for heart disease, that enrollment will grow next year. Reading such a claim carefully means asking four questions. What is the predicted change in the response for a one-unit change in the explanatory variable? How closely do the actual values follow the line? Is the prediction made inside the range of the data or far outside it? And was the study designed to support a causal claim, or only an association? This week gives you the tools for the first three. The fourth reaches back to study design in Week 2 and confounding in Week 6.
What you will be able to do this week
By the end of this week you can:
- write the least-squares line from regression output or from , , , and ;
- interpret the slope in context, with units, using “predicted” and “on average”;
- decide whether the intercept has a sensible meaning;
- compute a residual and explain what its sign and size say about one case;
- read a residual plot and recognize when a straight line is the wrong shape;
- interpret as the proportion of variability in the response explained by the line;
- recognize when a prediction is an extrapolation that should not be trusted;
- read the estimate and standard error columns of a regression output table.
Words to know for simple regression
| Term | What it means |
|---|---|
| Explanatory variable () | The variable used to predict; on the horizontal axis. |
| Response variable () | The variable being predicted; on the vertical axis. |
| Least-squares line | The line that makes the sum of squared residuals as small as possible; also called the regression line or fitted line. |
| Predicted value (, “y-hat”) | The response value the line gives for a particular . |
| Slope () | The predicted change in the response for each one-unit increase in , on average. |
| Intercept () | The predicted response when ; meaningful only if makes sense and lies near the data. |
| Residual | Observed minus predicted, ; positive above the line, negative below it. |
| Residual plot | Residuals graphed against , used to check whether a straight line suits the data. |
| (R-squared) | The proportion of the variability in the response that the line explains; between 0 and 1. |
| Extrapolation | Using the line to predict at values outside the range of the data. |
| Standard error (SE) | How much an estimate, such as the slope, would typically vary from one random sample to another. |
The least-squares line
A running example: daily steps and resting heart rate
The table gives illustrative values for a random sample of 10 hypothetical adults. The explanatory variable is average daily steps, in thousands; the response variable is resting heart rate, in beats per minute (bpm).
| Adult | Daily steps (thousands) | Resting heart rate (bpm) |
|---|---|---|
| A | 2.2 | 81 |
| B | 3.0 | 77 |
| C | 3.9 | 79 |
| D | 4.6 | 74 |
| E | 5.3 | 77 |
| F | 6.3 | 80 |
| G | 7.2 | 73 |
| H | 8.1 | 73 |
| I | 9.1 | 70 |
| J | 10.3 | 66 |
The summaries are thousand steps with , and bpm with . The correlation is , a strong negative association: adults who walk more tend to have lower resting heart rates. The least-squares line is
read as “predicted resting heart rate equals 84.0 minus 1.50 times daily steps in thousands.” The hat on is a reminder that the line gives a prediction, not anyone’s observed value.
Predicted values and residuals
To use the line for one adult, substitute that adult’s . Adult F averages 6.3 thousand steps, so
Adult F’s observed heart rate is 80 bpm. The gap between observed and predicted is the residual:
Always compute observed minus predicted. A positive residual means the dot is above the line: this adult’s heart rate is higher than the line predicts for that many steps. Adult D averages 4.6 thousand steps, so the prediction is bpm; the observed value is 74, so the residual is bpm, below the line. A residual is the part of a value the line does not account for: genetics, stress, caffeine or measurement error may all play a part, but the line only knows steps.
Why the line is called least squares
Many lines could be drawn through the same dots, and each gives every adult a residual. Adding the residuals would let misses above the line cancel misses below it, so instead we square each residual (making every term positive and making large misses count more) and add the squares. The least-squares line is the one line with the smallest possible sum of squared residuals.
The figure compares two ways of predicting. The left panel ignores steps and predicts the mean, 75.0 bpm, for everyone; its squared residuals add up to 200.0. The least-squares line on the right leaves only 55.3. No other straight line does better: the line looks reasonable by eye, but its squared residuals add up to about 111.4.
Every least-squares line passes through the point of averages : here , exactly . Its residuals also add up to zero, apart from rounding. For the 10 adults they are , , , , , , , , and , which sum to .
Finding the slope and intercept from summary statistics
Software usually fits the line, but the least-squares slope and intercept have short formulas built from five summaries:
The ratio converts from units of to units of , and the intercept formula forces the line through the point of averages. For the running example,
Two consequences follow. The slope always has the same sign as , because standard deviations are positive. And if , the line is flat at : knowing does not change the prediction. When computing by hand, keep three decimals in and in and round at the end.
Interpreting the slope and the intercept
The slope: predicted change per unit of x, on average
Slope sentence. “For each additional one unit of x, the predicted response is higher or lower by the size of the slope, with its units, on average.” Fill in the italic parts from the context.
For the running example: for each additional 1,000 daily steps, the predicted resting heart rate is 1.50 bpm lower, on average. Both “predicted” and “on average” matter, because individual adults scatter around the line, as Adult F does.
The units matter too. The slope is in bpm per thousand steps. Recorded in single steps, the same data give a slope of bpm per step: the same relationship in different units. So the size of a slope does not tell you how strong a relationship is; and do that.
You can scale the slope to any change in . In the warm-up, the second adult walks thousand more steps, so the line predicts a heart rate lower by bpm. Directly: and , a difference of 9.0 bpm. Compare that with your guess.
The intercept: meaningful only when x = 0 makes sense
The intercept is the predicted resting heart rate for an adult who takes no steps at all. Nobody in the data walked fewer than 2.2 thousand steps, and someone confined to bed probably differs from these adults in many ways, so 84.0 bpm is not a trustworthy prediction. Its role is to set the height of the line. Read an intercept as “the predicted response when ” only if is possible and lies inside or near the range of the data. In a study of weekly exercise minutes and blood pressure where many adults reported 0 minutes, the intercept would be the predicted blood pressure for adults who do not exercise, a meaningful quantity.
Reading a regression output table
Software reports a fitted line as a table of coefficients. For the running example:
| Term | Estimate | Std. error |
|---|---|---|
| Intercept | 84.00 | 2.13 |
| Daily steps (thousands) | -1.50 | 0.33 |
R-squared = 0.724, with adults.
The Estimate in the Intercept row is , and the Estimate in the row named after the explanatory variable is the slope , so the table says . Programs label things differently, and many add a test statistic and a p-value, which you will learn to read in Week 12.
The Std. error column describes sampling variability. A different random sample of 10 adults would give a somewhat different line, and the slope’s standard error, 0.33 bpm per thousand steps, measures how much the slope estimate would typically vary from sample to sample. Here the estimate is about standard errors from zero. A slope several standard errors from zero is hard to explain as sampling variation alone; later weeks make this precise.
Residuals and R-squared: how well does the line fit?
Reading a residual plot
A residual plot puts on the horizontal axis and each residual on the vertical axis, with a reference line at 0. It is like tilting the scatterplot until the fitted line lies flat, which makes departures easy to see. You hope to see a shapeless band of dots above and below zero with about the same spread everywhere, as in the running example.
Three patterns call for caution:
- A curve (an arch or a U): the relationship is not straight, and the line misses systematically.
- A fan, where residuals spread out as grows: predictions are less precise for some values than others.
- A residual far from the rest: a possible recording error or a different kind of case. One extreme case can pull the whole line; such a case is called influential, as in the sleep and reaction-time example of Week 5.
The next figure shows a curve. Hypothetical test drives of one car at ten steady speeds from 35 to 80 miles per hour give a straight line for fuel efficiency in miles per gallon (mpg), with , which sounds respectable. But the residual is mpg at 35 mph, rises to mpg at 55 mph, and falls back to mpg at 80 mph. The line predicts too high at both ends and too low in the middle. The summary “each extra mile per hour costs 0.30 mpg” hides the real shape: efficiency barely changes from 35 to 55 mph, then drops quickly.
Prediction and the danger of extrapolation
Predicting inside the range of the data
For an adult averaging 5,000 steps a day, bpm. Because 5.0 lies inside the observed range of 2.2 to 10.3 thousand steps, the data support this prediction. Read it as an estimate of the average heart rate among such adults; an individual could be several bpm away, since residuals here reach 5.45 bpm.
Extrapolation: when the line runs past the data
A fitted line describes the data only over the observed range of . Beyond it, the true pattern may bend, level off or stop making sense, and the data cannot warn you. Using the line there is extrapolation.
Consider 9 hypothetical children, one at each age from 2 to 10, with heights of 87, 95, 103, 109, 116, 122, 128, 133 and 139 cm. The least-squares line is , with in years and in centimeters, and the fit is nearly perfect: . Across these ages, predicted height is about 6.4 cm greater for each additional year of age. Now ask the line about a 30-year-old:
about 269 cm, or nearly 8 feet 10 inches. That is absurd: human growth slows and stops around the end of the teenage years, so the childhood pattern does not continue.
A nearly perfect fit inside the data says nothing about outside it. Interpreting an intercept is often extrapolation too, as in the steps example.
Before you predict, check the range. If the value is outside the data, say so and treat the result as a guess about a pattern the data never showed.
Worked example 1: a sleep and reaction-time line from summary statistics
The question. In a hypothetical study, 25 college students reported how many hours they slept the night before and then took a computer reaction test, timed in milliseconds (ms); smaller is faster. Sleep ranged from 4.5 to 9.0 hours. Mean sleep was hours with ; mean reaction time was ms with ; the correlation was . Find the least-squares line, interpret it, find , and predict the reaction time after 8 hours of sleep.
Step 1: variables. The explanatory variable is hours of sleep; the response is reaction time in ms.
Step 2: slope and intercept.
Step 3: equation and check. The line is . It passes through the point of averages: ms.
Step 4: interpret. For each additional hour of sleep, the predicted reaction time is 15.5 ms shorter (faster), on average. The intercept, 395.4 ms, is the prediction for 0 hours of sleep. Zero hours is far outside the data (the least sleep was 4.5 hours), so the intercept only positions the line.
Step 5: . . About 38% of the variability in reaction times is explained by the linear relationship with sleep; the other 62% comes from other differences among students.
Step 6: predict. Eight hours is inside the observed range:
For 6 hours, ms; the difference, 31.0 ms, is two hours times 15.5 ms per hour.
Conclusion in context. In this hypothetical sample, students who slept more tended to react faster: the predicted reaction time is about 15.5 ms faster per extra hour of sleep, on average, with a predicted reaction time of about 271 ms after 8 hours. Sleep explains only about 38% of the variability, so individuals scatter widely around the line. Because students chose their own sleep, this is an association: students who sleep more may also differ in caffeine use, stress or schedules. A causal claim would need a randomized experiment that assigned amounts of sleep.
Worked example 2: reading output for age and blood pressure
The question. A hypothetical health survey measured systolic blood pressure, in millimeters of mercury (mmHg), for a random sample of 40 adults aged 25 to 70, with age in years as the explanatory variable. The output was:
| Term | Estimate | Std. error |
|---|---|---|
| Intercept | 98.2 | 5.3 |
| Age (years) | 0.62 | 0.11 |
R-squared = 0.46, with adults.
Write the line, interpret the slope and intercept, find the residual for a 50-year-old whose blood pressure is 140 mmHg, and interpret , and the slope’s standard error.
Step 1: the equation. From the Estimate column, .
Step 2: slope and intercept. For each additional year of age, the predicted systolic blood pressure is 0.62 mmHg higher, on average, or mmHg per decade. The survey compares different people at one moment, so the slope describes differences between age groups, not what happens as one person ages. The intercept, 98.2 mmHg, is the prediction at age 0, far outside the data (the youngest adult was 25), so it has no useful meaning here.
Step 3: a residual.
This person’s blood pressure is 10.8 mmHg above the line’s prediction for age 50. By contrast, a 30-year-old with 110 mmHg has mmHg and a residual of mmHg, below the line.
Step 4: and . About 46% of the variability in systolic blood pressure is explained by the linear relationship with age. The correlation is the square root of with the sign of the slope: , a moderately strong positive association.
Step 5: the standard error. The slope’s standard error, 0.11 mmHg per year, describes how much the slope estimate would typically vary from one random sample of 40 adults to another. The estimate is about standard errors above zero, so sampling variation alone is an unlikely explanation for the positive slope; Week 12 makes this reasoning formal.
Conclusion in context. Among these 40 hypothetical adults, predicted systolic blood pressure rises by about 0.62 mmHg per year of age, about 6 mmHg per decade, on average. Age explains about 46% of the variability, so adults of the same age still differ a great deal, as the 50-year-old 10.8 mmHg above the line shows.
Transfer: the same reasoning for used-car prices
The same moves work in a different setting. A hypothetical set of 30 online listings for one model of used car records each car’s age (1 to 10 years) and listed price (in thousands of dollars):
| Term | Estimate | Std. error |
|---|---|---|
| Intercept | 24.6 | 0.9 |
| Age (years) | -1.85 | 0.15 |
R-squared = 0.84, with listings.
Line and slope. . For each additional year of age, the predicted listed price is 1.85 thousand dollars (1,850 dollars) lower, on average.
Intercept. Age 0 (a new car) is possible and only one year below the youngest car in the data, so the intercept, 24.6 thousand dollars, is a mild extrapolation rather than nonsense. With no new cars in the data, treat it as the line’s rough guess, not a new-car price.
Residual. A 6-year-old car is listed at 11.5 thousand dollars. Its predicted price is , so its residual is thousand dollars: 2,000 dollars below the line’s prediction for its age. The residual flags the listing as unusual but does not say why: the car might be a bargain, or it might have high mileage or damage.
. About 84% of the variability in listed prices is explained by the linear relationship with age; mileage, condition and features may account for much of the rest.
Extrapolation. For a 12-year-old car the line predicts thousand dollars, which looks plausible but is outside the data. For a 14-year-old car it predicts thousand dollars, an impossible negative price; the line reaches zero at years. The 12-year prediction is also an extrapolation. It looks sensible, but the data cannot confirm it, and the further you go past 10 years the less the line can be trusted, as the impossible 14-year value shows.
Conclusion in context. Among these 30 hypothetical listings, older cars were listed for less: the predicted listed price is about 1,850 dollars lower per year of age, on average, and age explains about 84% of the variability in listed price. The line should not be used for cars older than 10 years, the oldest in the data.
What carried over. Read the equation from the Estimate column, state the slope with units, check whether makes sense, compute residuals as observed minus predicted, read as a share of variability explained, and check the range before predicting.
A common misreading: the slope shows what would happen if you changed x
A tempting sentence about the running example is: “The slope is , so if you walk 1,000 more steps a day, your resting heart rate will drop by 1.5 bpm.” This reads the slope as the effect of changing one person’s , which these data cannot support:
- The slope compares different people. Nobody in the data changed their walking, so the data say nothing direct about what happens when someone does.
- Confounding. Adults who walk more may also be younger, smoke less or eat differently, and the slope bundles all of that together with walking (Week 6).
- Direction. People whose hearts are already in good condition may find it easier to walk a lot; this is called reverse causation.
A careful version is: “Among these adults, those who walked 1,000 more steps a day had resting heart rates 1.50 bpm lower, on average, according to the fitted line.” A causal claim would need a randomized experiment that assigned walking programs (Week 2).
A related slip is to read a large slope as a strong relationship. As the slope section showed, a slope’s size depends on its units; strength is measured by and .
Practice questions for this week (ungraded)
- In a hypothetical study of 50 adults, weekly hours of exercise () and resting heart rate in bpm () have , , , and . Find the least-squares line and interpret its slope in one sentence. What to look for: find before , and use units, “predicted” and “on average.”
- Using , find the residual for Adult J (10.3 thousand steps, 66 bpm). Is Adult J above or below the line? Check your work against the residual plot.
- A hypothetical line predicts daily emergency-room visits for heat-related illness from the day’s high temperature, fitted to days with highs from 80 °F to 105 °F: . Does the intercept have a useful meaning? What does the line predict for a 70 °F day, and why not trust it?
- In a hypothetical sample of children aged 6 to 12, a regression of reading level on shoe size has . A parent concludes that bigger feet help children read. Explain what 0.64 means and what is wrong with the conclusion. What to look for: a variable related to both.
- A residual plot shows residuals tightly clustered near zero for small and spreading widely for large , with no curve. What does this say about predictions from the line?
- Two students fit a line to the same distance and travel-time data, one with distance in miles and one in kilometers. Will their slopes match? Will their values match? Explain briefly.
Read further on simple regression
- Introduction to Modern Statistics, Chapter 7, Linear regression with a single predictor: fitting a line, residuals, least squares, and outliers, with more examples. The book shows R code in places; skip the code and read the output and explanation.
- Optional, for biomedical examples: Vu and Harrington, Introductory Statistics for the Life and Biomedical Sciences, Chapter 6, Simple linear regression, free from OpenIntro’s biostatistics book page.
- In StatKey, open Descriptive Statistics and Graphs, then Two Quantitative Variables. Choose a built-in dataset, look at the scatterplot, correlation and fitted line, and ask whether a straight line suits the pattern.
Where this goes next: more than one explanatory variable
The steps example raised age, smoking and diet as possible confounders, and a single slope cannot separate them. Next you will read regression output with several explanatory variables, where each slope is interpreted with the others held fixed (an adjusted comparison), and meet logistic regression for yes-or-no outcomes. The Estimate column, slopes with units, residuals and caution about extrapolation all carry forward.