Residual versus Fitted Plot
This type of plot is between the fitted values and the residual (difference between actual and fitted values) from the lm() method. If the predictor and target variables have a non-linear relationship, the plot will help us identify.
In the following figure, the top plot shows the point scattered all around and the linear relationship between the predictor and target variable is clearly captured. In the bottom plot, the unexplained non-linear relationship is left out in the residuals, and hence the curve. The bottom plot clearly shows it is not the right fit for a linear regression model, a violation of the linear relationship between the predictor and target variable:
![](https://static.packt-cdn.com/products/9781838556334/graphics/C12624_04_04.jpg)
Figure 4.4: [Top] Residual versus fitted plot of the linear function. [Bottom] Residual versus fitted plot of the quadratic function