High school Β· MathematicsAbout 150 minutes
MathematicsHigh schoolAbout 150 minutes

Compute residuals, draw a residual plot and use it to assess informally how well a function fits the data

Several sessions: instruction with the hypothetical data sets, technology work (spreadsheet or graphing calculator), independent practice and a written conclusion in context.

Ohio learning standards this draft targets

math-2017:S.ID.6bmath-2017:S.ID.6

Read the standard text

math-2017:S.ID.6b Informally assess the fit of a function by discussing residuals. (A2, M3)

math-2017:S.ID.6 Represent data on two quantitative variables on a scatter plot, and describe how the variables are related.

Provisional targets. Clause-by-clause educational review is still pending.

Section 1 Β· LearnLearn the idea
Residual plot for the least-squares line d = 0.7v βˆ’ 10.5 fitted to the seven hypothetical stopping distances. The residuals, in meters, are +2.3, +0.6, βˆ’1.7, βˆ’2.6, βˆ’1.5, +0.8 and +2.1 at speeds of 20, 30, 40, 50, 60, 70 and 80 km/h, and they add to 0. They are positive at both ends and negative in the middle, a U-shaped pattern, which shows that a straight line is the wrong form for these data even though r = 0.992.Residual plot for the least-squares line d = 0.7v βˆ’ 10.5 fitted to the seven hypothetical stopping distances. The residuals, in meters, are +2.3, +0.6, βˆ’1.7, βˆ’2.6, βˆ’1.5, +0.8 and +2.1 at speeds of 20, 30, 40, 50, 60, 70 and 80 km/h, and they add to 0. They are positive at both ends and negative in the middle, a U-shaped pattern, which shows that a straight line is the wrong form for these data even though r = 0.992.Residual plot for the line d = 0.7v βˆ’ 10.5fitted to the stopping distances102030405060708090-3-2-10123zero line+2.3+0.6βˆ’1.7βˆ’2.6βˆ’1.5+0.8+2.1Speed v (km/h)Residual: observed βˆ’ predicted (m)
Residual plot for the least-squares line d = 0.7v βˆ’ 10.5 fitted to the seven hypothetical stopping distances. The residuals, in meters, are +2.3, +0.6, βˆ’1.7, βˆ’2.6, βˆ’1.5, +0.8 and +2.1 at speeds of 20, 30, 40, 50, 60, 70 and 80 km/h, and they add to 0. They are positive at both ends and negative in the middle, a U-shaped pattern, which shows that a straight line is the wrong form for these data even though r = 0.992.

Learning goal: For data on two quantitative variables shown on a scatter plot, compute the residuals of a fitted function, draw a residual plot, and informally assess the fit of the function by discussing the residuals: their signs, their pattern and their size in context. Explain why a high correlation, a zero sum of residuals or a small residual at one point does not show that a function fits.

The data and a first function. On a hypothetical test track, a car is braked to a stop from seven speeds and the stopping distance is measured. The numbers are invented for teaching and chosen so that the arithmetic is clean. The pairs (speed in km/h, stopping distance in m) are (20, 5.8), (30, 11.1), (40, 15.8), (50, 21.9), (60, 30.0), (70, 39.3), (80, 47.6). On a scatter plot with speed on the horizontal axis, the variables are related positively and strongly: faster speeds go with longer stopping distances. The form looks almost straight at first glance, with a slight upward bend. Linear regression (least squares) returns d = 0.7v βˆ’ 10.5, and the correlation coefficient is r = 0.992. Many people would stop here. Residuals are the tool for deciding whether they should.

What a residual is. For each data point, residual = observed value βˆ’ predicted value, that is, y βˆ’ f(x), where f is the fitted function. A residual is measured in the units of y. It is positive when the point lies above the graph (the function predicted too little), negative when the point lies below the graph (the function predicted too much) and zero when the graph passes through the point. There is one residual for every data point. For the line, the predicted distances at the seven speeds are 3.5, 10.5, 17.5, 24.5, 31.5, 38.5 and 45.5 m, so the residuals are 5.8 βˆ’ 3.5 = +2.3, 11.1 βˆ’ 10.5 = +0.6, 15.8 βˆ’ 17.5 = βˆ’1.7, 21.9 βˆ’ 24.5 = βˆ’2.6, 30.0 βˆ’ 31.5 = βˆ’1.5, 39.3 βˆ’ 38.5 = +0.8 and 47.6 βˆ’ 45.5 = +2.1 m.

