Turning a Residual List Into a Plot
In “Computing Residuals on the TI-84,” you used LinReg to create a list of residuals in the same order as the paired observations. A residual plot uses those values as one coordinate of a graph. Making the plot correctly depends on keeping each residual paired with the right observation and labeling both axes.
The most common version plots residuals against the predictor \(x\). You can also plot residuals against the predicted response, \(\hat{y}\). Both choices use the same residuals; only the horizontal coordinate changes. A residual plot is not the original scatterplot: the vertical coordinate is a residual, not an observed response.
Residuals are measured in the response variable’s units, so the vertical axis must be labeled with those units. If the horizontal axis is \(x\), use the predictor’s units; if it is \(\hat{y}\), use the response’s units. Mark \(0\) on the vertical axis and draw a horizontal reference line there. This line represents observations whose responses equal their predictions.
Constructing a Residual Plot by Hand
To draw a plot by hand, first prepare a table with each observation’s \(x\), \(y\), fitted value \(\hat{y}\), and residual \(y-\hat{y}\). The fitted value is needed to calculate or check the residual, and it is the horizontal coordinate if you choose to plot against predicted values. Then select a horizontal and vertical scale that includes all the points, draw the zero line, and plot one point per observation. Do not connect the points.
Use the predictor values \(x\), or calculate the fitted values \(\hat{y}\) if you are plotting against predictions.
For each row, match its chosen horizontal value with its residual. A residual from one row must not be paired with an \(x\)-value or fitted value from another.
Label the horizontal axis with the chosen variable and units, and the vertical axis “Residual” with the response units. Make sure the vertical scale includes zero and every residual.
Draw the horizontal zero line, plot each coordinate pair, and leave the points unconnected.
A least-squares regression line with an intercept has residuals that sum to zero, as covered in “Why Residuals Sum to Zero.” That fact can help check your table, but a zero sum alone does not verify that every residual was paired with the correct horizontal value.
Worked Example: Drawing a Residual Plot by Hand
A fictional greenhouse team records the afternoon temperature, \(x\), in degrees Celsius and the amount of water used by a test bed, \(y\), in liters. The observations are \((1,12)\), \((2,15)\), \((3,17)\), \((4,20)\), and \((5,21)\). Construct a residual plot against temperature.
State. Temperature is the predictor, and water use is the response. The requested plot has temperature on the horizontal axis and residuals, in liters, on the vertical axis.
Plan. Find the least-squares line, calculate each prediction and residual using \(y-\hat{y}\), then plot the five \((x,\text{residual})\) pairs. The regression equation and residual calculations follow the methods in “Computing a Least-Squares Line From Raw Data” and “Calculating a Residual by Hand.”
Do. The means are \(\bar{x}=3\) degrees and \(\bar{y}=17\) liters. The centered \(x\)-values are \(-2,-1,0,1,2\), and the centered \(y\)-values are \(-5,-2,0,3,4\). Their cross-products sum to \(10+2+0+3+8=23\); the squared centered \(x\)-values sum to \(4+1+0+1+4=10\). Therefore, \(b=23/10=2.3\) liters per degree, and \(a=17-2.3(3)=10.1\) liters. The fitted line is \(\hat{y}=10.1+2.3x\).
Calculate the prediction and residual for each row:
| \(x\) (°C) | \(y\) (liters) | \(\hat{y}=10.1+2.3x\) (liters) | \(y-\hat{y}\) (liters) | Plotting pair \((x,\text{residual})\) |
|---|---|---|---|---|
| 1 | 12 | 12.4 | −0.4 | (1, −0.4) |
| 2 | 15 | 14.7 | +0.3 | (2, 0.3) |
| 3 | 17 | 17.0 | 0.0 | (3, 0.0) |
| 4 | 20 | 19.3 | +0.7 | (4, 0.7) |
| 5 | 21 | 21.6 | −0.6 | (5, −0.6) |
For example, at \(x=1\), the prediction is \(10.1+2.3(1)=12.4\) liters and the residual is \(12-12.4=-0.4\) liter. Plot the five pairs in the last column, with temperature from 1 to 5 degrees on the horizontal axis and residuals from about \(-0.6\) to \(0.7\) liter on the vertical axis. Draw the zero line through the point for the third observation. The residuals sum to \(-0.4+0.3+0+0.7-0.6=0\) liters, as expected.
Conclude. The residual plot consists of those five coordinate pairs, not the original temperature-and-water-use pairs. Its vertical values show each observed water use minus its predicted water use.
Creating a Residual Plot With TI-84 STAT PLOT
After running LinReg with the predictor list first and the response list second, the TI-84 stores the corresponding residuals in RESID. To plot residuals against \(x\), set the STAT PLOT horizontal list to the predictor list and the vertical list to RESID. Keep the original data lists intact so the calculator can match each residual to the correct \(x\)-value.
Enter paired data in matching list positions and run LinReg(a+bx) using the predictor list as Xlist and the response list as Ylist. If you plan to plot against fitted values, store the regression equation in \(Y1\).
Press 2nd, then Y=, to open STAT PLOT. Select Plot1 and turn it On. Choose the scatterplot type.
For a plot against \(x\), set Xlist to the predictor list, such as \(L1\), and Ylist to RESID. Select an appropriate plotting mark.
Press ZOOM and choose ZoomStat to set a window based on the plotted data. Check that the vertical axis includes zero; adjust the window if needed so the zero reference line is visible.
The exact appearance of menus may vary slightly across TI-84 models. RESID is available after a regression calculation; it is selected from the list names menu. If the plot appears empty or mismatched, check that Plot1 is On, the lists are selected correctly, and the regression was run using the current data.
Worked Example: Setting Up STAT PLOT for Residuals Versus \(x\)
A fictional electronics club measures the hours a small sensor operates before a recharge, \(x\), and the number of alerts it records, \(y\). The data are \((2,31)\), \((4,38)\), \((6,40)\), \((8,49)\), and \((10,52)\). Describe how to create the TI-84 plot of residuals against operating hours and verify the plotted coordinates.
State. Operating hours are the predictor, and alert count is the response. The horizontal axis will use \(x\) in hours; the vertical axis will use residuals in alerts.
Plan. Enter \(2,4,6,8,10\) in \(L1\) and \(31,38,40,49,52\) in \(L2\). Run LinReg(a+bx) with \(L1\) as Xlist and \(L2\) as Ylist, then set STAT PLOT to Xlist \(L1\), Ylist RESID. Check the calculator’s points against hand calculations.
Do. Here, \(\bar{x}=6\) hours and \(\bar{y}=42\) alerts. The centered \(x\)-values are \(-4,-2,0,2,4\), and the centered \(y\)-values are \(-11,-4,-2,7,10\). The cross-products sum to \(44+8+0+14+40=106\), while the squared centered \(x\)-values sum to \(16+4+0+4+16=40\). Thus \(b=106/40=2.65\) alerts per hour and \(a=42-2.65(6)=26.1\) alerts. The fitted line is \(\hat{y}=26.1+2.65x\).
After the regression, open STAT PLOT, turn Plot1 On, choose the scatterplot type, and set Xlist to \(L1\) and Ylist to RESID. Use ZoomStat, then check the axis labels and make sure zero is visible. The predictions and coordinates are:
| \(x\) (hours) | \(y\) (alerts) | \(\hat{y}\) (alerts) | Residual (alerts) | Plotting pair |
|---|---|---|---|---|
| 2 | 31 | 31.4 | −0.4 | (2, −0.4) |
| 4 | 38 | 36.7 | +1.3 | (4, 1.3) |
| 6 | 40 | 42.0 | −2.0 | (6, −2.0) |
| 8 | 49 | 47.3 | +1.7 | (8, 1.7) |
| 10 | 52 | 52.6 | −0.6 | (10, −0.6) |
For the fourth observation, for instance, \(49-(26.1+2.65(8))=49-47.3=1.7\) alerts. Its plotted point is \((8,1.7)\). The calculator should display the same five pairs, allowing for its displayed rounding. Their residuals sum to \(-0.4+1.3-2.0+1.7-0.6=0\) alerts.
Conclude. With Xlist \(L1\) and Ylist RESID, each plotted point places an observation’s residual above or below its operating-hours value. Selecting the response list \(L2\) as Ylist instead would show the original data scatterplot, not the residual plot.
Plotting Residuals Against Predicted Values
A second valid horizontal coordinate is the fitted value \(\hat{y}\). To make this plot by hand, use each row’s prediction from the regression line and pair it with that row’s residual. On a TI-84, you can create a list of fitted values by evaluating the stored equation \(Y1\) at the predictor list. For example, enter \(Y1(L1)\) into an unused list column such as \(L3\). Then set STAT PLOT’s Xlist to \(L3\) and Ylist to RESID.
Do not confuse the two horizontal variables: \(x\) is the observed predictor, while \(\hat{y}\) is the model’s predicted response. Their units may differ. When the slope is positive, the two plots preserve the observations’ horizontal order; when the slope is negative, the order is reversed. The horizontal spacing and units may also differ. If the slope is zero, all fitted values are the same, so a plot against \(\hat{y}\) has no horizontal spread.
Worked Example: Changing the Horizontal Coordinate to \(\hat{y}\)
A fictional recreation center records the number of visitors entering a climbing area, \(x\), and the number of minutes a route remains occupied, \(y\). The observations are \((1,24)\), \((2,19)\), \((3,18)\), \((4,12)\), and \((5,12)\). Construct the coordinate pairs for a residual plot against predicted minutes, and explain how the ordering compares with a plot against \(x\).
State. Visitors are the predictor and occupied minutes are the response. The requested plot uses predicted occupied minutes on the horizontal axis and residual minutes on the vertical axis.
Plan. Find the least-squares line, then calculate each fitted value and residual. Pair each \(\hat{y}\) with the residual from the same observation. Compare the order of fitted values with the order of \(x\)-values.
Do. The means are \(\bar{x}=3\) visitors and \(\bar{y}=17\) minutes. The centered \(x\)-values are \(-2,-1,0,1,2\); the centered \(y\)-values are \(7,2,1,-5,-5\). The cross-products sum to \(-14-2+0-5-10=-31\), and the squared centered \(x\)-values sum to \(10\). Therefore, \(b=-31/10=-3.1\) minutes per visitor and \(a=17-(-3.1)(3)=26.3\) minutes. The line is \(\hat{y}=26.3-3.1x\).
| \(x\) (visitors) | \(y\) (minutes) | \(\hat{y}=26.3-3.1x\) (minutes) | Residual (minutes) | Plotting pair \((\hat{y},\text{residual})\) |
|---|---|---|---|---|
| 1 | 24 | 23.2 | +0.8 | (23.2, 0.8) |
| 2 | 19 | 20.1 | −1.1 | (20.1, −1.1) |
| 3 | 18 | 17.0 | +1.0 | (17.0, 1.0) |
| 4 | 12 | 13.9 | −1.9 | (13.9, −1.9) |
| 5 | 12 | 10.8 | +1.2 | (10.8, 1.2) |
For example, the first fitted value is \(26.3-3.1(1)=23.2\) minutes and its residual is \(24-23.2=0.8\) minute. The coordinate for that observation is \((23.2,0.8)\), not \((1,0.8)\), because the horizontal axis is predicted minutes. Since the slope is negative, fitted values decrease as \(x\) increases: the order from \(x=1\) to \(x=5\) is reversed along the fitted-value axis. For a calculator plot, store the equation in \(Y1\), create \(L3=Y1(L1)\), and use Xlist \(L3\), Ylist RESID. The residuals sum to \(0.8-1.1+1.0-1.9+1.2=0\) minutes.
Conclude. Plotting against fitted values changes the horizontal coordinates but not the residuals. Keep each \(\hat{y}\) paired with its own residual, and account for the negative slope when comparing horizontal order.
Common Mistakes and AP Exam Tips
- Using observed responses as vertical values. That creates the original scatterplot. A residual plot uses \(y-\hat{y}\) on the vertical axis.
- Reversing the residual subtraction. Use observed minus predicted, \(y-\hat{y}\), as in “Defining a Residual as Observed Minus Predicted.” This preserves the sign and places positive residuals above zero.
- Mixing up rows. A plotted point must combine an observation’s residual with that same observation’s \(x\) or \(\hat{y}\). Preserve list order when using RESID.
- Leaving out the zero line or axis labels. Mark residual \(0\) and label the axes with variables and units. The horizontal-axis units depend on whether you chose \(x\) or \(\hat{y}\).
- Assuming fitted values always follow \(x\) in the same order. A positive slope preserves order, but a negative slope reverses it. With a zero slope, fitted values do not vary.
- Forgetting that calculator lists can become outdated. If you change the data or rerun a different regression, run LinReg again before relying on RESID. Check that STAT PLOT points to the intended lists.
- Connecting the points. Each point represents one observation. A residual plot is a scatterplot of those points, not a line graph joining consecutive observations.
For a complete AP response, name the horizontal variable, state that residuals are on the vertical axis, and explain how you matched the points. If asked to construct a plot, include a zero reference line and clear labels. If using predicted values, identify them as \(\hat{y}\), not as the observed response \(y\).
Check Your Understanding
For each question, focus on the coordinate pair used to construct the plot.
- In a residual plot against \(x\), which variable belongs on the vertical axis?
- An observation has \(x=7\), \(y=15\), and \(\hat{y}=17\). What is its residual, and what coordinate is plotted against \(x\)?
- For a residual plot against predicted values, what horizontal coordinate should be paired with that observation’s residual?
- If the fitted line has a negative slope, as \(x\) increases, what happens to the order of the fitted values?
- What should you check if a TI-84 plot does not show the intended residuals?