An R Introduction to Statistics

Standardized Residual

The standardized residual is the residual divided by its standard deviation.

Standardized Residual =----------Residual-----------
                       Standard Deviation of Residual

Problem

Plot the standardized residual of the simple linear regression model of the data set faithful against the independent variable waiting.

Solution

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.

> eruption.lm = lm(eruptions ~ waiting, data=faithful) 
> eruption.stdres = rstandard(eruption.lm)

We now plot the standardized residual against the observed values of the variable waiting.

> plot(faithful$waiting, eruption.stdres, 
+     ylab="Standardized Residuals", 
+     xlab="Waiting Time", 
+     main="Old Faithful Eruptions") 
> abline(0, 0)                  # the horizon

PIC

Note

Further detail of the rstandard function can be found in the R documentation.

> help(rstandard)