The residual plot. A residual plot graphs each residual against its x-value, with a horizontal line at zero. It takes the tilt of the fitted function out of the picture and magnifies what is left over, so patterns that are hard to see on the scatter plot become obvious. A function fits well when two things are true of its residuals. First, they show no pattern: positive and negative residuals are mixed along the whole x-axis, with no curve, no steady trend and no widening. Second, they are small in context: small compared with the y-values and with the accuracy the situation needs. For the line, the residuals read +, +, βˆ’, βˆ’, βˆ’, +, + from left to right: positive at both ends and negative in the middle, a U shape. That is a pattern, and a pattern means the function is missing something systematic about how the variables are related. Here the line predicts too little at low and high speeds and too much in between, which is what happens when a straight line is laid across data that curve upward.

Trying the function the context suggests. Physics gives a reason to expect a curve. While the driver reacts, the car covers a distance proportional to its speed; once the brakes are on, the braking distance under a steady deceleration is proportional to the square of the speed. A quadratic function is suggested, and quadratic regression returns d = 0.005vΒ² + 0.2v (the constant term comes out as 0). Its predictions are 6.0, 10.5, 16.0, 22.5, 30.0, 38.5 and 48.0 m, so its residuals are βˆ’0.2, +0.6, βˆ’0.2, βˆ’0.6, 0.0, +0.8 and βˆ’0.4 m. The signs are mixed with no curve, and the largest residual is 0.8 m, compared with 2.6 m for the line. The sum of the squared residuals falls from 22.60 for the line to 1.60 for the quadratic function. The informal assessment: the quadratic function fits these data well, to within about a meter at every speed, and the line does not, because its residuals have a clear curved pattern.

The difference matters when the functions are used. At 50 km/h, inside the data, the line predicts 24.5 m and the quadratic function 22.5 m; the measurement was 21.9 m. At 100 km/h, an extrapolation for both, the line predicts 59.5 m and the quadratic function 70 m, a difference of 10.5 m in a prediction about braking. At 0 km/h the line predicts βˆ’10.5 m, and it predicts a stopping distance of zero at 15 km/h; the quadratic function predicts 0 m at 0 km/h.

Four cautions, each with its condition. (1) A sum of zero proves nothing. For a least-squares line, and for any least-squares polynomial fit that includes a constant term, the residuals always add to zero apart from rounding. Check the line: 2.3 + 0.6 βˆ’ 1.7 βˆ’ 2.6 βˆ’ 1.5 + 0.8 + 2.1 = 0. A badly chosen form still has residuals that cancel, so the sum cannot be the test; the pattern and the sizes are. (The property needs both conditions: a least-squares fit made on y itself, and a family with an added constant term. A line drawn by eye, a given function, a least-squares line forced through the origin, or an exponential function aΒ·bΛ£, which has no added constant term, need not have residuals that add to zero.) (2) A small residual at one point proves nothing. At 30 km/h the line's residual is +0.6 m, exactly the same as the quadratic function's. Judged at that one speed the two functions look equally good. Any line laid across a curve is close to the curve near the places where they cross. Fit is a property of all the residuals together. (3) A high correlation does not show that a line is the right form. The correlation coefficient measures how close the points are to a straight line; here r = 0.992, and the residual plot still shows a curve. A value of r close to 1 or βˆ’1 says that a line captures most of the variation, not that nothing systematic is left. The reverse also holds: a residual plot with no pattern but large residuals means the form is reasonable while individual predictions are imprecise. (4) A family that contains another always comes at least as close. A least-squares quadratic function can never have a larger sum of squared residuals than the least-squares line for the same data, because the line is the special case a = 0. So a smaller sum of squares alone does not justify the quadratic function. Ask three things: did the pattern disappear, is the improvement large compared with the residuals themselves, and does the context support the form? Here all three answers are yes.

