← Back to the Introduction to Statistics outline The Course Maker
← Introduction to Statistics outline
Week 15 · Chapter

Chapter 15 — Linear Regression & Inference for the Slope

Introduction to Statistics Free sample edition

The module's primary reading · ~50–60 minutes · Objective 8 (fit and interpret a simple linear regression model, assess its fit with r-squared and residuals, and carry out inference for the slope), Objective 3 (describe the relationship between two variables using scatterplots, the correlation coefficient, and two-way tables, and explain why association alone does not establish causation) · Read it first this week; the lecture, the tutorial, the quiz, and the Data Lab all build on it.


In plain language

This week you learn to draw the one straight line that best fits a cloud of points and to use it to predict (make an informed guess about) one measurement from another. You will read what the line's tilt and starting point mean in real units, measure how far the line usually misses, and say how much of the story the line tells. Then you will ask whether the tilt is real or a fluke of one sample, using the same test-and-interval thinking you built in Weeks 11 to 14. You will also learn where a line stops being trustworthy, and why one odd point can drag it around. It is the last new idea of the course, and it pulls almost every earlier idea together.

Why you already care about this

A ride-share app shows a fare before you book. A fitness watch guesses how many calories a run burned. A nurse estimates a child's healthy weight range from height. Each of those numbers is a prediction. Somebody used one thing they could measure to guess another thing they cared about.

Field biologists do the same with penguins. Weighing a penguin is slow: you need a calm bird, a bag, and a scale. Measuring a flipper is quicker. In Week 4 you saw that across 342 penguins, longer flippers go with heavier bodies, with r = 0.8712. That told you the two move together. It did not tell you what to predict. If a penguin's flipper is 200 mm long, what body mass should you expect, and how far off might you be?

That is this week's question, and a straight line answers it. You will build the line, read it, check it, and test it. You will also learn to say plainly when a line should not be trusted.

By the end of this chapter you will be able to:

  • read the least-squares line ŷ = b₀ + b₁x from software output and explain why it is the best-fitting line;
  • interpret the slope and the intercept in the units of the problem, and say when the intercept has no meaning;
  • make a prediction and tell interpolation from extrapolation;
  • compute a residual and read the residual standard error as the typical size of a miss;
  • interpret r² as a share of variation, not a share of points;
  • read a residual plot for a curve or a fan;
  • check the conditions, run the t test for the slope, and interpret a confidence interval for the slope;
  • spot an influential point and explain why a strong slope still shows association, not causation.

Carry this sentence with you: a line predicts inside its data — not beyond it.

Where we are

  • Already covered: Weeks 1 to 3 taught you to describe one variable. Week 4 related two variables with a scatterplot and r. Weeks 5 to 10 built chance, the normal model, and the standard error. Weeks 11 to 14 built confidence intervals and hypothesis tests.
  • This week: the least-squares line, the slope and intercept, prediction, residuals, r², residual plots, the t test and confidence interval for the slope, extrapolation, and influential points. It closes the course's last unit, which asks one question: can I model one variable from another, and should I?
  • How they connect: the line is Week 4's scatterplot with a model drawn through it, and the test for its slope is Week 14's t test in a new setting.
  • Where we're going next: this is the last module of new material. Next comes finals week, with no new lessons; the cumulative final asks you to use everything at once.

Five earlier weeks matter most here. Week 4 gave you the explanatory variable x (the variable that may help explain or predict the other) and the response variable y (the variable you want to predict). It also gave you the correlation r, a unitless number from −1 to 1 that measures a straight-line pattern. Week 4 also taught you that association is not causation. Week 10 gave you the standard error, how much a statistic typically wobbles from sample to sample. Week 11 gave you the t distribution, degrees of freedom, and the critical value t*. Weeks 13 and 14 gave you the null hypothesis H₀, the alternative hypothesis Hₐ, the p-value, and the t statistic. This week those tools meet a line.

1. Fit the least-squares line: the line with the smallest squared misses

Picture the Week 4 scatterplot: 342 dots, one per penguin, rising from lower left to upper right. Now lay a ruler across it. You could tilt the ruler many ways. Some tilts follow the cloud well; others cut across it. Which tilt is best?

Here is a fair way to judge. For each dot, measure the vertical gap between the dot and the ruler. That gap is how far the line missed that bird's real mass. Some gaps are above the line and some below, so square each gap to make it positive, then add up all the squares. The best line is the one that makes that total as small as possible.

