O'Reilly logo

R Statistical Application Development by Example Beginner's Guide by Prabhanjan Narayanachar Tattar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – residual plots for the multiple linear regression model

R functions resid, hatvalues, rstandard, and rstudent are available, which can be applied on an lm object to obtain the required residuals.

  1. Get the MSE of the regression model with gasoline_lm_mse <- gasoline_anova$Mean[length(gasoline_anova$Mean)].
  2. Extract the residuals with the resid function, and standardize the residuals using stan_resid_gasoline <- resid(gasoline_lm)/sqrt( gasoline_lm_mse).
  3. To obtain the semi-studentized residuals, we first need to get the hii elements which are obtainable using the hatvalues function: hatvalues(gasoline_lm). The remaining code is given at the end of this list.
  4. The PRESS residuals are calculated using the rstandard function available in ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required