A plot of residuals against fitted values, observed values or any variable.
plotResidual(object, ..., variable = NULL, points = TRUE, lines = FALSE, std.residuals = FALSE, nlabel = 0)
An object of class modelAudit or modelResiduals.
Other modelAudit objects to be plotted together.
Only for modelAudit object. Name of model variable to order residuals. If value is NULL data order is taken. If value is "Predicted response" or "Fitted values" then data is ordered by fitted values. If value is "Observed response" the data is ordered by a vector of actual response (
Logical, indicates whenever observations should be added as points.
Logical, indicates whenever smoothed lines should be added.
Logical, indicates whenever standardized residuals should be used.
Number of observations with the biggest Cook's distances to be labeled.
library(car) lm_model <- lm(prestige~education + women + income, data = Prestige) lm_au <- audit(lm_model, data = Prestige, y = Prestige$prestige) plotResidual(lm_au)library(randomForest) rf_model <- randomForest(prestige~education + women + income, data = Prestige) rf_au <- audit(rf_model, data = Prestige, y = Prestige$prestige) plotResidual(lm_au, rf_au)