That line has a name, and it has an equation.

  • The least-squares regression line is the straight line ŷ = b₀ + b₁x that makes the sum of the squared residuals as small as possible; it is the line regression software reports.
  • A predicted value is the value of the response variable that a regression line gives for a chosen value of x, written ŷ and read "y hat"; it is an estimate, not an observation.

The little hat on ŷ matters. Plain y is a bird's real, measured mass. ŷ is the mass the line predicts. Say "predicted" every time you mean ŷ. The vertical gap you squared is the residual, which Section 5 names properly.

Worked example — the penguin line. Software fits the line to all 342 penguins with both measurements.

  1. Name the variables. x (the explanatory variable) is flipper length in mm. y (the response variable) is body mass in g. The sample has n = 342 penguins.
  2. Read the output. Software reports ŷ = −5,780.8314 + 49.6856x. The first number is the intercept b₀, in grams. The second is the slope b₁, in grams per millimetre.
  3. Check one property. The least-squares line always passes through the point of means, (x̄, ȳ). The given inputs are x̄ = 200.9152 mm and ȳ = 4,201.7544 g. Plug x̄ into the line and you get 49.6856 × 200.9152 − 5,780.8314 ≈ 4,201.76 g, which is ȳ up to rounding.

In words: the line runs right through the middle of the cloud, at the average flipper and the average mass. A field team that only has a tape measure can now turn any flipper length into a predicted mass.

In practice (your tools). Load the field log into Google Sheets with the same =IMPORTDATA(...) formula you used in Week 1, so flipper length lands in column E and body mass in column F. Then =SLOPE(F2:F345,E2:E345) returns the slope and =INTERCEPT(F2:F345,E2:E345) returns the intercept. Put y first and x second; the order matters here, unlike with =CORREL. To see the line on the Week 4 scatterplot, open the Chart editor, choose Customize, then Series, and tick Trendline. In Excel, =SLOPE and =INTERCEPT work the same way, and you add the line with Chart Elements, then Trendline, then Linear.

Misconception check — "the best line goes through as many points as possible". Students often think the best line is the one that hits the most dots exactly. It is tempting, because "fits" sounds like "touches." But with 342 scattered birds, almost no line touches more than a handful, and a line chosen to touch a few could miss the rest badly. The cure: judge a line by its misses. Least squares makes the total of the squared misses as small as it can be.

2. Read the slope: grams per millimetre, not a correlation

The slope is the line's tilt. In everyday words, it answers "if x goes up by one, how much does the prediction go up?" For the penguins, x goes up one millimetre at a time.

  • The slope is the number b₁ that gives the predicted change in y for each one-unit increase in x; it equals r × s_y ⁄ s_x, so it carries units and is not the correlation.

That formula, b₁ = r × s_y ⁄ s_x, shows how the slope and r are linked. Here s_y is the sample standard deviation of y and s_x is the sample standard deviation of x. The correlation r has no units. The ratio s_y ⁄ s_x turns it into grams per millimetre.

Worked example — rebuilding the slope from r. The given inputs are r = 0.8712, s_y = 801.9545 g, and s_x = 14.0617 mm.

  1. Multiply r by s_y. That keeps the correlation's direction and strength.
  2. Divide by s_x. That converts "standard deviations" into real units.
  3. Compute. 0.8712 × 801.9545 ⁄ 14.0617 ≈ 49.69 g per mm, rounded to two decimals. That matches the reported slope up to the rounding of r.

Now say it in words: each additional millimetre of flipper length predicts about 49.69 g more body mass. Scale it up and the meaning gets clearer. Ten more millimetres predict 10 × 49.6856 ≈ 496.86 g more, about half a kilogram. A field biologist can use that to plan how heavy a bag a longer-flippered bird needs.

Notice the careful words: "predicts," and "on average." The slope does not promise that every bird with a longer flipper is heavier. It describes the trend of the cloud.

Misconception check — "the slope is the correlation". Students often read 49.69 and 0.8712 as two versions of the same thing, or expect the slope to sit between −1 and 1. It is tempting, because both describe the same tilted cloud. But r has no units and never leaves −1 to 1, while the slope carries units and can be any size. Measure flipper length in centimetres instead of millimetres and the slope becomes ten times bigger, while r stays 0.8712. The cure: always say the slope's units out loud, "grams per millimetre," and keep r for strength.

3. Read the intercept, then distrust it

Every line has to start somewhere. The intercept is where the line crosses the vertical axis, the predicted y when x is 0.

  • The intercept is the number b₀ that gives the predicted y when x is 0; it anchors the line, and it has no real-world meaning when x = 0 lies far outside the observed data.