Other patterns and what they mean. Residuals that fan out, small on one side of the plot and large on the other, mean the function's predictions are less precise where the spread is wide, even if the form is right. A single residual much larger than the rest marks a possible outlier: check the record, and remember that one extreme point can pull a fitted function toward itself. Residuals that are all positive or all negative mean the graph sits wholly below or above the points, as with a line drawn by eye too low. Residuals that climb steadily from negative to positive mean the data rise faster, or fall more slowly, than a given or hand-drawn line: its slope, as a signed number, is too small.

What "informally" means. No formal test or cutoff is used. The assessment is a short argument in words: describe the signs and pattern of the residuals, state their typical and largest sizes in the units of y, compare those sizes with what the context needs, and say what follows for using the function.

Section 2 Β· ModelWork through the examples

Worked residuals for a good linear fit: The hypothetical candle from the lesson on fitting functions to data had heights 24.2, 21.2, 19.1, 16.3, 14.3, 11.6, 8.6 and 6.7 cm after 0 to 7 hours, and the least-squares line h = βˆ’2.5t + 24. The predicted heights are 24.0, 21.5, 19.0, 16.5, 14.0, 11.5, 9.0 and 6.5 cm, so the residuals are +0.2, βˆ’0.3, +0.1, βˆ’0.2, +0.3, +0.1, βˆ’0.4 and +0.2 cm. On a residual plot the signs alternate irregularly across the whole time axis: no curve, no trend, no widening. The largest residual is 0.4 cm on heights between 6.7 and 24.2 cm. Informal assessment: a linear function fits these data well, and predictions inside 0 to 7 hours should be good to about half a centimeter. The residuals add to 0, as they must for a least-squares line.

Worked comparison of a line and an exponential function: The hypothetical bouncing ball had heights 100, 78, 64, 51, 40, 33 and 26 cm on bounces 0 to 6. The least-squares line is h = βˆ’12n + 92, with r = βˆ’0.980. Its predictions are 92, 80, 68, 56, 44, 32 and 20 cm, so its residuals are +8, βˆ’2, βˆ’4, βˆ’5, βˆ’4, +1 and +6 cm: positive at both ends, negative in the middle, the same U shape as the stopping data, with a largest residual of 8 cm. The exponential function h = 99.1(0.800)ⁿ, fitted through logarithms, predicts 99.1, 79.3, 63.4, 50.7, 40.6, 32.5 and 26.0 cm, giving residuals +0.9, βˆ’1.3, +0.6, +0.3, βˆ’0.6, +0.5 and 0.0 cm: mixed signs, no curve, largest 1.3 cm. The exponential function fits and the line does not, although r = βˆ’0.980 sounds strong. Notice that the exponential function's residuals add to +0.4, not 0 (about +0.1 before the coefficients were rounded). Nothing is wrong. The zero-sum property belongs to least-squares fits on y for families with an added constant term, such as mx + b; the function aΒ·bⁿ has no added constant term, and it was fitted on ln h besides, so the property does not apply to it. The consequences agree with the residuals: at bounce 8 the line predicts βˆ’12(8) + 92 = βˆ’4 cm, an impossible height.

Worked residuals from a line drawn by eye: A student draws a line through the candle scatter plot and reads off h = 23 βˆ’ 2.5t. Its predictions are 23.0, 20.5, 18.0, 15.5, 13.0, 10.5, 8.0 and 5.5 cm, so the residuals are +1.2, +0.7, +1.1, +0.8, +1.3, +1.1, +0.6 and +1.2 cm. Every residual is positive and they add to 8.0, a mean of +1.0 cm: the line has the right slope but sits about 1 cm below the points. Raising the intercept by 1.0 gives h = 24 βˆ’ 2.5t, the least-squares line. Residuals that are all of one sign are a pattern too, and they say which way to move the graph.

Worked fan pattern: A hypothetical delivery service is given the function T = 5 + 3d for the time in minutes of a delivery of d kilometers and checks it against eight deliveries: (2, 11.5), (4, 16), (6, 24.5), (8, 26), (10, 39), (12, 35), (14, 53), (16, 46). The predictions are 11, 17, 23, 29, 35, 41, 47 and 53 minutes, so the residuals are +0.5, βˆ’1, +1.5, βˆ’3, +4, βˆ’6, +6 and βˆ’7 minutes. The signs alternate, so there is no curve and a linear form is reasonable (the residuals add to βˆ’5 minutes, so the given function runs a little high on average). But the sizes grow steadily with distance, from about 1 minute for the shortest trips to 6 or 7 minutes for the longest: a fan. Informal assessment: the given function is a fair description of the average trend, its predictions are close for short deliveries, and for long deliveries it can be off by several minutes either way, so a promised arrival time for a 16 km delivery needs a wider margin than one for a 2 km delivery.

