Plot the residual of the simple linear regression model of the data set faithful against the independent variable waiting.
We apply the lm function to a formula that describes the variable eruptions by the variable waiting, and save the linear regression model in a new variable eruption.lm. Then we compute the residual with the resid function.
We now plot the residual against the observed values of the variable waiting.
+ ylab="Residuals", xlab="Waiting Time",
+ main="Old Faithful Eruptions")
> abline(0, 0) # the horizon
Further detail of the resid function can be found in the R documentation.