gg_cooksd | R Documentation |
Plot cook's distance graph
gg_cooksd(
fitted.lm,
label = TRUE,
show.threshold = TRUE,
threshold = "convention",
scale.factor = 0.5
)
fitted.lm |
a fitted linear model (i.e. lm, glm) that contains fitted regression |
label |
logical; whether or not to label observation number larger than threshold. Default to TRUE. |
show.threshold |
logical; determine whether or not threshold line is to be shown. Default to TRUE. |
threshold |
string; determining the cut off label of cook's distance. Choices are "baseR" (0.5 and 1), "matlab" (mean(cooksd)*3), and "convention" (4/n and 1). Default to "convention". |
scale.factor |
numeric; scales the point size and linewidth to allow customized viewing. Defaults to 0.5. |
A ggplot object that contains a cook's distance plot
library(MASS)
data(Cars93)
cars_lm <- lm(Price ~ Passengers + Length + RPM, data = Cars93)
gg_cooksd(cars_lm)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.