Section 3 Β· DoPractice, demonstrate, and explain

Represent and compare: For the seven stopping-distance pairs, make a table with five columns: speed, observed distance, the line's prediction, the line's residual, and the quadratic function's residual. Then draw two residual plots on the same scales, one for d = 0.7v βˆ’ 10.5 and one for d = 0.005vΒ² + 0.2v, each with a horizontal line at zero and the vertical axis running from βˆ’3 to 3 m. Under each plot write the sum of the residuals, the largest residual in size, and one sentence describing the pattern or the lack of one.

Independent performance: Use a data set of at least eight pairs of two quantitative variables, collected by you or supplied by your teacher, whose scatter plot shows a clear relationship. (1) Draw the scatter plot and describe how the variables are related. (2) Fit two functions from different families (for example a linear function and an exponential or quadratic function) with technology, and name the method. (3) Compute every residual for both functions, showing observed βˆ’ predicted for at least three points, and draw both residual plots. (4) Write an informal assessment of each fit that discusses the residuals: their signs and pattern, their largest and typical sizes with units, and whether those sizes are acceptable in the context. (5) State which function you would use to predict, give one prediction, and explain why the correlation coefficient or one small residual could not have settled the choice. Success means every residual has the correct sign, both plots have a zero line and labeled axes, the assessment names a pattern or says there is none and supports that with the signs, and the final choice rests on the residuals and the context together.

Section 4 Β· Check8-question lesson practice test

An adult may read the prompts aloud. Answer independently with words, objects, drawings or a demonstration before opening the answer guide. Award 1 point for a correct result or claim and 1 point for a matching explanation or demonstration; where a question asks only for a result (a corrected sentence, a spelling, a count), a fully correct result earns both points, and the answer guide shows what a complete response contains. Record prompting separately. The total (two points per question) is local practice feedback, not an Ohio proficiency level.

Problem 1

Define a residual, then compute the residuals of the line d = 0.7v βˆ’ 10.5 at 50 km/h and at 80 km/h and say what the sign of each one means.

Show worked solution

A residual is the observed value minus the value the function predicts: y βˆ’ f(x). At 50 km/h the line predicts 0.7 Γ— 50 βˆ’ 10.5 = 24.5 m and the observed distance is 21.9 m, so the residual is 21.9 βˆ’ 24.5 = βˆ’2.6 m; it is negative, so the point lies below the line and the line predicted too much. At 80 km/h the line predicts 56 βˆ’ 10.5 = 45.5 m and the observed distance is 47.6 m, so the residual is +2.1 m; it is positive, so the point lies above the line and the line predicted too little.

Problem 2

Describe how speed and stopping distance are related in the scatter plot of the seven pairs, and explain what the residual plot adds to that description.

Show worked solution

On the scatter plot the relationship is positive and strong: stopping distance increases with speed and the points follow one clear path. The form looks nearly linear, with a slight upward bend that is easy to overlook. The residual plot for the line removes the overall tilt and shows what is left: residuals of +2.3 and +0.6, then βˆ’1.7, βˆ’2.6 and βˆ’1.5, then +0.8 and +2.1 m. That U shape settles the form: the relationship is curved, with distance increasing faster at higher speeds, so it is described by a quadratic function rather than a linear one.

Problem 3

The residuals of the quadratic function d = 0.005vΒ² + 0.2v are βˆ’0.2, +0.6, βˆ’0.2, βˆ’0.6, 0.0, +0.8 and βˆ’0.4 m. Informally assess the fit of this function and compare it with the line.

Show worked solution

The signs are mixed from left to right with no curve, trend or widening, so there is no pattern. The largest residual is 0.8 m and four of the seven are under half a meter, small compared with stopping distances of 5.8 to 47.6 m. So the quadratic function fits these data well: it predicts each measured distance to within about a meter. The line's residuals reach 2.6 m and form a U-shaped pattern, and its sum of squared residuals is 22.60 against 1.60 for the quadratic function. The context supports the choice as well, since braking distance grows with the square of the speed.

