Plot Standard Residuals vs. Leverage with Cook's Distance Contours
Source:R/lm_plot.lev.R
lm_plot.lev.Rd
Creates a plot of standard residuals versus leverage values, including Cook's distance contours to visualize influential observations.
Usage
lm_plot.lev(
mdl,
opt = list(),
parm = list(),
df = lm_plot.df(mdl),
plts = list()
)
Arguments
- mdl
A fitted model object (typically from
lm
).- opt
List of options, where
cook.loess
(logical, default = FALSE) indicates whether to show loess curve for Cook's distances on the plot.- parm
List of plotting parameters, usually from
lm_plot.parms()
.- df
Data frame with augmented model data. Defaults to
lm_plot.df(mdl)
.- plts
List of ggplot objects to which this plot will be added.
Value
A list containing:
mdl
Fitted model object,opt
List of options, includingcook.loess
,parm
Parameter list for plotting, including Cook's distance contours,df
Data frame used for plotting,plts
List of ggplot objects, including the$lev
element.
Details
The plot displays standard residuals against leverage, overlays Cook's distance contours, and marks outliers based on residuals and Cook's distance. Outlier and influential points can be labeled, and a loess fit line is optionally added.