Sometimes the intercept means something. If x were hours of practice and y a test score, x = 0 could be a real student who did not practice. For the penguins, though, the intercept is a warning.

Worked example — a penguin with no flipper. Set x = 0 mm in the line.

  1. Plug in. At x = 0 mm, ŷ = −5,780.83 g, rounded to two decimals.
  2. Check against reality. A negative mass is impossible.
  3. Check against the data. 0 mm is far below the smallest observed flipper of 172 mm, so the intercept has no physical meaning here.

In words: the intercept is a construction number. It sets the line's height so that the line fits the birds you have. No real penguin will ever be weighed at −5,780.83 g, and a field team should never report that number as a finding.

Misconception check — "every intercept has a story". Students often try to interpret every intercept, writing something like "a penguin with a 0 mm flipper weighs −5,780.83 g." It is tempting, because the slope had a clean story. But the intercept is a prediction at x = 0, and a prediction far outside the data is not trustworthy. The cure: before you interpret b₀, ask whether x = 0 is inside, or at least near, the observed values of x. If it is not, say that the intercept has no meaning in context.

4. Predict inside the data: interpolation

Now use the line for its real job. A field team measures a flipper of 200 mm. What body mass should they expect?

Worked example — a 200 mm flipper. Use the line ŷ = −5,780.8314 + 49.6856x.

  1. Multiply first. At x = 200 mm, 49.6856 × 200 = 9,937.12.
  2. Then add the intercept. 9,937.12 − 5,780.8314 ≈ 4,156.29, so the predicted body mass is 4,156.29 g, rounded to two decimals.
  3. Check the range. 200 mm sits inside the observed flipper range of 172 mm to 231 mm, so this prediction is interpolation, inside the data the line was built from.

In words: a penguin with a 200 mm flipper is predicted to weigh about 4,156 g. A researcher deciding whether a bird is unusually light for its size can compare its real mass with that number.

A second prediction shows the slope at work. At x = 210 mm, you get ŷ = 49.6856 × 210 − 5,780.8314 ≈ 4,653.14 g. Ten more millimetres added almost exactly the 496.86 g that the slope promised, give or take 0.01 g of rounding.

  • Interpolation is using a regression line to predict y at an x value inside the range of the x values the line was built from.

In practice (your tools). In Google Sheets, =FORECAST(200,F2:F345,E2:E345) returns the predicted mass for a 200 mm flipper, about 4,156.29. In Excel, =FORECAST.LINEAR(200,F2:F345,E2:E345) does the same. You can also type the line yourself: put the slope in one cell and the intercept in another, then compute intercept + slope × 200.

Misconception check — "a prediction is what this bird weighs". Students often treat ŷ as a promise about one bird. It is tempting, because the line gives a single, precise-looking number. But ŷ is the line's estimate of the average mass for birds with that flipper length. Individual birds scatter above and below it. The cure: write "predicted" every time, and pair a prediction with the typical miss you will meet in the next section.

5. Measure each miss: residuals and the residual standard error

A prediction is a guess, so it misses. The size of the miss tells you how good the guess was. Think of a weather app that predicted 20 degrees on a day that reached 23; it missed by 3 degrees, on the warm side.

  • A residual is the observed value of the response minus its predicted value, y − ŷ, for one individual; a positive residual means the point lies above the line and a negative residual means it lies below.

Worked example — two hypothetical birds. These birds are teaching cases, not rows of the data.

  1. A heavy bird. Suppose a field team weighs one new penguin with a 200 mm flipper at 4,500 g. Its residual is y − ŷ = 4,500 − 4,156.29 = 343.71 g, so it is about 344 g heavier than the line predicts.
  2. A light bird. Suppose another hypothetical bird has a 210 mm flipper and weighs 4,400 g. Its residual is 4,400 − 4,653.14 = −253.14 g, so it is about 253 g lighter than predicted.

The order of subtraction matters. Always take observed minus predicted. Then a positive residual means "above the line," and a negative one means "below."

One bird's miss is a single story. To describe the whole cloud, you want the typical size of a miss.

  • The residual standard error is the typical size of a residual in the units of y, computed from the residuals with n − 2 in the denominator; it describes how far observed values usually fall from the regression line.

Worked example — how big is a typical miss? Compare two ways to guess a bird's mass.

  1. Guess with the line. The residual standard error is the given input 394.2782 g, about 394.28 g.
  2. Guess without the line. If you ignored flipper length and predicted every bird at the overall mean, your typical miss would be about the standard deviation of body mass, 801.95 g.
  3. Compare. The line cuts the typical miss roughly in half, because 394.28 ⁄ 801.95 ≈ 0.49.

