Unit 4, lesson 41

Scatterplots, Models and Predictions

How to read a scatterplot, interpret the slope, intercept and residuals of a fitted model, and judge how far a prediction from that model can be trusted.

  • Theory part 81
  • Practice part 82
  • Data and Probability

Theory, part 81

Practice, part 82

A gardener measures a sunflower seedling once a week. The heights go up, but not in a perfectly straight line, since one week is warm and the next is cloudy. Still, a single straight line drawn through the cloud of points says a lot. It gives a growth rate, it lets you guess the height on a day nobody measured, and it shows which weeks were better or worse than usual. SAT questions on data models ask exactly these things, and they also ask what the model cannot tell you.

Key terms

Scatterplot

Definition A scatterplot displays paired numerical data (x1,y1),(x2,y2),…,(xn,yn)(x_1, y_1), (x_2, y_2), \ldots, (x_n, y_n) as nn points in the coordinate plane. Each point is one observation, with the explanatory variable xx on the horizontal axis and the response variable yy on the vertical axis. Both axes are labeled with the variable and its units.

In plain words Every dot is one thing that was measured twice. Its left to right position shows one measurement and its height shows the other.

Example The seedling’s height yy in centimeters, xx weeks after planting, was recorded for eight weeks.

Week xxHeight yy (cm)
116.06.0
229.59.5
3310.510.5
4415.015.0
5516.516.5
6619.019.0
7722.522.5
8824.024.0

The scatterplot has eight points, from (1,6.0)(1, 6.0) up to (8,24.0)(8, 24.0), with weeks on the horizontal axis and centimeters on the vertical axis.

Association

Definition Two numerical variables have a positive association when larger values of one tend to go with larger values of the other, and a negative association when larger values of one tend to go with smaller values of the other. The association is linear when the points lie close to a line and nonlinear when they follow a curve. It is strong when the points lie close to that line or curve and weak when they are widely scattered. When no such tendency appears, the variables show no association. An association, however strong, does not by itself show that one variable causes changes in the other.

In plain words Association describes the shape of the cloud of points. It says the two quantities move together, not why they do.

Example The seedling data show a strong, positive, linear association, since every point sits close to one rising line. A city’s daily ice cream sales and its daily number of sunburns also have a positive association, yet ice cream does not cause sunburns. Hot sunny days push both up. A question that asks whether one variable causes the other usually needs a controlled experiment, which you meet in Experiments, Observations and Causal Claims.

Line of best fit

Definition A line of best fit is a line y^=mx+b\hat{y} = mx + b chosen to summarize a roughly linear scatterplot, with the points as close to it as possible overall. The most common choice, the least squares regression line, makes the sum of the squared vertical distances from the points to the line as small as possible. The fitted line usually passes through few or none of the data points. In context, the slope mm is the predicted change in yy for each increase of 11 in xx, and the intercept bb is the predicted value of yy when x=0x = 0.

In plain words The line follows the trend and ignores the small ups and downs. Its slope is the typical rate, and its intercept is the model’s starting value, which may or may not make sense in the real situation.

Example For the seedling data the least squares line, with rounded coefficients, is

y^=2.6x+3.7.\hat{y} = 2.6x + 3.7.

It goes through none of the eight points. The slope says the model predicts about 2.62.6 centimeters of growth per week. The intercept says the model gives a height of 3.73.7 centimeters at week 00, which is outside the measured weeks and does not match a seed just placed in soil. That intercept only anchors the line, it is not a real measurement.

Prediction

Definition A prediction from a model y^=f(x)\hat{y} = f(x) is the value f(x0)f(x_0) that the model gives at a chosen input x0x_0. It is an estimate of a typical response at x0x_0, not a guaranteed value for any single observation.

In plain words Put the input into the equation, or trace up from the input to the line and across to the vertical axis. What you read off is the model’s best guess.

Example At week 44 the line predicts

y^=2.6(4)+3.7=14.1 cm.\hat{y} = 2.6(4) + 3.7 = 14.1 \text{ cm.}

The seedling actually measured 15.015.0 centimeters that week, so the prediction is close but not exact.

