Residuals and residual plots

残差与残差图

What are residuals and residual plots?

A residual is the observed value minus the predicted one; plotting residuals against the explanatory variable shows whether a line fits.

SkillKP000944

Sign in to read the whole lesson, with 9 exercises

Sign in / Sign up

Mastery goals

  • Can compute and interpret residuals
  • Can use a residual plot to judge whether a linear model is appropriate

For the response variable , the data obtained by observation are called observed values; the obtained from the empirical regression equation are called predicted values; and the difference obtained by subtracting the predicted value from the observed value is called the residual. A residual is an estimate of the random error. By analyzing the residuals we can judge how well the model describes the data, whether there are suspicious data in the original data, and so on; this kind of work is called residual analysis.

Take the 6th observation in Table 8.2-1. The father's height is cm and the observed value of the son's height is

the predicted value is

and the residual is

The other residuals are found in the same way; they are listed in Table 8.2-2.

Table 8.2-2

No.Father's height/cmSon's height, observed/cmSon's height, predicted/cmResidual/cm

To make the data easier to see, take the father's height as the horizontal coordinate and the residual as the vertical coordinate and draw a residual plot, as in Figure 8.2-7.

-6-4-20246160165170175180185residual/cmfather's height/cm
Figure 8.2-7: residual plot. The horizontal coordinate is the father's height and the vertical coordinate is the corresponding residual.

Table 8.2-2 shows that the residuals are sometimes positive and sometimes negative, and the largest absolute value of a residual is . The scatter of the residuals shows that they are spread fairly evenly on both sides of the horizontal axis. This means the residuals fit the assumptions of the simple linear regression model fairly well: they look like observed values of a random variable with mean and variance . So by looking at a residual plot we can judge directly whether the model meets the assumptions of the simple linear regression model.

In general, after an empirical regression equation has been set up, we usually need to analyze how well the model describes the data. Residual analysis can also be used to improve the model, so that we can make predictions and decisions that fit reality better from the improved model.

By the assumptions on the random error in the simple linear regression model, the residuals should be observed values of a random variable with mean and variance . In Figure 8.2-8, plot (1) shows that the residuals have a linear relationship with the observation time, so the time variable should be put into the model; plot (2) shows that the residuals have a nonlinear relationship with the observation time, so a nonlinear function of time should be added to the model; plot (3) shows that the variance of the residuals is not a constant but grows as the observation time grows; in plot (4) the residuals are spread fairly evenly within a horizontal band symmetric about the horizontal axis where the value is . So in Figure 8.2-8 only plot (4) satisfies the assumptions of the simple linear regression model on the random error.

Example Experience shows that, in general, the larger a tree's diameter at breast height (DBH, the diameter of the trunk m above the ground), the taller the tree. Since a tree's height is harder to measure than its DBH, researchers want to predict height from DBH. To study the relationship between tree height and DBH, a forest farm collected some data on one kind of tree (Table 8.2-3). Use these data to set up an empirical regression equation of tree height on DBH.

Table 8.2-3

No.
DBH/cm
Height/m
No.
DBH/cm
Height/m

Analysis: Height is to be predicted from DBH, so draw a scatter plot with DBH as the horizontal coordinate and height as the vertical coordinate, and then decide from the scatter plot whether height and DBH are linearly correlated. If they are, compute and with formula (2).

Solution: Draw the scatter plot with DBH as the horizontal coordinate and height as the vertical coordinate; this gives Figure 8.2-9.

16182022242615202530354045tree height/mDBH/cm
Figure 8.2-9: scatter plot of tree height against DBH.

In Figure 8.2-9 the points lie roughly near a straight line running from the lower left to the upper right, which shows that the two variables are linearly correlated, and positively correlated, so the simple linear regression model can be used to describe the relationship between tree height and DBH.

Let be the DBH and the height. By the method of least squares, the empirical regression equation is

and the corresponding empirical regression line is shown in Figure 8.2-10.

16182022242615202530354045tree height/mDBH/cm
Figure 8.2-10: the empirical regression line .

From the empirical regression equation and the DBH data in Table 8.2-3, we can compute the predicted heights (to ) and the corresponding residuals, as in Table 8.2-4.

Table 8.2-4

No.DBH/cmHeight, observed/mHeight, predicted/mResidual/m

With DBH as the horizontal coordinate and the residual as the vertical coordinate, the residual plot is Figure 8.2-11.

-1-0.500.511.515202530354045residual/mDBH/cm
Figure 8.2-11: residual plot of tree height.

The residual table and the residual plot show that the largest absolute value of a residual is , and all the residuals lie in a band symmetric about the horizontal axis whose width is less than . So the empirical regression equation describes the relationship between tree height and DBH well, and we can use it to predict a tree's height from its DBH.

Related points

All points in this topic

Cite this page: Residuals and residual plots · KnowledgeTree (知识树), https://www.knowledgetree.world/en/kp/KP000944