Problem 4

A student adds the line's residuals, gets 0, and says the line fits the stopping data perfectly. What is wrong with this reasoning?

Show worked solution

The residuals of a least-squares line always add to zero, apart from rounding, whatever the data look like; the positive and negative residuals cancel by the way the line is computed. So a sum of zero is not evidence of a good fit. Here the residuals +2.3, +0.6, βˆ’1.7, βˆ’2.6, βˆ’1.5, +0.8 and +2.1 do add to 0, but individually they are as large as 2.6 m and they form a U-shaped pattern. A perfect fit would need every residual to be 0, not their sum.

Problem 5

At 30 km/h the line's residual is only +0.6 m. Explain why this does not show that the line is a good fit.

Show worked solution

Fit is judged from all the residuals together, not from one. At 30 km/h the quadratic function has exactly the same residual, +0.6 m, so that single point cannot tell a good function from a poor one. A straight line laid across curved data must be near the data close to the two places where it crosses the curve, here around 30 and 70 km/h, and far from it elsewhere: the line's residuals are +2.3 m at 20 km/h and βˆ’2.6 m at 50 km/h. The pattern across the whole plot is what shows the line is the wrong form.

Problem 6

For the stopping data the line has r = 0.992. A classmate says that a correlation this high means the linear function is the best model and that a higher r always means a better model. Evaluate both claims.

Show worked solution

Both claims are too strong. The correlation coefficient measures how closely the points follow a straight line, and 0.992 says a line accounts for most of the variation in stopping distance. It does not say that nothing systematic is left over: the residual plot shows a clear U shape, so a line is the wrong form, and the quadratic function reduces the largest residual from 2.6 m to 0.8 m. A value of r nearer to 1 or βˆ’1 means a tighter fit only for a straight-line model whose residual plot shows no pattern; r says nothing about whether a curved function would fit better, and it cannot be used to compare a line with a quadratic or an exponential function.

Problem 7

The bounce data have least-squares line h = βˆ’12n + 92 with residuals +8, βˆ’2, βˆ’4, βˆ’5, βˆ’4, +1, +6 cm, and exponential function h = 99.1(0.800)ⁿ with residuals +0.9, βˆ’1.3, +0.6, +0.3, βˆ’0.6, +0.5, 0.0 cm. Assess both fits, and explain why the second set of residuals does not add to zero.

Show worked solution

The line's residuals are positive at both ends and negative in the middle, a curved pattern, and are as large as 8 cm on heights of 26 to 100 cm, so the line is a poor fit; it even predicts a height of βˆ’4 cm at bounce 8. The exponential function's residuals have mixed signs with no pattern and are at most 1.3 cm, so it fits well. The line's residuals add to 0 because it is a least-squares line. The exponential function's residuals add to +0.4 (part of that is the rounding of its coefficients), and that is not a fault: the zero-sum property belongs to least-squares fits made directly on y for a family with an added constant term, and aΒ·bⁿ has no added constant term and was fitted on the logarithms of the heights, so a sum of zero is not expected.

Problem 8

A second hypothetical candle is checked against the given function h = 24 βˆ’ 2.5t. Its residuals at 0, 1, 2, 3, 4, 5, 6 and 7 hours are βˆ’0.2, +0.1, βˆ’0.3, +0.2, +3.4, βˆ’0.1, +0.2 and βˆ’0.3 cm. Informally assess the fit and say what should be done next.

Show worked solution

Seven of the eight residuals are small, between βˆ’0.3 and +0.2 cm, with mixed signs and no pattern, so the given function describes this candle well. The residual of +3.4 cm at 4 hours is more than ten times the size of the others: a possible outlier. The function predicts 24 βˆ’ 10 = 14.0 cm there, so the recorded height was 17.4 cm, which is also taller than the height at 3 hours, impossible for a burning candle. The next step is to check the record for a misreading or a typing error (14.4 may have been written as 17.4) and, if possible, measure again. The point is not ignored and not silently deleted; it is investigated and the decision is reported.