Residual

Definition For a data point (xi,yi)(x_i, y_i) and a model that predicts y^i\hat{y}_i at xix_i, the residual is

residual=yi−y^i,\text{residual} = y_i - \hat{y}_i,

the observed value minus the predicted value. This is the standard convention, and it is the one to use unless a question defines residual differently. With it, a positive residual means the point lies above the graph of the model and a negative residual means it lies below. On a graph the residual is the signed vertical distance from the model to the point.

In plain words A residual measures how wrong the model was for one actual observation. Always subtract in the order actual minus predicted.

Example The seedling residuals for y^=2.6x+3.7\hat{y} = 2.6x + 3.7 are listed below.

xxyyy^\hat{y}y−y^y - \hat{y}
116.06.06.36.3−0.3-0.3
229.59.58.98.90.60.6
3310.510.511.511.5−1.0-1.0
4415.015.014.114.10.90.9
5516.516.516.716.7−0.2-0.2
6619.019.019.319.3−0.3-0.3
7722.522.521.921.90.60.6
8824.024.024.524.5−0.5-0.5

At week 44 the point sits 0.90.9 centimeter above the line. The residuals are small and switch between positive and negative with no pattern, which is a good sign that a line suits these data. A curved pattern in the residuals, such as negative at both ends and positive in the middle, says the line misses a bend in the data.

Interpolation and extrapolation

Definition Using a model to predict at an input inside the range of the observed xx values is interpolation. Predicting at an input outside that range is extrapolation. Interpolation is usually reasonable when the model fits the data well. Extrapolation assumes the pattern continues where nothing was measured, so it becomes less reliable the farther the input is from the data, and far outside the data it can give impossible values.

In plain words Between the dots, the trend has been checked. Beyond the dots, you are guessing that the world keeps behaving the same way.

Example The weeks observed run from 11 to 88. A prediction for week 5.55.5 is interpolation,

y^=2.6(5.5)+3.7=18.0 cm,\hat{y} = 2.6(5.5) + 3.7 = 18.0 \text{ cm,}

and it is believable. A prediction for week 5252 is extrapolation,

y^=2.6(52)+3.7=138.9 cm,\hat{y} = 2.6(52) + 3.7 = 138.9 \text{ cm,}

and it is not believable, because a sunflower finishes growing and dies long before a year has passed. The equation does not know that.

Quadratic model

Definition A quadratic model has the form

y^=ax2+bx+c,a≠0.\hat{y} = ax^2 + bx + c, \qquad a \ne 0.

Its graph is a parabola that opens down when a<0a < 0 and up when a>0a > 0, so it suits data that rise and then fall, or fall and then rise. The vertex sits at x=−b2ax = -\frac{b}{2a}. Smaller residuals for one model than for another mean that model fits these particular points better. They do not prove that it describes the true process, and some other model, not yet tried, might fit as well or better.

In plain words Use a parabola when the points bend. Judge a fit by its residuals, but remember that a good fit to a handful of points is evidence, not proof.

Example A farm tests xx hundred kilograms of fertilizer per hectare and records the yield yy in tons per hectare. The least squares line for these five points is y^=0.97x+6.14\hat{y} = 0.97x + 6.14, which rounds to the line y^=x+6.1\hat{y} = x + 6.1. The least squares parabola, with its coefficients rounded to whole numbers, is y^=−2x2+9x+2\hat{y} = -2x^2 + 9x + 2. The residuals below are computed from these two rounded models.

xxyyLine residualParabola residual
002.42.4−3.7-3.70.40.4
118.78.71.61.6−0.3-0.3
2212.312.34.24.20.30.3
3310.810.81.71.7−0.2-0.2
446.26.2−3.9-3.90.20.2

The line’s residuals are large and form a curve, negative, positive, positive, positive, negative. The parabola’s residuals are all small with no pattern, so the quadratic model fits these data much better. Its vertex is at

x=−92(−2)=2.25,x = -\frac{9}{2(-2)} = 2.25,