In words: knowing the flipper length shrinks a typical prediction miss from about 802 g to about 394 g. That is a real gain for a field team. It is not perfection: a miss of a few hundred grams is still common.

In practice (your tools). In Google Sheets or Excel, =STEYX(F2:F345,E2:E345) returns the residual standard error, about 394.28. To get every residual, put each bird's predicted mass in a new column with the line, then subtract it from the real mass in column F.

Misconception check — "residual means predicted minus observed". Students often subtract in the wrong order and then misread the sign. It is tempting, because "predicted" comes first when you build the line. But the course's residual is y − ŷ, observed minus predicted. With the wrong order, the 4,500 g bird would look 344 g light instead of 344 g heavy. The cure: say "what happened minus what the line said" every time.

6. Read r squared: a share of variation, not a share of points

Body masses vary a lot from bird to bird. Some of that variation lines up with flipper length; the rest does not. r² measures the first part.

  • The coefficient of determination is the number r², the square of the correlation coefficient, giving the share of the variation in the response that the least-squares line accounts for; it is not the share of points on the line.

Worked example — the penguins' r². Start from the correlation you met in Week 4.

  1. Square r. Square the given input r, and you get r² ≈ 0.76; software reports the given input 0.759.
  2. Turn it into a percentage. Flipper length accounts for about 75.9% of the variation in body mass, and about 100% − 75.9% = 24.1% is left to other things.
  3. Name the other things. That leftover share comes from whatever the line does not see, such as differences between birds that flipper length does not capture.

In words: if you know a penguin's flipper length, you have accounted for about three quarters of the bird-to-bird differences in mass. A researcher choosing between a quick flipper measurement and a slow weighing can use that share to decide whether the quick measure is good enough for the job.

Misconception check — "r² = 0.76 means 76% of the points are on the line". Students often read r² as a share of dots. It is tempting, because a percentage of a scatterplot sounds like a count of dots. But almost none of the 342 birds sit exactly on the line; r² = 0.759 does not mean that 75.9% of the penguins sit on the line. It is a share of variation, not a share of points. The cure: say "accounts for about 75.9% of the variation in body mass" and never "75.9% of the birds."

7. Read a residual plot: band, curve, or fan

A line can have a high r² and still be the wrong shape. A residual plot is how you check.

  • A residual plot is a scatterplot of the residuals against x with a reference line at 0; a shapeless band supports a straight line, while a curve or a widening fan warns against it.

Think of it as the scatterplot with the line's tilt removed. Every dot now shows only its miss. Three patterns matter.

  • A shapeless horizontal band, centered on 0, tells you the straight line fits.
  • A curve, such as a U or an upside-down U, tells you the form is wrong.
  • A fan that widens from left to right tells you the spread is not equal: the line misses by more at some values of x than at others.

Worked example — when a straight line is the wrong shape. Use the six faces of a die, the games-of-chance dataset from Week 1.

  1. Score each face. Score each die face x by y = (x − 3.5)², giving 6.25, 2.25, 0.25, 0.25, 2.25, 6.25 for faces 1 to 6.
  2. Recall the correlation. In Week 4 you saw r = 0 for these scores.
  3. Fit the line. The least-squares line is flat: b₁ = 0, and ŷ = 17.5 ⁄ 6 ≈ 2.92 for every face, rounded to two decimals.
  4. Find the residuals. Subtract 2.92 from each score. The residuals are about 3.33, −0.67, −2.67, −2.67, −0.67, 3.33, each rounded to two decimals.
  5. Read the plot. Plot those six residuals against the faces. They form a U shape, so a straight line is the wrong form for these data, even though r² = 0.

In words: the scores follow a perfect pattern, yet the line sees none of it, because the pattern is curved. A game designer who trusted the flat line would conclude that the face does not matter, which is exactly wrong.

In practice (your tools). In Google Sheets, put each residual in a new column, then select the x column and the residual column and insert a Scatter chart. In Excel, do the same with Insert, then Insert Scatter (X, Y). You build the penguins' residual plot in this week's Data Lab and describe its shape in words.

Misconception check — "a high r² means the line is the right model". Students often stop at r² and skip the residual plot. It is tempting, because a big r² feels like a passing grade. But r² measures how much variation a straight line accounts for, not whether a straight line is the right shape. A curved pattern can give a large r² and still leave a clear U in the residuals. The cure: always look at the residual plot before you trust a line, whatever r² says.

