Scatter plots and the three kinds of correlation, the correlation coefficient r, approximating a best-fitting line by hand in four steps, using a line of fit to predict, and finding the regression line with a graphing calculator.
Subject: Algebra 2 · 64 slides · symbolic lesson
Open the interactive version of this deck
Title
Algebra 2 · Lesson 2.6
Real measurements never sit on a line, so you learn to find the line they sit near
Objectives
Everything you have done with lines so far started from exact information: two points, or a slope and a point, and one line passed through them. Real data is not like that. Twenty measurements almost never lie on one line, and yet the trend in them can be unmistakable.
This lesson is about that gap. You will plot the data, judge whether a line is worth drawing at all, draw one, and then use it to answer a question the data was never asked directly.
The new word to watch for is approximate. Nothing here has one right answer to the last decimal, and two careful students will sketch slightly different lines. That is not sloppiness; it is what modelling is, and the closing part shows you the calculator that removes the ambiguity when you need it removed.
Two habits will carry you through. Look at the picture before you compute anything, and ask of every prediction whether the data actually covers the value you put in.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 113 — Before, Now, Why and the Key Vocabulary
Warm-up
Every fit in this lesson ends with the same small task: two points, and the equation of the line through them. Do one now from memory, writing your reasons down, because in twenty minutes you will be doing it on numbers that came off a measuring tape.
\[ \text{through } (1, 300) \text{ and } (7, 548) \]
Discussion prompt
Find the slope of the line through those two points, then use point-slope form to write its equation, and say beside each line why you made that move.
Check the arithmetic the way you should check every slope: 41.3 units of climb for each of the six steps from 1 to 7 gives about 248, which is exactly the rise you started with.
Now hold on to those two points. They are not invented. In a few slides they will be the two points read off a line sketched through eight years of measurements, and this equation will be the answer to the lesson's central example.
One thing will be different, though, and it is the thing worth watching for. Here you were handed the two points. There you will have to choose them, and the choice is where nearly all the marks in this topic are won or lost.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.4, p. 98 — point-slope form, used again here
Section
Part 1
Concept
A scatter plot is a graph of a set of data pairs. Each pair contributes one dot, at the horizontal position given by the first number and the vertical position given by the second. Nothing is joined up and nothing is smoothed.
scatter plot — A graph of a set of data pairs (x, y), one dot per pair, with no line drawn between them.
| years since 1997 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|---|---|---|---|---|---|---|---|---|
| vehicles (thousands) | 280 | 295 | 322 | 395 | 425 | 471 | 511 | 548 |
Here is the table the whole lesson runs on: the number of alternative-fuelled vehicles in use in the United States, counted once a year. Reading across it you can tell the numbers are rising, but you cannot easily tell whether they are rising steadily or in fits and starts.
Figure (svg): A scatter plot of eight dots rising from left to right: years after 1997 along the bottom from 0 to 7, thousands of vehicles up the side from 250 to 570.
The plot answers that immediately. The dots climb at what looks like a constant rate, with one year, the third, jumping further than its neighbours. That is information the table was holding and not showing you.
Notice the horizontal axis. It counts years since 1997, not calendar years, so the first measurement sits at 0 rather than at 1997. Every model in this lesson does that, and forgetting it is the single most expensive slip in the exercise set.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 115 — the alternative-fuelled vehicle table from Example 3
Concept
Once the dots are on the page, the first question is not what line fits them. It is whether the cloud drifts at all, and if so, which way. The book gives you exactly three answers to choose from.
Figure (svg): Three scatter plots side by side. The left one climbs from lower left to upper right, the middle one falls from upper left to lower right, and the right one is a shapeless cloud.
The word doing the work in the first two descriptions is tends. It does not promise that every step to the right lifts the dot. It says that over the whole picture the drift is upward, and single points are allowed to disagree.
The third case deserves respect rather than disappointment. Finding no correlation is a real result: it says that knowing x tells you essentially nothing about y, which is worth knowing before anybody builds a plan on the opposite assumption.
Watch out for one thing already. These three names describe a straight-line drift only. A cloud can have a perfectly definite shape and still earn the label approximately no correlation, and Part 2 shows you exactly such a case.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 113 — the definitions of positive, negative and no correlation
Worked example
Both plots below have the same quantity along the bottom, the number of cellular subscribers in millions, measured once a year from 1995 to 2003. What differs is the quantity up the side. Describe the correlation in each.
Figure (svg): Two scatter plots. On the left, cellular service regions climb as subscribers climb. On the right, corded phone sales fall as subscribers climb.
Read the left plot from left to right
Why: as subscribers rise from about 34 million to about 159 million, the number of cellular service regions rises from about 22 thousand to about 164 thousand, so the drift is upward.
\[ 34 \to 159 \text{ subscribers}, \quad 22 \to 164 \text{ regions} \]
You do not need every value to make this call. Cover the middle of the plot with your thumb and compare the two ends: the left end is low and the right end is high, and none of the hidden points can change that.
Name the left correlation
Why: y tends to increase as x increases, which is the definition of a positive correlation.
\[ \text{left plot: positive correlation} \]
Read the right plot the same way
Why: as subscribers rise over the same nine years, corded phone sales fall from about 560 million dollars to about 251 million, so the drift is downward.
\[ 34 \to 159 \text{ subscribers}, \quad 560 \to 251 \text{ dollars} \]
Name the right correlation
Why: y tends to decrease as x increases, which is a negative correlation.
\[ \text{right plot: negative correlation} \]
It is tempting to add a story here, and the story even sounds right: mobile phones replaced corded ones. Hold that thought. The plot supports the pattern but not the explanation, and the last part of this lesson is about exactly that distinction.
Check the two verdicts against the computed coefficients
Why: reading the points off the printed graphs and computing in node gives r = 1 for the left plot and r = -0.98 for the right, so one is strongly positive and the other strongly negative, exactly as the eye reported.
\[ r_{\text{regions}} = 1, \qquad r_{\text{sales}} = -0.98 \]
Do not worry that you have not met the formula behind those numbers yet. The next part introduces r properly; here it is only serving as an independent check on two judgements you made by eye.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 113 — Example 1
Prediction
Look again at the right-hand telephone plot. Corded phone sales fall overall, but between the first two years they barely move, and one pair of neighbouring points goes the wrong way entirely. Commit to a verdict before reading on.
Predict first
One pair of neighbouring points in a falling cloud goes upward instead. What does that do to the description of the correlation?
Correct: Nothing: the correlation is still negative, because it describes the whole cloud
Why: Correlation is a statement about the drift of the whole set, which is why the book's definitions say tends to rather than always does. Real measurements wobble, and a description that collapsed whenever two neighbours disagreed would be useless. Deleting the awkward point is worse than useless: it is deciding the answer first and then arranging the evidence.
The choice to avoid is the last one. Throwing away a measurement because it spoils the pattern is how data analysis goes wrong, and it goes wrong invisibly, since the tidied picture looks better than the honest one.
There is a real version of that judgement, and you will meet it later in statistics: a point can be so far from the rest that it deserves separate investigation. Even then the finding is investigate, not delete.
The useful habit here is to describe first and explain afterwards. Say what the cloud does, then look for reasons, rather than deciding what should happen and reading the cloud to agree.
Sorting
Exercise 21 asks you to invent examples of each kind. Sorting given ones first is easier and trains the same judgement. For each pair, imagine measuring both quantities on many different days, people or towns, and ask which way the cloud would drift.
Sort into buckets
Sort each pair of quantities by the correlation you would expect a scatter plot of them to show.
The height and arm-span pair is the interesting one. The correlation there is famously strong, close to 0.9 in most samples, and yet nobody thinks arms cause height. Both are set by the same growth, which is a preview of the last part of this lesson.
The rainfall pair is worth arguing about too. Within one month there is no pattern, but if you measured across a whole year in a monsoon climate there certainly would be. Correlation always belongs to a particular set of measurements, not to the quantities in the abstract.
When you invent your own examples for Exercise 21, test them the same way: describe the measuring you would do, and only then say which way the cloud drifts.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 118 — Exercise 21
Socratic
Exercise 6 asks whether you can name the correlation from a table alone. You can, and the reasoning is worth making explicit, because it is the reasoning the scatter plot performs for you visually.
\[ \begin{array}{c|ccccc} x & 1 & 2 & 3 & 4 & 5 \\ \hline y & 120 & 101 & 87 & 57 & 42 \end{array} \]
Discussion prompt
Order the table by x, then describe what the y values do, and say what correlation that implies. Then say what you would still be missing if you never drew the plot.
So a table settles the direction and a plot settles everything else. That is a fair summary of why this lesson insists on drawing the picture before doing any algebra.
A word of warning about sorting. If the table arrives with x out of order, sort it first. Reading an unsorted table top to bottom can make a rising relationship look like noise, and that mistake costs nothing to avoid.
This particular data set is Exercise 11, and you will fit a line to it yourself before the lesson is over. Its direction is settled already, which means you now know the sign your slope has to come out with.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 118 — Exercises 6 and 11
Picture it
One practical decision comes before any correlation can be judged: which stretch of the plane to draw. The kit that drew these figures puts the axes on the zero lines whenever zero is inside the window, and that default is exactly wrong for data that lives far from the origin.
Figure (svg): The same six boiling-point measurements twice. On the left the vertical axis runs from 0 to 220 and the points look like one flat row; on the right it runs from 186 to 210 and a clear fall appears.
Both panels hold the same six measurements: the boiling point of water at six elevations from 2000 to 12,000 feet. On the left the vertical axis starts at zero, so all six readings, which run from 190 to 208 degrees, are squashed into the top eighth of the picture and look identical.
On the right the window runs from 186 to 210, and the same six points become a clean falling line. Nothing was hidden or exaggerated; the axis was simply asked to show the range the data actually occupies.
The rule to take away is that a scatter plot's window should hug the data, unless zero itself means something in the problem. When you sketch these by hand, look at the smallest and largest value in each column first, and let those choose your scale.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 119 — Exercise 26, the boiling-point data
Section
Part 2
Notation
Positive, negative and none are three coarse boxes. The correlation coefficient replaces them with a single number on a continuous scale, so that two positive correlations can be compared rather than just both called positive.
Annotate
On: \( -1 \le r \le 1 \)
Notice what r does not tell you. It says nothing about how steep the line is, because steepness depends on the units and r does not. Measure the same heights in inches instead of feet and every slope changes while r stays exactly where it was.
It also says nothing about how many measurements you took. Two points always give a coefficient of exactly one or negative one, since two points always lie on a line, which is a good reason to distrust a strong-looking correlation computed from very few pairs.
The formula that computes r is in Chapter 11. Here you estimate it from the picture, which is a real skill and not a placeholder: a scientist who cannot guess a coefficient within about 0.2 by eye will not notice when software returns a wrong one.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 114 — the definition of a correlation coefficient
Picture it
Put the two readings on one picture and the scale stops feeling abstract. The sign places you on the left or the right half; the distance from the middle places you between a shapeless cloud and a perfect line.
Figure (svg): A horizontal bar running from negative one on the left through zero in the middle to one on the right, with arrows at both ends and notes under three positions.
The middle of the bar is the awkward place, and it is where careless reading happens. A coefficient of 0 does not mean the two quantities are unrelated in every sense. It means no straight line captures the relationship, which is a narrower claim than it looks.
The two ends are idealisations. Real measurements almost never give exactly 1 or negative 1, because instruments wobble and people round. A coefficient of 0.99 from real data is already remarkable and usually means the relationship is close to a physical law.
For this lesson the working scale is the book's own short list: negative 1, negative 0.5, 0, 0.5, and 1. Deciding which of those five a picture is closest to is exactly the skill Example 2 asks for.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 114 — the correlation coefficient scale
Worked example
For each plot, say whether the coefficient is closest to negative 1, negative 0.5, 0, 0.5, or 1. Decide the sign first and the size second; trying to do both at once is what makes this feel harder than it is.
Figure (svg): Three scatter plots, each with its best-fitting line drawn through it and its computed correlation coefficient printed underneath.
Read the sign of the first plot
Why: the high points sit on the left and the low points on the right, so the cloud falls and the coefficient is negative.
\[ \text{plot a: } r < 0 \]
Now the size, which is the harder half. The dots do drift downward, but at x equal to 1 there is a point near 118 and another near 77, so a single x can pair with very different values of y. That spread is what keeps the coefficient away from negative 1.
Choose the size for the first plot
Why: a clear but fairly weak fall is between the extremes, so the best of the five choices is negative 0.5.
\[ \text{plot a: } r \approx -0.5 \]
Read the second plot
Why: high and low points are scattered across the whole width with no drift either way, so the cloud has no direction at all.
\[ \text{plot b: } r \approx 0 \]
Read the third plot
Why: the dots rise steadily and sit close to a single line, so the coefficient is positive and near the far end of the scale.
\[ \text{plot c: } r \approx 1 \]
The line drawn on each panel makes the size judgement concrete. It is the same kind of line in all three; what changes is how far the dots stray from it, and that straying is precisely what the coefficient measures.
Check the three estimates by computing them
Why: reading the points off the printed plots and computing in node gives the three values below, which round to the book's stated negative 0.46, negative 0.02 and 0.98; the small differences come from reading dot positions off a printed grid, not from a disagreement about the answer.
\[ r_a = -0.5, \qquad r_b = -0.01, \qquad r_c = 0.98 \]
Every estimate landed on the right one of the five choices, which is all the question asked for. Getting the sign right and the size within one step of the scale is the standard to aim at.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 114 — Example 2
Estimation
Same task, three fresh plots. Work along the same two questions in the same order: which way does the cloud drift, and how tightly does it hold to a line?
Figure (svg): Three more scatter plots, numbered one to three: a loose rising cloud, a tight falling cloud, and a scatter with no direction.
Predict first
Which list gives the best estimate of the correlation coefficient for plots 1, 2 and 3, in that order?
Correct: about 0.5, then about -1, then about 0
Why: Plot 1 drifts upward but loosely, with two points at the same x nearly 60 apart, so it sits at about 0.5. Plot 2 falls and its dots are nearly on one line, so it is close to negative 1. Plot 3 has high and low points all across the width and no drift, so it is close to 0. Computing from the plotted points gives 0.59, -0.97 and 0.04, which confirms all three readings.
Plot 1 is the one most often overcalled. It does rise, so the instinct is to say a strong positive, but look at x equal to 2, where one point is near 82 and another near 20. A cloud that wide cannot be hugging any line.
Plot 3 is the one most often undercalled, in the other direction. There is a high point and a low point at nearly every x, and that is the signature of no correlation, not of a weak one.
A quick trick for the size: imagine drawing your best line, then ask how far a typical dot sits from it compared with the full height of the picture. A small fraction means near 1 in size; a large fraction means near 0.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 114 — Guided Practice 1 to 3
Trap
A student computes the coefficient for a set of measurements and gets almost exactly zero, then writes the conclusion:
\[ \begin{array}{c} r \approx 0 \\ \Downarrow \\ x \text{ and } y \text{ are unrelated} \end{array} \]
The reasoning behind it sounds airtight. The coefficient measures the relationship, it came out at zero, so there is no relationship.
It is the first half of that sentence that is wrong. The coefficient measures one particular kind of relationship, and that conclusion has quietly dropped the qualifier.
Here are nine measurements of a ball thrown straight up: the time in seconds, and the height in feet. Time decides the height completely, with no measurement error at all.
Figure (svg): Nine points forming an arch: the height of a ball thrown straight up, rising to twenty feet at two seconds and falling back to the ground at four seconds, with a flat best-fitting line drawn through the middle.
\[ r = 0 \]
The coefficient is exactly zero, because the rises on the left cancel the falls on the right. What zero has correctly reported is that no straight line helps here. What it cannot report is the arch, which is a perfect relationship of a different shape.
So read a coefficient near zero as no straight-line trend, never as no connection. Always look at the plot before drawing the stronger conclusion, which is exactly why this lesson draws the scatter plot first and computes second.
Two truths and a lie
Four statements about r, some true and some plausible-sounding. Test each against the definition rather than against how it feels, and give yourself a reason either way before you sort.
Sort into buckets
Sort each statement about the correlation coefficient by whether it is true.
The steepness claim is the one that traps most people, because a strong correlation is usually drawn with a visibly sloping line in textbooks. Draw a nearly flat line and sprinkle points tightly along it, and you have a coefficient near 1 with almost no slope.
The units claim matters more than it looks. It is the reason r can be quoted in a report without saying what was measured in what, and the reason a coefficient of 0.8 means the same thing in physics as in economics.
If you got the range claim by remembering rather than reasoning, that is fine here, but keep it as a check: any calculation of r that produces 1.4 has gone wrong somewhere, and you have caught it for free.
Ranking
Strength is distance from zero, sign ignored. Put these four in order from the weakest straight-line trend to the strongest, and notice that the order is not the order you would get by just reading the numbers left to right.
Put in order
Order these correlation coefficients from the weakest straight-line trend to the strongest.
Why: Ignore the signs and read the sizes: 0.02, then 0.38, then 0.5, then 0.96. The value of negative 0.96 has the strongest trend of the four even though it is the smallest number, because its points lie closest to a line. Two of these come straight from the book: negative 0.02 is Example 2's middle plot and negative 0.96 is the answer to Exercise 18.
The value of negative 0.96 coming first when read as a number and last when read as a strength is the whole point of the exercise. Sign and size are two independent readings of one symbol.
Notice how little separates 0.38 and 0.5 in practice. Both describe loose clouds, and a plot of each would look much the same. The scale is most useful at its extremes and least useful in the middle.
This is Exercise 18 in disguise. It asks which value puts the data points closest to a line, and the answer is the one furthest from zero, regardless of which side it is on.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 118 — Exercise 18
Matching
Four descriptions in words, four values. Match them by working out the sign from the description first, then the size, and only then look for a number that fits both readings.
Match the pairs
Why: Rising means positive, so the first description takes the only positive value. The other three are all negative, so the sign cannot separate them and you must use the size: tight means close to 1 in size, so negative 0.97; loose but still falling means the middle value, negative 0.5; and no drift at all means the value nearest zero, negative 0.02. All four numbers are the computed coefficients of plots in this lesson.
Notice that three of the four values are negative, which means the sign alone settles only one of the matches. When a question is built that way, it is testing whether you can read strength, and reading the word tight or loose in the description is how you do it.
The last description is worth reading twice. High and low points at every x is a picture, not a number, and recognising it as the signature of a coefficient near zero is worth more than memorising the value.
If you found yourself matching by elimination rather than by reasoning, redo it forwards. Cover the four values, write down the coefficient you expect for each description, and then uncover them.
Counterexample
Exercise 23 is a challenge question, and it is the first time in this lesson that correlations get combined. Do not reach for a formula; reason about directions, and test your reasoning on numbers you invent.
Discussion prompt
Suppose x and y have a positive correlation and y and z have a negative correlation. What can you say about the correlation between x and z? Build a small set of numbers to test your answer.
The last point is the one that lifts this above a puzzle. Correlations do not multiply like signs in algebra unless they are near the ends of the scale; a chain of two weak relationships can produce nothing at all.
It is worth seeing why. A coefficient near 0.4 means y is only loosely tied to x, and if z is then only loosely tied to y, the tie from x through to z can be almost invisible by the time it arrives.
Reasoning about directions like this is genuinely useful outside mathematics. It is how you sanity-check a claim built from two separate studies, and the answer no reliable conclusion is often the right one.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 118 — Exercise 23
Section
Part 3
Concept
When the coefficient is close to 1 in size, a line is a reasonable model, and the book's recipe for finding one is four steps long. Read them once now; the whole of this part is the third step being taken seriously.
Figure (svg): The vehicle scatter with a line drawn through it; the three points sitting above the line are ringed in green and the five below are ringed in orange.
Step 2 is where the judgement lives, and the balance test in the picture is how you check it. Here five points sit above the sketched line and three below, which is close enough to even that the line is running through the middle of the cloud rather than along one edge of it.
Step 3 is the surprise. Almost everybody reaches for two of the dots, because dots are what is printed and choosing them feels safer. The instruction is the opposite: choose two points on the line you drew, whether or not any measurement happens to sit there.
The reason is that your line already carries the information from all eight measurements. Going back to two of the dots throws six of them away and hands the answer to whichever two you happened to pick.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 115 — the Key Concept box, Approximating a Best-Fitting Line
Worked example
Back to the eight years of alternative-fuelled vehicle counts. The task is to approximate the best-fitting line, following the four steps in order and showing what each one produces.
\[ \begin{array}{c|cccccccc} x & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 \\ \hline y & 280 & 295 & 322 & 395 & 425 & 471 & 511 & 548 \end{array} \]
Draw the scatter plot and sketch a line through the trend
Why: the dots climb steadily, so a straight model is reasonable; the sketched line is placed so the cloud straddles it rather than sitting to one side.
\[ \text{step 1 and step 2: the picture below} \]
Figure (svg): The vehicle scatter with the sketched line, the point at one year and three hundred ringed in yellow and marked not a data point, and the point at seven years and 548 ringed in green and marked a data point.
Now step 3, and look carefully at the two ringed points. The one at seven years and 548 thousand happens to be a measurement. The one at one year and 300 thousand is not: the measurement that year was 295, and the sketched line passes a little above it.
Choose two points that lie on the sketched line
Why: estimating their coordinates from the grid; the rule is that they sit on the line, not that they sit on a dot.
\[ (1, 300) \quad \text{and} \quad (7, 548) \]
Find the slope from those two points
Why: subtract the y values and the x values in the same order, then divide.
\[ m = \dfrac{548 - 300}{7 - 1} = \dfrac{248}{6} \approx 41.3 \]
That slope has a meaning worth saying out loud: about 41.3 thousand more alternative-fuelled vehicles every year. A slope from a fitted line is always a rate, and reading it in the problem's own words is a good guard against a decimal-point error.
Write the equation in point-slope form and simplify
Why: using the point (1, 300), because either of the two chosen points gives the same line.
\[ y - 300 = 41.3(x - 1) \;\Longrightarrow\; y \approx 41.3x + 259 \]
Check the model against a measurement it did not use
Why: at x equal to 7 the model gives 41.3 times 7 plus 259, which is 548.1, and the measured value that year was 548; at x equal to 4 it gives 424.2 against a measured 425.
\[ 41.3(7) + 259 = 548.1 \approx 548, \qquad 41.3(4) + 259 = 424.2 \approx 425 \]
Two agreements to within about one unit on values in the hundreds is what a good fit looks like. The book gives this same answer, y equals 41.3x plus 259, so your sketch and its sketch landed in the same place.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 115 — Example 3
Picture it
The definition says the best-fitting line lies as close as possible to all the data points. Close in which direction, though? The answer is vertical, and once you see why, the whole of the rest of this part follows.
Figure (svg): The vehicle scatter with the fitted line and a red vertical segment from every dot down or up to the line; the longest segment is at two years.
Each red bar runs from a measurement straight down or straight up to the line. Its length is the amount by which the model missed that year: the model's prediction against what was actually counted. That miss has a name, the residual, and it is the quantity a fit is trying to make small.
residual — For one data point, the measured y minus the y the line predicts at that same x. Positive above the line, negative below it.
The distance is measured vertically rather than perpendicular to the line because of what the model is for. You will feed in an x and read off a y, so the error that matters is the error in y, and that is a vertical gap.
Adding the residuals up as they stand would be useless, because the positive ones above the line would cancel the negative ones below. Squaring first removes the signs, and the total of the squares for this line comes to about 1048.
That number is the score for the line, and a lower score is a better fit. On its own it means nothing; it earns its meaning the moment you compute it for a second line and compare, which is the next slide but one.
Concept
Squaring the residuals does two jobs. It removes the signs so the misses cannot cancel, and it makes a big miss count for far more than several small ones, which is usually what you want from a model.
\[ E = (y_1 - \hat y_1)^2 + (y_2 - \hat y_2)^2 + \cdots + (y_n - \hat y_n)^2 \]
Read the notation as measured minus predicted, squared, and then summed over every data point. A residual of 20 contributes 400 while four residuals of 5 contribute only 100 between them, so the total is far more sensitive to one bad miss than to several small ones.
Figure (svg): A U-shaped curve showing the total squared error for every intercept between 200 and 330, with its lowest point marked at an intercept just above 261 and the value 259 marked a little to its left.
Now fix the slope of the vehicle line at 41.3 and let only the intercept move. The total of the squares traces a valley: too low an intercept and every point is above the line, too high and every point is below, and somewhere between there is one best height.
The bottom of that valley sits at an intercept of about 261.3, and the sketch produced 259. The sketched line therefore scores 1048 where the best possible at this slope scores 1005, which is a difference of about four per cent for a line drawn with a ruler.
That is the honest defence of the hand method. It does not find the bottom of the valley, but it lands close enough that the model's predictions are barely affected, and it takes a minute instead of a page of algebra.
Tweak it
The valley in the last figure was drawn for one particular slope. Change the slope and the whole valley moves, both sideways to a different best intercept and up or down to a different best score. Explore that before reading on.
Parameter explorer
Set the slope to 41.3 and read off the intercept at the bottom of the valley. Then set it to 35 and read the bottom again. Which choice of slope gives the lower total, and what does that tell you about the sketched model?
\[ E \text{ against the intercept, at slope } {m} \]
Two things are worth noticing as you slide. The bottom of the valley slides sideways, because a steeper line needs a lower starting height to stay among the same points, and the depth of the bottom changes too.
The depth is the real information. Every slope has a best intercept, and comparing those best depths across slopes is how you find the one line that beats all the others. That search is exactly what the calculator in Part 5 performs.
Notice also how flat the valley is near its bottom. Moving the intercept by a few units barely changes the total, which is why two students sketching slightly different lines end up with practically the same predictions.
Prediction
Here is the choice everybody faces at step 3. One line is drawn through the first and last measurements, which are genuine data points. The other is sketched through the middle of the cloud and then read off. Commit before you look.
\[ \text{line A through } (0, 280) \text{ and } (7, 548) \qquad \text{line B: } y = 41.3x + 259 \]
Predict first
Which line will have the smaller total of squared residuals on the eight vehicle measurements?
Correct: The sketched line, because it was placed using all eight points
Why: The line through the first and last measurements scores exactly zero on those two years and then pays for it everywhere in between, with a total of about 1806. The sketched line misses both ends slightly and does far better in the middle, for a total of about 1048. Passing exactly through some points is not what a fit is judged on; the total of all eight misses is.
The wrong answer that tempts is the second one, and the temptation is understandable: exact agreement at two points feels like evidence. It is evidence about two years only, and a model is asked about all of them.
Notice also that the endpoint line leaves only three of the eight points above it and five below, which already fails the balance test from step 2. The sketched line leaves five above and three below, which is as even as eight points allow.
The next slide draws both lines with their residuals so you can see where the difference comes from, rather than taking two totals on trust.
Trap
The most common wrong route through step 3 picks the two measurements at the ends, on the grounds that they are real data and the endpoints frame the whole range.
\[ m = \dfrac{548 - 280}{7 - 0} \approx 38.3 \]
\[ y = 38.3x + 280 \]
It looks defensible, and the slope is not wildly wrong, but the two chosen years have quietly outvoted the other six.
The next slide draws the cost. Pinned to the first and last counts, the line rides above the whole middle of the data, and its residual bars are visibly longer than the sketched line's.
\[ \begin{array}{rl} E_{\text{ends}} & \approx 1806 \\ E_{\text{sketch}} & \approx 1048 \end{array} \]
The sketched line wins by about 42 per cent on the total of the squares, and it did it while passing exactly through none of the measurements. Exact agreement with two points is worth nothing if it costs you accuracy at the other six.
The correction is the book's own instruction, so make it a habit: sketch first, then read two points off the sketch. If one of them lands on a dot, fine. If neither does, that is equally fine, and Example 3 had it one of each way.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 115 — step 3 of the Key Concept box
Picture it
Here are both candidates drawn on the same data with their residual bars, so the comparison is something you can see rather than a pair of totals to take on trust.
Figure (svg): Two copies of the vehicle scatter. On the left a line joins the first and last data points and the middle points sit well below it; on the right the sketched line runs through the middle of the cloud with much shorter gaps.
On the left the line is pinned to the first and last counts, so it agrees exactly at those two years and then rides above every one of the six in between. Two of its bars have vanished and the other six have grown.
On the right the sketched line misses both ends by a little and threads the middle, which is the trade the method is asking you to make. It scores about 1048 against about 1806, a saving of roughly 42 per cent.
The habit worth taking from the picture: judge a fit by the whole set of bars, not by whether it happens to touch any particular dot. Touching two dots exactly cost this line accuracy at the other six.
Notice too that the left line leaves five of the eight points below it and only three above, which already failed the balance test from step 2 before any arithmetic was done.
Error analysis
Exercise 17 shows one student's attempt at a best-fitting line. The slope is not the problem, and no arithmetic has been done wrongly. Look at the picture and say what has gone wrong before reading the notes.
Figure (svg): A rising scatter of ten points with two lines: a lower line that passes below every single point, and a higher line that runs through the middle of the cloud.
Annotate
On: \( \text{student: } y = 5.2x + 2 \qquad \text{corrected: } y = 5.33x + 9.67 \)
This error is easy to make because a line drawn along the bottom edge of a cloud still looks parallel to the trend, and parallel feels like fitted. Balance, not direction, is what step 2 is checking.
The habit that prevents it costs two seconds: after sketching, count the points on each side. Ten above and none below is not a line of best fit, however convincingly it leans, and the corrected line has points on both sides of it.
Notice that every prediction from the lower line would be too low, and by roughly the same amount each time. A fit whose residuals all share one sign is always telling you the line needs moving, not tilting.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 118 — Exercise 17
Fill the middle
Exercise 13 gives five measurements. A line sketched through them passes close to the points at 3 and 18, so those two were read off the sketch. Finish the working.
\[ \begin{array}{c|ccccc} x & 3 & 7 & 10 & 15 & 18 \\ \hline y & 16 & 45 & 82 & 102 & 116 \end{array} \]
Fill in the blanks
m = \dfrac6.76.7 = \dfrac______ \approx ___ \qquad y - 16 = ___(x - 3)
Why: One hundred divided by fifteen is 6.666..., which rounds to 6.7, and the same slope goes into point-slope form. Simplifying gives y equals about 6.7x minus 4.1. Computing the regression line for this data gives a slope of 6.71, so the two-point reading is within about one hundredth of the best possible slope.
Notice that the two points chosen here really are data points, and that is allowed. The rule forbids choosing them because they are data points; it does not forbid a point on your sketched line from also being a measurement.
Here the sketch happened to pass near both ends because this data is fairly straight, with a coefficient of 0.981. When the cloud is loose, that coincidence stops happening and the difference between the two methods grows.
Finish the simplification yourself before moving on. Distributing the slope gives 6.7x minus 20.1, and adding 16 to both sides leaves an intercept of about negative 4.1.
A negative intercept is perfectly acceptable here even though every measured y is positive. The intercept is where the model would sit at x equal to zero, and the data does not reach that far left, so nothing about it has to be realistic.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 118 — Exercise 13
Step zero
A set of data arrives and the question says approximate the best-fitting line. There is one thing to do before any arithmetic, and getting it into your routine now will save you from fitting lines to data that has no business having one.
Discussion prompt
Name the first thing you should do with a new data set, before finding any slope, and say what you would do if that first step told you a line was a bad idea.
This is the step that gets skipped when a question feels routine, and it is the step that would prevent nearly every wrong answer in the exercise set. Fitting a line is cheap; fitting one to a cloud that does not deserve it is what produces confident nonsense.
Exercise 22 makes exactly this point with a number rather than a picture. It gives a data set with a coefficient of 0.1 and asks whether predicting from a fitted line is logical, and you will meet it near the end of Part 4.
Build the habit as three questions in order: does it drift, is the drift straight, and is it tight enough to be worth modelling. Only a yes to all three earns you a line.
Worked example
United States daily oil production, in thousands of barrels, for nine years starting in 1994. Same four steps, but the trend falls this time, so watch the sign of the slope all the way through.
\[ \begin{array}{c|ccccccccc} x & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 \\ \hline y & 6660 & 6560 & 6470 & 6450 & 6250 & 5880 & 5820 & 5800 & 5750 \end{array} \]
Plot and sketch
Why: the nine counts fall from 6660 to 5750, with a steeper drop in the middle years; a line placed through the trend leaves about as many points above as below.
\[ \text{steps 1 and 2: the picture below} \]
Figure (svg): A falling scatter of nine oil-production measurements with a straight line through them and a red vertical segment from each point to the line; the biggest gaps are in the middle years.
The two points read off the sketch are at one year and 6560, and at seven years and 5800. Both happen to be measurements here, which is a coincidence of this particular sketch and not a rule being followed.
Find the slope from the two chosen points
Why: the fall is 760 thousand barrels over six years.
\[ m = \dfrac{5800 - 6560}{7 - 1} = \dfrac{-760}{6} \approx -126.7 \]
Read that in words before going on: production falling by about 126.7 thousand barrels a day each year. A negative slope on a fitted line is not an error to be tidied away; it is the model telling you the direction of the trend.
Write the equation through the point (1, 6560)
Why: point-slope form, then distribute and add 6560 to both sides.
\[ y - 6560 = -126.7(x - 1) \;\Longrightarrow\; y \approx -126.7x + 6687 \]
Check the model on two of the measured years
Why: at x equal to 0 the model gives 6687 against a measured 6660, and at x equal to 8 it gives 5673 against a measured 5750.
\[ -126.7(0) + 6687 = 6687, \qquad -126.7(8) + 6687 = 5673.4 \]
Both are within about 80 of values near 6000, which is a little over one per cent. That is a looser fit than the vehicle data gave, and the coefficient says so too: -0.965 here against 0.993 there.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 117 — Guided Practice 4, part (a)
Worked example
Water boils at 212 degrees Fahrenheit at sea level and cooler as you go up. Six measured elevations and their boiling points; fit a line, and then use it for the elevation the diagram leaves as a question mark.
\[ \begin{array}{c|cccccc} x \;(\text{ft}) & 2000 & 4000 & 6000 & 8000 & 10\,000 & 12\,000 \\ \hline y \;(\text{°F}) & 208.4 & 204.8 & 201.1 & 197.4 & 193.6 & 189.8 \end{array} \]
Check the differences before plotting
Why: each 2000-foot step drops the boiling point by 3.6, 3.7, 3.7, 3.8 and 3.8 degrees, which is almost constant, so this data is close to perfectly linear.
\[ -3.6, \; -3.7, \; -3.7, \; -3.8, \; -3.8 \]
Nearly equal differences are the signature of a straight-line relationship, and they are worth looking for whenever the x values are evenly spaced. Here they justify using the two end measurements as the two points, which anywhere else in this lesson would be the trap.
Figure (svg): Six boiling-point measurements falling in an almost perfect straight line from 208 degrees at 2000 feet to 190 degrees at 12000 feet, with the line continued to 14000 feet and a hollow point marked there.
Find the slope from the two end elevations
Why: the fall is 18.6 degrees over 10,000 feet.
\[ m = \dfrac{189.8 - 208.4}{12\,000 - 2000} = \dfrac{-18.6}{10\,000} = -0.00186 \]
A slope this small looks alarming until you scale it: 0.00186 degrees per foot is 1.86 degrees per thousand feet, which is a number a hiker could actually use. Rescaling a tiny slope into sensible units is always worth doing.
Write the equation through the point (2000, 208.4)
Why: point-slope form, then simplify.
\[ y - 208.4 = -0.00186(x - 2000) \;\Longrightarrow\; y = -0.00186x + 212.12 \]
Substitute 14,000 feet for the prediction
Why: the diagram's question mark is at 14,000 feet, which is 2000 feet past the last measurement.
\[ y = -0.00186(14\,000) + 212.12 = 186.08 \]
Check against the regression line and against sea level
Why: computing the regression line from all six points gives a slope of -0.00186 and an intercept of 212.21, which predicts 186.15 degrees at 14,000 feet; and at an elevation of zero the model gives 212.12, against the known sea-level boiling point of 212.
\[ -0.00186(0) + 212.12 = 212.12 \approx 212 \]
Two independent checks agreeing to within a tenth of a degree is about as convincing as a hand fit gets. It happened because the data is so nearly straight that the two end points carry almost the same information as all six.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 119 — Exercise 26
Worked example
Average annual public college tuition in dollars, for seven years starting in 1997. This data is less obliging than the boiling points, so it is a good place to see the two-point choice actually matter.
\[ \begin{array}{c|ccccccc} x & 0 & 1 & 2 & 3 & 4 & 5 & 6 \\ \hline y & 2271 & 2360 & 2430 & 2506 & 2562 & 2727 & 2928 \end{array} \]
Figure (svg): Seven tuition measurements climbing from 2271 to 2928 dollars, with an orange line joining the first and last points and a green line sketched through the middle of the data.
Two lines are drawn on the plot. The dashed one joins the first and last measurements; notice that it sits above the five points in between, because both ends happen to be low relative to the trend through the middle.
Choose two points from the sketched line, not from the ends
Why: the sketch passes close to 2250 at year 0 and close to 2750 at year 5, and neither of those is a measurement.
\[ (0, 2250) \quad \text{and} \quad (5, 2750) \]
Find the slope
Why: a rise of 500 dollars over five years.
\[ m = \dfrac{2750 - 2250}{5 - 0} = \dfrac{500}{5} = 100 \]
Write the equation
Why: the first chosen point has x equal to zero, so it is the intercept and the equation can be written straight down.
\[ y = 100x + 2250 \]
So the model says tuition rising by about 100 dollars a year from a starting point of about 2250. Both numbers are readable and checkable against the table, which is a sign you have not made a decimal slip.
Check both candidate lines by their totals of squared residuals
Why: the end-to-end line scores about 42744 while the sketched line scores about 17234, and the best line any method can find scores about 16563.
\[ E_{\text{ends}} \approx 42744, \quad E_{\text{sketch}} \approx 17234, \quad E_{\text{best}} \approx 16563 \]
The sketched line is within about four per cent of the best possible, and the end-to-end line is more than two and a half times worse than either. This is the clearest evidence in the lesson for why step 3 says what it says.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 119 — Exercise 25
Comparison
Four of the data sets from this lesson, with their computed coefficients. Fill in what is missing, and as you do it, say to yourself what each column is actually asking about.
Comparison matrix
| data set | direction | coefficient | is a line worth fitting? |
|---|---|---|---|
| vehicles in use, 1997-2004 | rising | 0.993 | yes |
| oil production, 1994-2002 | falling | -0.965 | yes |
| boiling point by elevation | falling | -1 | yes, very much so |
| height of a thrown ball | up then down | 0 | no |
The last row is the one that repays thought. The relationship between time and height is perfect, exact and known, and the answer to the last column is still no, because the question asks about a straight line and the relationship is an arch.
The boiling-point row is its opposite. A coefficient of negative 1 to four decimal places means the six measurements lie essentially on a line, which is what you would expect from a physical law measured with decent instruments.
Notice how the middle column and the last one come apart. A coefficient tells you how good a line would be; whether to fit one also depends on what you want it for and how far outside the data you intend to go.
Fill the first column in for your own homework data too. Direction, coefficient, worth it: three answers, and the third one is a decision rather than a calculation.
Section
Part 4
Concept
Once the equation is written, prediction is the easiest thing in the lesson: put a number in for x and read the y that comes out. The whole difficulty is working out which number to put in.
\[ y = 41.3x + 259 \qquad \text{with } x \text{ measured in years since } 1997 \]
The x in that equation is not a year. It is a count of years since 1997, so 1997 itself is 0, 2004 is 7, and the year 2010 is 13. Every model in this lesson is built that way, and the table it came from said so in its first row.
The fourth step is the one this part is really about. The first three are arithmetic; the fourth decides how much the answer is worth, and it is the difference between a model and a fortune-teller.
Why count from 1997 at all, rather than using the year itself? Because an intercept at year zero would be a statement about the Roman Empire, and because the arithmetic with numbers from 0 to 7 is far less error-prone than arithmetic with numbers near 2000.
Worked example
Use the model from Example 3 to predict how many alternative-fuelled vehicles will be in use in the United States in 2010. The data ran from 1997 to 2004, so this is a question about a year nobody measured.
\[ y = 41.3x + 259 \]
Convert the year into the model's x
Why: x counts years after 1997, and 2010 is thirteen years after 1997.
\[ x = 2010 - 1997 = 13 \]
Stop on that line for a second, because it is where most of the marks in this exercise set are lost. Substituting 2010 itself would give 41.3 times 2010 plus 259, which is over eighty-three thousand, and a moment's thought about the units would have caught it.
Substitute 13 for x
Why: multiply first, then add the intercept.
\[ y = 41.3(13) + 259 = 536.9 + 259 = 795.9 \]
Round and restore the units
Why: y was measured in thousands of vehicles, so 795.9 means about 796 thousand.
\[ y \approx 796 \text{ thousand vehicles} \]
Before accepting that, sanity-check it against the data. The last measured count was 548 thousand in 2004, and six more years at about 41 thousand a year adds roughly 248 thousand, which lands near 796. The model and the back-of-envelope estimate agree.
Check the model on a year that was measured
Why: at x equal to 5, which is 2002, the model gives 465.5 against a measured 471, a miss of about one per cent, so the line is reliable inside the data.
\[ 41.3(5) + 259 = 465.5 \approx 471 \]
That check licenses the model inside the measured years. It says nothing at all about 2010, which is six years past the last measurement, and the next two slides are about exactly how much that matters.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 116 — Example 4
Picture it
Draw the model across a wider stretch than the data covers, and the two regions separate themselves. Inside the measured years the line is supported by evidence; past them it is supported by nothing but its own equation.
Figure (svg): The vehicle line drawn from 1997 to 2012, with the eight measured years shaded green and the years beyond the last measurement shaded pink; the 2010 prediction is a hollow point out in the pink region.
interpolation — Using the model at an x inside the range of the measured data.
extrapolation — Using the model at an x outside that range.
The green strip covers years 0 to 7, the eight years that were counted. A prediction there can be checked against neighbours on both sides, and the residual bars from Part 3 tell you roughly how far off it is likely to be.
The pink strip has no such guarantee. The line continues because a line always continues, not because anybody measured anything. The dashed drawing is the kit's way of saying so, and it is worth drawing your own extrapolations dashed for the same reason.
The 2010 prediction from Example 4 sits out at thirteen years, nearly twice as far from the origin as the last measurement. It is a reasonable estimate, and it is an estimate of a different kind from anything the green strip offers.
Sorting
The vehicle data covers years 0 to 7 after 1997, that is 1997 to 2004. The oil data covers years 0 to 8 after 1994, that is 1994 to 2002. Sort each question by which side of the data it falls on.
Sort into buckets
Sort each prediction by whether it interpolates within the measured data or extrapolates beyond it.
Notice that 1995 counts as an extrapolation even though it is in the past. Outside means outside in either direction, and running a model backwards past its first measurement is exactly as unsupported as running it forwards.
Extrapolating backwards is the one people forget, and it is often the more embarrassing of the two. The vehicle model at x equal to negative 10 predicts a negative number of vehicles, which is the sort of answer that gets noticed.
Nothing here says an extrapolation is forbidden. Guided Practice 4 asks for one, and so does Exercise 27. The rule is that you name it as one, and let that name carry into how confidently you state the answer.
Trap
The oil model looked reliable inside its nine years. A student uses it to answer a question about the middle of the century.
\[ y = -126.7x + 6687 \]
\[ x = 2050 - 1994 = 56 \]
\[ y = -126.7(56) + 6687 \]
\[ y = -408.2 \]
Every line of that is arithmetically correct. The answer is negative 408 thousand barrels of oil a day.
A line has no idea what it is describing. Told to keep falling by 126.7 a year, it does, straight through zero in 2047 and on into numbers that describe nothing at all.
\[ \begin{array}{c} -126.7x + 6687 = 0 \\ \Downarrow \\ x \approx 52.8 \end{array} \]
The fault is not in the model, which fits its nine years well. It is in asking a question 48 years past the last measurement, when the model was built from a span of eight.
A workable guide: stay within about half the span of your data beyond its edge, and say clearly that you are extrapolating even then. The oil data spans eight years, so 2009 is already stretching it, and 2050 is not a prediction at all.
Watch for the warning sign too. When a model produces an impossible value, a negative count, a percentage above a hundred, a boiling point below freezing, it is usually because it has been asked a question far outside the range it was built on.
Picture it
Draw the model across half a century and the problem becomes obvious in a way no amount of arithmetic makes it. The solid stretch is the nine measured years; everything dashed is the equation talking to itself.
Figure (svg): The oil line extended from the nine measured years out to 2050, where it crosses below zero; the crossing point near 53 years is ringed in red.
The nine measurements occupy the first eighth of the picture. That is the whole evidence base, and it is being asked to support a claim about a point six times further out than its own width.
Where the dashed line crosses the horizontal axis, at about 52.8 years after 1994, the model predicts a country producing exactly nothing. Past that it predicts negative production, which is not a small error but a meaningless answer.
Nothing went wrong in the fitting. A straight line falling at a fixed rate has to reach zero eventually, and the only question was ever how far out you were willing to follow it.
Use the picture as a habit rather than a warning. Sketch your model well past the data before you trust a far prediction, and see whether it is still saying something the quantity could actually do.
Worked example
Use the oil model to predict daily production in 2009, then say honestly what kind of prediction it is. The data was measured from 1994 to 2002.
\[ y = -126.7x + 6687 \]
Convert the year
Why: x counts years after 1994, and 2009 is fifteen years after 1994.
\[ x = 2009 - 1994 = 15 \]
Substitute 15 for x
Why: multiply, then add.
\[ y = -126.7(15) + 6687 = -1900.5 + 6687 = 4786.5 \]
Round and restore the units
Why: y was in thousands of barrels a day, so the model predicts about 4790 thousand barrels a day.
\[ y \approx 4790 \text{ thousand barrels per day} \]
Now name it. The last measurement was 2002, so 2009 is seven years beyond the data, which spans only eight years in total. This is an extrapolation of nearly the same length as the whole data set, which is right at the edge of what the model can carry.
It is also worth noticing what the answer claims: a fall of about 960 thousand barrels a day from the last measured figure, or about 17 per cent. That is a large claim to rest on a straight line drawn through nine points.
Check against the regression line
Why: computing the regression line for all nine measurements gives a slope of -129.83 and an intercept of 6701.6, which predicts 4754 for 2009, about 32 below the hand fit's answer.
\[ -129.83(15) + 6701.6 \approx 4754 \]
A gap of 32 on values near 4800 is under one per cent, so the two methods agree far more closely than either agrees with reality seven years out. The uncertainty here is in the extrapolation, not in the fitting.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 117 — Guided Practice 4, part (b)
Edge cases
There is no formula that says how far a model may be pushed, which makes it a judgement, and judgements improve by being argued rather than looked up. Argue this one before reading the answer.
Discussion prompt
The vehicle data covers eight years, 1997 to 2004. Say which of the years 2005, 2010 and 2050 you would be willing to predict for, and give a reason for each decision that refers to the data rather than to the arithmetic.
The half-the-span guide is a convention rather than a theorem, but it captures something real. The further out you go, the more the answer depends on the slope being exactly right, and a small error in the slope grows linearly with distance.
Try that with numbers. If the slope is wrong by 1 thousand vehicles a year, the prediction is out by 1 at one year, by 6 at six years, and by 46 at forty-six years, before anything about the world has changed at all.
And the world does change. The straight-line assumption is a claim that nothing new happens, which is comfortable over a year or two and increasingly bold after that.
Real world
Exercise 27 gives the number of countries at each Winter Olympics from 1980 to 2002 and asks for a prediction for 2014. Unlike most textbook extrapolations, this one can be checked, because 2014 has happened.
\[ \begin{array}{c|ccccccc} \text{years after }1980 & 0 & 4 & 8 & 12 & 14 & 18 & 22 \\ \hline \text{countries} & 37 & 49 & 57 & 64 & 67 & 72 & 77 \end{array} \]
Figure (svg): Seven Winter Olympic participation counts climbing from 37 countries in 1980 to 77 in 2002, with the fitted line continued to 2014 where it predicts 99 countries while the real figure, 88, sits well below it.
Discussion prompt
Fit a line to this data, predict the number of countries in 2014, and then compare with the real figure of 88. Say what the model got right and what it could not have known.
This is the most useful extrapolation in the lesson precisely because it is wrong. A prediction you can check turns a warning into evidence, and twelve per cent out after twelve years is a fair picture of what extrapolating costs.
Notice the shape of the error as well as its size. The model was too high, which is what always happens when growth is slowing and you model it with a straight line, and it is the same thing that will eventually make the vehicle prediction too high too.
Computing the regression line for this data gives a slope of 1.768 and an intercept of 40.7, predicting about 101 countries. The better fitting method made the extrapolation worse, which is worth sitting with: fitting accuracy and forecasting accuracy are not the same thing.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 119 — Exercise 27
Counterexample
Exercise 22 hands you a data set with a coefficient of 0.1 and asks whether it is logical to use the best-fitting line to make predictions. Decide before reading, and be ready to say what 0.1 actually implies about the picture.
Discussion prompt
A set of data pairs has a correlation coefficient of 0.1. Is it logical to use the best-fitting line to make predictions from it? Explain what a coefficient of 0.1 tells you about the scatter plot, and say what you would report instead.
The trap the exercise is set to catch is the habit of doing what you were taught rather than what the data supports. Every step of the four-step method works perfectly on a shapeless cloud, and produces a line that means nothing.
So the coefficient is not decoration to be reported at the end; it is the gate you pass through before fitting at all. Look at it, or at the picture, before you write your first slope.
A useful threshold to carry, though it is a convention and not a law: below about 0.5 in size, treat a line as describing a tendency at most, and never as a basis for a specific prediction.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 118 — Exercise 22
Section
Part 5
Concept
Every hand fit in this lesson was an attempt to find the bottom of the valley you slid along in Part 3. A graphing calculator does not attempt it; it computes the exact answer, for the slope and the intercept at once.
linear regression — The calculation that finds the one line making the total of the squared residuals as small as it can possibly be, for a given set of data pairs.
The name for that line is the regression line, and its defining property is the same one your ruler was chasing: no other straight line has a smaller total of squared residuals for this data. The calculator finds it by algebra you will meet later, not by trial and error.
The last item is a convenience worth knowing about. The machine has to compute quantities from which r falls out anyway, so it reports the coefficient for free, which saves you the estimating you have been doing by eye.
On many calculators the coefficient is hidden until you switch a diagnostics setting on, which is why a screen sometimes shows only the slope and the intercept. The book's margin note on page 116 tells you where to find that setting.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 116 — the linear regression feature
Worked example
Run the regression on the vehicle data from Example 3, then compare the result with the line you drew with a ruler. The point of the comparison is not to find out who wins; it is to find out by how much.
\[ \text{lists: } L_1 = 0, 1, 2, \ldots, 7 \qquad L_2 = 280, 295, \ldots, 548 \]
Read the regression output
Why: the calculator reports a slope, an intercept and the correlation coefficient; computing the same regression in node from the eight pairs reproduces every digit of the printed screen.
\[ a = 40.86904762, \quad b = 262.83333333, \quad r = 0.9929677507 \]
Every one of those digits is genuine arithmetic on eight integers, which is why it can be reproduced exactly rather than approximately. The digits are not evidence of accuracy about the world, though; they are evidence about the eight numbers you typed in.
Round to a usable model
Why: a slope of about 40.9 and an intercept of about 263 are as much precision as data measured in thousands can support.
\[ y = 40.9x + 263 \]
Figure (svg): The vehicle scatter with two nearly identical lines through it, the hand fit and the regression line, and a note that they differ by less than two units anywhere in the data.
There are two lines in that picture and they are hard to tell apart. The hand fit reads 41.3 and 259; the regression reads 40.9 and 263; and across the eight measured years the largest gap between them is under two thousand vehicles.
Check the regression against the hand fit on the total of the squares
Why: the regression scores 997 and the hand fit scores 1048, so the ruler came within about five per cent of the smallest total any line can achieve.
\[ E_{\text{regression}} \approx 997 \quad \text{against} \quad E_{\text{hand}} \approx 1048 \]
That five per cent is the honest value of the calculator here. It buys precision and speed, and it does not rescue a bad decision about whether a line was appropriate in the first place.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 116 — Example 5
Picture it
Draw the regression line with its own residual bars and put the two totals side by side. This is the one picture that says exactly what best fitting means, with no words needed.
Figure (svg): The vehicle scatter with the regression line and its residual bars, the total of their squares printed as 997 against the hand fit's 1048.
The bars look much like the ones under the hand fit, and the totals say why: 997 against 1048. The regression line is better, and it is better by an amount you would struggle to see.
What the regression line guarantees is that no other line does better. Tilt it slightly and the total rises; shift it up or down and the total rises; every direction from here is uphill. That is the whole meaning of the phrase best-fitting line.
It is also worth noticing what the regression does not guarantee. It finds the best straight line even when no straight line is any good, which is why a coefficient of 0.993 matters here: the line is both the best available and genuinely close.
Run the same calculation on the thrown-ball data and it returns a perfectly flat line with a coefficient of zero. The machine will always answer; deciding whether the answer is worth having remains yours.
Worked example
Finish the oil question by running the regression, then repeating the 2009 prediction with the computed line and comparing the two answers.
\[ \text{lists: } L_1 = 0, 1, \ldots, 8 \qquad L_2 = 6660, 6560, \ldots, 5750 \]
Read the regression output
Why: computing the regression from all nine pairs gives the slope, intercept and coefficient below.
\[ a \approx -129.8333, \quad b \approx 6701.5556, \quad r \approx -0.9652 \]
Compare that slope with the hand fit's negative 126.7. The regression says production fell a little faster, about 129.8 thousand barrels a day per year, because it is weighing all nine years rather than the two that the sketch happened to pass through.
Substitute 15 for x in the regression model
Why: 2009 is fifteen years after 1994, the same conversion as before.
\[ y \approx -129.8333(15) + 6701.5556 \approx 4754.1 \]
So the regression predicts about 4754 thousand barrels a day and the hand fit predicted about 4790. The two disagree by about 36 on a value near 4800, which is under one per cent, and both are seven years past the data.
Check which line fits the nine measured years better
Why: the regression scores about 74154 on the total of the squares and the hand fit scores about 74791, so the regression wins by under one per cent.
\[ E_{\text{regression}} \approx 74154 \quad \text{against} \quad E_{\text{hand}} \approx 74791 \]
The lesson from both these comparisons is the same. Careful sketching gets you within a few per cent of the best line there is, and the difference between the two is far smaller than the uncertainty in any extrapolation you make from either.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 117 — Guided Practice 4, part (c)
Concept
Everything so far has been about describing and predicting. This last idea is about what a correlation does not entitle you to say, and it is the part of this lesson that matters longest after the exam.
A strong correlation says that two quantities move together in the data you have. It does not say that one of them makes the other happen. Three quite different situations produce the same rising cloud, and the plot cannot distinguish them.
Figure (svg): A diagram with three boxes. A box for national wealth at the top has arrows down to a box for computers per person and a box for life expectancy; a dashed two-headed arrow joins those two lower boxes and is labelled correlation, not cause.
The third case is the one in Exercise 29, and it is the one that catches careful people. Countries with more computers per person do have longer life expectancies, and the coefficient is genuinely strong, but neither quantity is acting on the other.
What is acting on both is national wealth. A richer country buys more computers and also builds more hospitals, trains more doctors and cleans more water, so the two quantities rise together without either touching the other.
The habit to build is to ask, every time you see a correlation, which of those three situations it might be, and to notice that the scatter plot itself gives you no way to choose between them.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 120 — Exercise 29
Trap
Exercise 29 gives real data from countries in North America: a positive correlation between the average life expectancy and the number of personal computers per person. A student writes the conclusion:
\[ \begin{array}{c} r > 0 \\ \Downarrow \\ \text{computers cause} \\ \text{longer lives} \end{array} \]
And then the recommendation that follows from it: send computers to countries with low life expectancy, and life expectancy will rise.
The correlation is real, the data is honest, and the policy is worthless. Nothing in a scatter plot licenses that last step.
The missing question is what else differs between the countries at the two ends of the plot. Wealth does, and wealth buys both computers and healthcare, so it produces the correlation without any arrow running between the two plotted quantities.
\[ \begin{array}{rcl} \text{wealth} & \nearrow & \text{computers} \\ \text{wealth} & \nearrow & \text{life} \end{array} \]
The test that exposes it is a thought experiment: imagine shipping computers to a country and changing nothing else. Nobody expects that to lengthen lives, and that expectation is knowledge about the world which the data never contained.
So the honest conclusion is the modest one: these two quantities rise together, most likely because both rise with national wealth, and this data cannot tell you what would happen if you changed one of them.
This error has a name outside the classroom, the confounding variable, and it appears in the news most weeks. Recognising it from a scatter plot is one of the most durable things Algebra 2 will teach you.
Socratic
Exercise 28 gives shipments of cassettes and of compact discs in the United States from 1988 to 2002. The two clouds run in opposite directions, and the third part of the question asks what to make of that.
| year | 1988 | 1992 | 1996 | 2000 | 2002 |
|---|---|---|---|---|---|
| cassettes (millions) | 450.1 | 336.4 | 225.3 | 76.0 | 31.1 |
| discs (millions) | 149.7 | 407.5 | 778.9 | 942.5 | 803.3 |
Discussion prompt
Describe the correlation between year and cassettes, between year and discs, and between cassettes and discs. Then say what real-world factors might account for the last one, and whether the data proves them.
This one is worth arguing over because the causal story is so persuasive. Replacement really was happening, and yet the plot alone cannot show it: year is quietly driving both columns, which is the third situation from the last slide.
Notice the last pair of numbers too. Disc shipments fell between 2000 and 2002, while cassettes kept falling, so the negative correlation between the two formats is being weakened by something new, which turned out to be downloading.
That is a good reminder that a correlation belongs to a period as well as to a pair of quantities. Extend the years far enough and both columns fall together, and the sign of the relationship flips.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 119 — Exercise 28
Elimination
Four claims, each built on a genuine correlation from this lesson. Exactly one of them is something a scatter plot can support. Rule out the other three and say what is wrong with each.
Eliminate the wrong options
A scatter plot supports exactly one of these four claims. Which one survives?
Survives elimination: a
Why: Only the first claim stays inside what a scatter plot can show: it describes how two measured quantities move together in the data, and makes no statement about what causes what or about what would happen if you intervened. The other three all cross that line, either by naming a cause or by turning a tendency across a group into a promise about every individual.
The surviving claim is deliberately unexciting, and that is the point. Statements a scatter plot can support tend to sound modest, and the interesting-sounding versions are usually the ones that have added something the data does not contain.
The last claim is worth a second look, because its fault is different from the others. It is not about causation at all but about scope: a correlation is a statement about a group, and turning it into a promise about each member of the group is a separate mistake.
A phrase worth keeping for your written answers: these quantities are associated in this data. It is accurate, it is what you can defend, and it leaves the causal question open for evidence that could actually settle it.
Pattern
Five parts, one routine. Nothing here is new; it is the order that is worth memorising, because every step depends on the one before it having been done honestly.
Steps 3 and 7 are the two that separate a student who has learned the procedure from one who has understood it. Both are decisions rather than calculations, and both are places where the arithmetic will happily proceed without you.
Step 4 is the one with a checkable test attached: count the points on each side of your line. If they are wildly uneven, move the line before you read any coordinates off it.
If you have a calculator, steps 4 and 5 can be replaced by the regression feature, which finds the best line exactly. Every other step still has to be done by you, and the ones that matter most are among them.
Check
Strength is distance from zero, and the sign plays no part in it. Read all four values as sizes before you choose.
Check your understanding
A set of data has correlation coefficient r. For which value of r would the data points lie closest to a line?
Answer: A
Why: Closeness to a line is measured by how far the coefficient is from zero, in either direction. The sizes here are 0.96, 0, 0.38 and 0.5, so the value of negative 0.96 is much the furthest from zero and its points lie nearest a line. That line falls rather than rises, which is what the minus sign reports and has nothing to do with strength.
The trap built into this question is reading the values as numbers on a line rather than as sizes. Ordered as numbers, negative 0.96 is the smallest of the four; ordered as strengths, it is the largest.
A reliable way to answer questions of this shape is to write each value without its sign first, and only then compare. It costs a moment and removes the whole difficulty.
If you want to see it rather than argue it, look back at the three panels of Example 2: the panel with the tightest cloud had a coefficient of 0.98, and the shapeless one had -0.01.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 118 — Exercise 18
Check
Do not test all four by substituting points. Read two things off the picture first, the height where the cloud would meet the vertical axis and how fast it falls, and most options will fail immediately.
Figure (svg): A falling scatter of nine points from about 18 at x equals 2 down to about 8 at x equals 28, with no line drawn on it yet.
Check your understanding
Which equation best models the data in this scatter plot?
Answer: C
Why: The cloud falls, so the slope must be negative, which rules out the horizontal option at once. Extending the cloud back to the vertical axis puts it near 19, and it falls by about 10 over 26 steps to the right, which is a slope near negative 0.4. The equation with slope negative two fifths and intercept 19 matches both readings; computing the regression line for the plotted points gives a slope of -0.411 and an intercept of 19.17, confirming it.
The elimination order matters. Ruling out the horizontal option takes one glance, and checking the intercept against the left edge of the cloud removes two more, so you are left with one candidate before any arithmetic happens.
If you do want to test numerically, use a point in the middle of the cloud rather than at either end, because the ends are where a wrong line is most likely to pass close by accident.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 118 — Exercise 16
Check
The vehicle model, used on a year inside the measured range. The whole question is whether you convert the year correctly before substituting.
\[ y = 41.3x + 259, \qquad x \text{ years after } 1997 \]
Check your understanding
What does this model predict for the number of alternative-fuelled vehicles in 2005, in thousands?
Answer: A
Why: The model counts years after 1997, so 2005 gives x equal to 8. Substituting, 41.3 times 8 is 330.4, and adding 259 gives 589.4, which is about 589 thousand vehicles. Sanity-check it against the data: the last measured count was 548 thousand in 2004, and one more year at about 41 thousand lands just under 590.
The wrong option worth studying is the calendar-year one, because it is the mistake this exercise set punishes most often and because the arithmetic that produces it is perfectly correct.
The defence against it is a units check at the end. Ask what the answer would mean, and eighty-three million vehicles in a country that had counted 548 thousand the year before is not a number anybody would accept.
Notice also that this prediction is an interpolation, since 2005 is one year past the last count of 2004. Strictly it is just outside, by one year on a span of eight, which is about as safe as stepping outside the data ever gets.
Explain it to yourself
One distinction has run through this whole lesson in three different costumes. Writing it out in your own sentences is what turns it from something you have read into something you will notice.
Discussion prompt
In three or four sentences, explain the difference between what a scatter plot can show you and what it cannot, using one example from this lesson for each half. Then say which of the lesson's five parts you would want to redo, and why.
If your explanation leaned on the words positive and negative more than on the words tight and loose, go back to Part 2. Direction is the easy half of reading a scatter plot, and strength is the half that decides whether anything else you do is worthwhile.
A good test of your own understanding is whether you can state what a correlation entitles you to say, in one sentence, without using the word cause. If you can, you have the part of this lesson that lasts.
Try the second half of the question honestly too. Most students find Part 3 the one worth redoing, because sketching a line is the only skill here that improves with practice rather than with reading.
Exit ticket
One question using the whole routine: plot, sketch, read two points, write the equation, predict, and label the prediction. The data is the average price of a ticket to one of the top fifty touring acts.
\[ \begin{array}{c|cccccc} \text{years since }1999 & 0 & 1 & 2 & 3 & 4 & 5 \\ \hline \text{price (dollars)} & 38.56 & 44.80 & 46.69 & 50.81 & 51.81 & 58.71 \end{array} \]
Discussion prompt
Sketch a line through this data, read two points off it, write the equation, and use it to predict the average ticket price in 2010. Then say whether that is an interpolation or an extrapolation and how much confidence it deserves.
Note the coefficient for this data before you decide the model is trustworthy: it computes to 0.979, which is strong, so a line is a reasonable thing to fit here and the four-step method is doing honest work.
The conversion is the place to be careful, as always. The table counts years since 1999, so 2010 is eleven, not 2010 and not 10. Write that line down separately rather than doing it in your head.
If your sketched line differed from the one above, that is expected and it is not a mistake. Compare your prediction rather than your coefficients: anything between about 77 and 83 dollars is the same answer arrived at with a slightly different ruler.
McDougal Littell Algebra 2 (Texas Edition), Ch. 2 Linear Equations and Functions — Lesson 2.6 Draw Scatter Plots and Best-Fitting Lines §2.6, p. 120 — the Chapter Quiz, question 15
Recap
You started this lesson able to write the equation of a line through two exact points. You finish it able to build a line from measurements that lie on no line at all, and to say how far that line can be trusted.
| the question | what you do | the example from this lesson |
|---|---|---|
| Which way do they move together? | plot, and name the correlation | cellular subscribers and corded phone sales |
| How tightly? | estimate r: sign is direction, size is strength | the three plots of Example 2 |
| What line describes them? | sketch, read two points off it, write the equation | y = 41.3x + 259 for the vehicle data |
| What would y be at this x? | substitute, then label interpolation or extrapolation | about 796 thousand vehicles in 2010 |
| What is the exact best line? | run the regression on a calculator | y = 40.9x + 263, total of squares 997 |
| Does x cause y? | the plot cannot say, so do not claim it | computers per person and life expectancy |
\[ y = 41.3x + 259 \qquad \text{against} \qquad y = 40.9x + 263 \]
Those two lines are the lesson in one picture. A ruler and an eye produced the first, and a calculation that minimises the total of the squared residuals produced the second, and across the measured years they never differ by more than about two thousand vehicles.
The number to carry forward is the coefficient, because it is the gate. Near 1 in size, a line is worth fitting and worth predicting from; near zero, the honest report is that no straight line describes this data, whatever the arithmetic is willing to produce.
The habit to carry forward is the label on every prediction. Inside the data you are interpolating and the residuals tell you roughly how wrong you will be; outside it you are extrapolating, and the Winter Olympics said what that can cost.
Chapter 11 returns to this with the formula that computes r rather than estimating it, and with the algebra that produces the regression line. Everything there is this lesson made exact, and none of it changes the judgements you learned here.
OpenStax Algebra and Trigonometry 2e, §4.3 Fitting Linear Models to Data §4.3 — the same fitting, with the least-squares criterion stated explicitly
Want this taught 1-on-1? Alexander tutors Algebra 2 — $55/session, free consultation.