Plot the standardized 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 standardized residual with the rstandard function.
We now plot the standardized residual against the observed values of the variable waiting.
+ ylab="Standardized Residuals",
+ xlab="Waiting Time",
+ main="Old Faithful Eruptions")
> abline(0, 0) # the horizon
Further detail of the rstandard function can be found in the R documentation.