8. Test the slope: from the sample line to the population line

The 342 penguins are a sample. A different field season would catch different birds and give a slightly different line. So the slope, like a sample mean, wobbles. The question for inference is whether the real tilt in the population could be zero.

Start with the population version of the line.

  • The population regression line is the line μ_y = β₀ + β₁x that gives the mean of the response at each value of x for the whole population; the least-squares line from a sample estimates it.
  • The population slope is the slope β₁ of the population regression line, the parameter that a test or confidence interval about a regression slope is about; the sample slope b₁ estimates it.

Read β₁ as "beta one." The pattern from Week 1 holds: b₁ is a statistic from the sample, and β₁ is a parameter of the population.

Before any test, you check the conditions out loud.

  • The conditions for regression inference are the four checks made before trusting a test or interval for a slope: a linear form, independent observations, roughly normal residuals, and about equal spread of residuals at every x.

Worked example — checking the penguin conditions. Go through the four one at a time.

  1. Linear. In Week 4 the scatterplot showed a strong, positive, linear form, so a straight line is a reasonable model.
  2. Independent. Each bird is measured separately, so the observations are independent. The birds come from an observational field study, not a random draw, so you treat them as representative of penguins like those monitored and say so.
  3. Normal residuals. You check this on a histogram of the residuals in the Data Lab. With 342 birds, mild departures from a normal shape matter little.
  4. Equal spread. You check this on the residual plot in the Data Lab: look for a band, not a fan.

Now the test itself. It asks whether the population slope could be 0, which would mean flipper length has no linear relationship with mean body mass.

  • The standard error of the slope is how much the sample slope b₁ typically wobbles from sample to sample, written SE(b₁) and reported by regression software in the units of the slope.
  • The t test for the slope is a hypothesis test of H₀: β₁ = 0 that computes t = b₁ ⁄ SE(b₁) and reads it against a t distribution with n − 2 degrees of freedom.

Worked example — is the penguin slope real? Follow the same steps as Week 14.

  1. Write the hypotheses. H₀: β₁ = 0, meaning flipper length has no linear relationship with mean body mass. Hₐ: β₁ ≠ 0.
  2. Read the standard error. Software reports SE(b₁) as the given input 1.5184 g per mm. It is the typical sample-to-sample wobble of b₁.
  3. Compute the t statistic. You divide the slope by its standard error. Here t = (b₁ − 0) ⁄ SE(b₁), so you divide the given input 49.6856 by the given input 1.5184 and get about 32.72, rounded to two decimals. The sample slope sits about 32.72 standard errors above 0.
  4. Find the degrees of freedom. A regression line estimates two numbers, b₀ and b₁, so df = n − 2 = 342 − 2 = 340.
  5. Decide. The p-value is far below 0.001, so you reject H₀ at α = 0.05.

In words: if flipper length had no linear relationship with body mass, a sample slope this far from 0 would almost never occur. The data give very strong evidence that the population slope is not 0. A researcher deciding whether flipper length is worth recording as a stand-in for mass has a clear answer.

In practice (your tools). Spreadsheets do not print SE(b₁) from =SLOPE, but you can build it. In Google Sheets or Excel, =STEYX(F2:F345,E2:E345)/(STDEV(E2:E345)*SQRT(COUNT(E2:E345)-1)) returns about 1.5184. Divide the slope by that cell to get t. Then =T.DIST.2T(32.72,340) returns the two-sided p-value, a number so small it appears in scientific notation.

Misconception check — "a significant slope means a steep slope". Students often read a tiny p-value as proof that the slope is large or important. It is tempting, because the penguin slope is both. But the p-value measures how surprising the slope would be if β₁ were 0, not how big it is. With enough data, a nearly flat slope can be significant. The cure: report the slope in its units, and put an interval on it, which is the next section.

9. Put an interval on the slope

A test answers "is there a slope?" An interval answers "how big is it?" The interval for a slope has the same shape as every interval since Week 11: estimate, plus or minus a critical value times a standard error.

  • A confidence interval for the slope is an interval b₁ ± t* × SE(b₁), with t* taken from a t distribution with n − 2 degrees of freedom, that gives a range of plausible values for the population slope β₁.