so the parabola predicts the highest yield, about 12.112.1 tons per hectare, at 225225 kilograms of fertilizer per hectare. Extrapolating to x=6x = 6 gives −16-16 tons, an impossible yield, which is another reminder to stay near the data.

Exponential fit

Definition An exponential model has the form

y^=a⋅bx,a>0,b>0,b≠1.\begin{gathered} \hat{y} = a \cdot b^x, \\[0.4em] a > 0, \quad b > 0, \quad b \ne 1. \end{gathered}

The value aa is the predicted value of yy at x=0x = 0, and each increase of 11 in xx multiplies the predicted value by bb. When b>1b > 1 the model predicts growth of (b−1)⋅100(b - 1) \cdot 100 percent per unit of xx, and when 0<b<10 < b < 1 it predicts decay of (1−b)⋅100(1 - b) \cdot 100 percent per unit. An exponential fit suits data whose ratios of consecutive values, at equally spaced inputs, stay roughly constant.

In plain words A linear model adds the same amount each step. An exponential model multiplies by the same factor each step.

Example A lab counts bacteria colonies on a dish xx hours after a sample is added, and an exponential fit to the counts is

y^=120(1.35)x.\hat{y} = 120(1.35)^x.

The model estimates 120120 colonies at the start and an increase of 3535 percent each hour. Three hours in, it predicts

120(1.35)3≈295 colonies.120(1.35)^3 \approx 295 \text{ colonies.}

In the Desmos graphing calculator you can enter the data in a table, whose columns are named x1x_1 and y1y_1, and then type a regression that uses the tilde symbol in place of the equals sign, such as y1∼abx1y_1 \sim a b^{x_1} for an exponential fit or y1∼mx1+by_1 \sim m x_1 + b for a linear one. The calculator finds values for the letters aa and bb, or mm and bb, and displays them.

Check yourself

  1. For a set of used cars, the line of best fit relating price yy, in thousands of dollars, to age xx, in years, is y=−1.6x+24.5y = -1.6x + 24.5. Which choice is the best interpretation of −1.6-1.6 in this context? (A) The predicted price of a new car is 1.61.6 thousand dollars. (B) For each additional year of age, the predicted price decreases by 1.61.6 thousand dollars. (C) Every car in the data loses exactly 1.61.6 thousand dollars of value each year. (D) For each additional 1.61.6 years of age, the predicted price decreases by 11 thousand dollars.
Show the answer

The correct choice is (B). The slope is the predicted change in yy per one unit of xx. Choice (A) describes the intercept, and the intercept is 24.524.5, not 1.61.6. Choice (C) treats the model as exact for every car, but a line of best fit describes a trend and individual cars have residuals. Choice (D) swaps the roles of the two variables.

  1. A line of best fit for a data set is y^=0.45x+12\hat{y} = 0.45x + 12. One data point is (40,27.5)(40, 27.5). Using residual equals actual value minus predicted value, what is the residual for this point?
Show the answer

The model predicts

y^=0.45(40)+12=30,\hat{y} = 0.45(40) + 12 = 30,

so the residual is 27.5−30=−2.527.5 - 30 = -2.5. The point lies 2.52.5 units below the line. The tempting answer 2.52.5 comes from subtracting in the wrong order.

  1. The estimated number of fish of one species in a lake tt years after a survey began is modeled by f(t)=850(0.92)tf(t) = 850(0.92)^t. Which choice is the best interpretation of 0.920.92? (A) The estimated number of fish decreases by 9292 percent each year. (B) The estimated number of fish decreases by 88 percent each year. (C) The estimated number of fish decreases by 0.920.92 fish each year. (D) The estimated number of fish when the survey began was 9292 percent of 850850.
Show the answer

The correct choice is (B). Each year the estimate is multiplied by 0.920.92, so 9292 percent remains and 1−0.92=0.081 - 0.92 = 0.08, or 88 percent, is lost. Choice (A) confuses the part kept with the part lost. Choice (C) reads the model as linear. Choice (D) is wrong because the estimate at t=0t = 0 is 850(0.92)0=850850(0.92)^0 = 850.

How this lesson connects