Worked example — the 95% interval for the penguin slope. Use the same pieces as the test.

  1. Choose the critical value. The critical value t* for 95% with df = 340 lies between the critical value 1.960 for z* and the critical value 1.976 for t* with df = 150. You use the conservative critical value 1.976.
  2. Find the margin of error. Multiply the critical value 1.976 by the given input 1.5184, and you get about 3.00 g per mm, rounded to two decimals.
  3. Build the interval. 49.69 − 3.00 = 46.69 and 49.69 + 3.00 = 52.69, so the 95% interval for β₁ runs from about 46.69 to 52.69 g per mm.
  4. Interpret. You are 95% confident that, for penguins like these, each additional millimetre of flipper length goes with between about 46.69 g and 52.69 g more mean body mass.
  5. Connect to the test. The interval excludes 0, which matches the rejection of H₀.

The 95% describes the method, as it did in Week 11. Across many samples, about 95% of intervals built this way would capture β₁. It is not a 95% chance that this one interval is right.

One honesty note about the critical value. The course table has t* for df = 150 but not for df = 340. Because t* shrinks toward z* as the degrees of freedom grow, the exact value sits between 1.960 and 1.976, and using 1.976 makes the interval a hair wider than it needs to be. That is the safe direction to be wrong.

Association, not causation

A slope this strong tempts people to say that a longer flipper makes a bird heavier. Stop there. The penguins were observed, not assigned flipper lengths, so the slope describes an association. Week 1's rule still holds: only a randomized experiment supports a cause-and-effect claim.

There is also a likely lurking variable. Species may act as a lurking variable: Gentoo average 5,076.02 g against 3,700.66 g for Adelie, so a single line across all three species can mix species differences into the slope. Part of what the line reports may be "Gentoo are bigger birds" rather than "flippers and mass rise together within a species."

Misconception check — "a significant slope proves x causes y". Students often treat a tiny p-value on a slope as proof of cause. It is tempting, because a test feels like a verdict. But a test tells you the association is unlikely to be a fluke of sampling, not where it comes from. The cure: ask how the data were collected. Observational data support "is associated with," and only a randomized experiment supports "causes."

10. Know where the line stops: extrapolation and influential points

The penguin line was built from flippers between 172 mm and 231 mm. Inside that range it has been checked. Outside it, nobody knows.

  • Extrapolation is using a regression line to predict y at an x value outside the range of the observed x values; the data give no warrant that the straight-line pattern continues there.

Worked example — a 300 mm flipper. Imagine someone asks about a giant penguin.

  1. Compute. At x = 300 mm, 49.6856 × 300 = 14,905.68, and 14,905.68 − 5,780.8314 ≈ 9,124.85, so the line predicts 9,124.85 g.
  2. Check the range. That is 69 mm beyond the largest observed flipper, since 300 − 231 = 69, so the line gives no warrant for this prediction.

In words: the arithmetic works, but the number is a guess about birds the data never saw. A straight line can bend, level off, or stop making sense outside its data. The intercept from Section 3 was the same trap, at the other end.

A second danger sits inside the data. One unusual point can pull a line toward itself.

  • An influential point is a single point whose removal would change the regression line a lot, such as moving the slope sharply or flipping its sign; points far from the rest in the x direction are the usual suspects.

Worked example — February tips the calendar line. Use the calendar dataset from Weeks 2 and 3: the days in each month of a common year, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31.

  1. Set up the pairs. Pair each month's position (1 to 12) with its days in a common year.
  2. Fit all twelve. For all twelve months, the least-squares slope is about 0.07 days per month position, rounded to two decimals. The line tilts slightly up.
  3. Remove one point. Drop February (month 2, 28 days) and the slope for the other eleven months is about −0.02 days per month position, rounded to two decimals.
  4. Compare. One point flipped the sign of the slope, so February is an influential point.

In words: February sits low and near the left end, so it drags the left end of the line down and makes the whole line tilt up. Without it, the line is nearly flat and tilts slightly down. Week 4 showed that February flips r too; a line and its correlation share the same weakness.

In practice (your tools). In Google Sheets or Excel, compute =SLOPE twice: once on all the rows, and once with the suspect row deleted or skipped. If the slope changes a lot, report both lines and say which point drives the difference. Never delete a point only because it is inconvenient.

Misconception check — "the line continues outside the data". Students often plug any x into the line and trust the answer. It is tempting, because the equation accepts any number. But the line was checked only where the data are, and the 300 mm prediction and the −5,780.83 g intercept are both guesses beyond that range. The cure: before you predict, check that x sits inside the observed range, and label anything outside it as extrapolation.

11. Close the arc: from describing data to modeling them

Look back at the questions this course has asked, in order. Each one built on the one before.

  • Where did these numbers come from? Week 1 separated samples from populations and observational studies from experiments. That is still why the penguin slope shows association, not cause.
  • What do they look like? Weeks 2 and 3 taught shape, center, and spread. The standard deviation you met there is the "guess the mean" miss of 801.95 g that the line cut in half.
  • Do two variables move together? Week 4 drew the scatterplot and measured r. This week turned r into a line.
  • How likely is that? Weeks 5 to 7 built probability, and Weeks 9 and 10 built the normal model and the standard error. Every p-value in the course stands on them.
  • What can a sample tell me, and how sure am I? Weeks 11 to 14 built intervals and tests. This week ran both on a slope.
  • Can I predict one variable from another, and should I? This week's answer: yes, inside the data, with a stated typical miss, after checking a residual plot, and without claiming cause.

That last question carries the habit the whole course has been building. Ask where the data came from. Describe them honestly. State the model as an assumption. Check its conditions. Say how uncertain the answer is. A nurse reading a dosing chart, a manager reading a sales forecast, and a biologist reading a penguin line all need that same habit.

Misconception check — "statistics proves things". Students often finish a course like this one thinking a good analysis delivers certainty. It is tempting, because a p-value of 0.001 or a 95% interval sounds final. But every tool in the course describes uncertainty rather than removing it: an interval gives plausible values, a test weighs evidence, and a line predicts with a typical miss. The cure: end every conclusion with how sure you are and why, in words a non-statistician would understand.

Which part of the arc feels strongest for you right now? Pick one of these two reflections and write two or three sentences in your notes:

  • (a) Choose one earlier week's idea and explain how it showed up again in this week's penguin line.
  • (b) Describe a prediction you meet in daily life, such as a fare, a delivery time, or a fitness estimate, and say what you would want to know before you trusted it.

Key terms

  • least-squares regression line — The straight line ŷ = b₀ + b₁x that makes the sum of the squared residuals as small as possible; it is the line regression software reports. (first used: 1. Fit the least-squares line: the line with the smallest squared misses)
  • predicted value — The value of the response variable that a regression line gives for a chosen value of x, written ŷ and read "y hat"; it is an estimate, not an observation. (first used: 1. Fit the least-squares line: the line with the smallest squared misses)
  • slope — In a regression line, the number b₁ that gives the predicted change in y for each one-unit increase in x; it equals r × s_y ⁄ s_x, so it carries units and is not the correlation. (first used: 2. Read the slope: grams per millimetre, not a correlation)
  • intercept — In a regression line, the number b₀ that gives the predicted y when x is 0; it anchors the line, and it has no real-world meaning when x = 0 lies far outside the observed data. (first used: 3. Read the intercept, then distrust it)
  • interpolation — Using a regression line to predict y at an x value inside the range of the x values the line was built from. (first used: 4. Predict inside the data: interpolation)
  • residual — The observed value of the response minus its predicted value, y − ŷ, for one individual; a positive residual means the point lies above the line and a negative residual means it lies below. (first used: 5. Measure each miss: residuals and the residual standard error)
  • residual standard error — The typical size of a residual in the units of y, computed from the residuals with n − 2 in the denominator; it describes how far observed values usually fall from the regression line. (first used: 5. Measure each miss: residuals and the residual standard error)
  • coefficient of determination — The number r², the square of the correlation coefficient, giving the share of the variation in the response that the least-squares line accounts for; it is not the share of points on the line. (first used: 6. Read r squared: a share of variation, not a share of points)
  • residual plot — A scatterplot of the residuals against x with a reference line at 0; a shapeless band supports a straight line, while a curve or a widening fan warns against it. (first used: 7. Read a residual plot: band, curve, or fan)
  • population regression line — The line μ_y = β₀ + β₁x that gives the mean of the response at each value of x for the whole population; the least-squares line from a sample estimates it. (first used: 8. Test the slope: from the sample line to the population line)
  • population slope — The slope β₁ of the population regression line, the parameter that a test or confidence interval about a regression slope is about; the sample slope b₁ estimates it. (first used: 8. Test the slope: from the sample line to the population line)
  • conditions for regression inference — The four checks made before trusting a test or interval for a slope: a linear form, independent observations, roughly normal residuals, and about equal spread of residuals at every x. (first used: 8. Test the slope: from the sample line to the population line)
  • standard error of the slope — How much the sample slope b₁ typically wobbles from sample to sample, written SE(b₁) and reported by regression software in the units of the slope. (first used: 8. Test the slope: from the sample line to the population line)
  • t test for the slope — A hypothesis test of H₀: β₁ = 0 that computes t = b₁ ⁄ SE(b₁) and reads it against a t distribution with n − 2 degrees of freedom. (first used: 8. Test the slope: from the sample line to the population line)
  • confidence interval for the slope — An interval b₁ ± t* × SE(b₁), with t* taken from a t distribution with n − 2 degrees of freedom, that gives a range of plausible values for the population slope β₁. (first used: 9. Put an interval on the slope)
  • extrapolation — Using a regression line to predict y at an x value outside the range of the observed x values; the data give no warrant that the straight-line pattern continues there. (first used: 10. Know where the line stops: extrapolation and influential points)
  • influential point — A single point whose removal would change the regression line a lot, such as moving the slope sharply or flipping its sign; points far from the rest in the x direction are the usual suspects. (first used: 10. Know where the line stops: extrapolation and influential points)

Summary

  • The least-squares line makes the sum of the squared residuals as small as possible, and it passes through the point of means.
  • The slope is the predicted change in y for each one-unit increase in x, in units of y per unit of x; it is not the correlation.
  • The intercept is the predicted y at x = 0, and it has no meaning when x = 0 is far outside the data.
  • A residual is observed minus predicted; the residual standard error is the typical size of a miss.
  • r² is the share of the variation in y that the line accounts for, not the share of points on the line.
  • A residual plot should look like a shapeless band; a curve or a fan is a warning.
  • Check four conditions, then test whether the population slope is 0 with t = b₁ ⁄ SE(b₁) on n − 2 degrees of freedom.
  • An interval for the slope says how big the slope is; it excludes 0 exactly when the two-sided test rejects at the matching level.
  • Predict only inside the observed range of x, watch for influential points, and say "associated with," not "causes," for observational data.

Check your understanding

Work these before looking at the answers — they are ungraded, and the answers (with reasoning) are at the bottom of the page.

  1. A coffee shop owner records daily iced-drink sales y against the afternoon temperature x, in degrees Celsius, on days from 15 to 35 degrees. The least-squares line is ŷ = 120 + 8x. Interpret the slope, predict sales on a 25-degree day, and find the residual for a 25-degree day when the shop sold 290 drinks.
  2. A used-car study of 52 cars regresses price, in dollars, on age, in years. The output reports a slope of −1,150 dollars per year with a standard error of 230 dollars per year; the reported p-value is below 0.001. Compute the t statistic and the degrees of freedom, and state the conclusion in context.
  3. A health study finds r² = 0.36 for reaction time against hours of sleep, with a negative slope. A classmate says, "So 36% of the people are on the line." Correct the statement, and give the correlation r.
  4. A residual plot for a line predicting a delivery's minutes from its distance in kilometres shows residuals that are tightly packed for short trips and spread far apart for long trips. Which condition for regression inference does this warn about, and what would you tell someone who wants to run the t test for the slope anyway?

Answers (worked reasoning — read after attempting)

  1. The slope is 8, so each additional degree predicts about 8 more iced drinks sold. At 25 degrees, ŷ = 120 + 8 × 25 = 120 + 200 = 320 drinks. The residual is observed minus predicted: 290 − 320 = −30, so the shop sold 30 fewer drinks than the line predicted. A 25-degree day sits inside the observed range of 15 to 35 degrees, so this is interpolation; an owner deciding how much ice to buy can lean on it. A prediction for a 5-degree day would be extrapolation.
  2. The t statistic is the slope divided by its standard error: −1,150 ⁄ 230 = −5.0. A regression line estimates two numbers, so df = 52 − 2 = 50. The p-value is below 0.001, so you reject H₀: β₁ = 0 at α = 0.05. The data give strong evidence of a negative linear relationship: each additional year of age is associated with about $1,150 lower predicted price. It is an association in observed cars, not proof that age alone lowers price.
  3. r² = 0.36 means hours of sleep account for about 36% of the variation in reaction time; it says nothing about how many people sit on the line, which could be almost none. To find r, take the square root, √0.36 = 0.6, and give it the slope's sign. The slope is negative, so r = −0.6.
  4. The spread grows from left to right, a fan, so the equal-spread condition fails. The line may still describe the trend, but the standard error of the slope, the p-value, and any interval would rest on an assumption the data break. Tell the person to report that problem, rather than run the test as if the conditions held.

Next up in this module: the Readings & Resources page, the lecture tutorial, the practice set, and the quiz. Next week is finals week, where the final asks you to choose and use every model, test, and interval from the course.

Built with The Course Maker · samples.thecoursemaker.com