Learn R Programming

asympDiag (version 0.3.1)

plot_cook: Plot Cook's distances

Description

Plot Cook's distances

Usage

plot_cook(
  model,
  n_highlights = 0,
  cut = FALSE,
  xlab = "Index",
  ylab = "Cook's distance",
  ...
)

Value

An invisible object representing Cook's distance values.

Arguments

model

Model with cooks.distance() method

n_highlights

The number of observations with the highest Cook's distance to highlight on the plot. Defaults to 0 (no highlights).

cut

Logical. If TRUE, adds a cutoff line at the mean plus four times the standard deviation of Cook's distance. Defaults to FALSE.

xlab

The label for the x-axis. Defaults to "Index".

ylab

The label for the y-axis. Defaults to "Cook's distance".

...

Further arguments for graphics::plot()

See Also

Examples

Run this code
fit <- lm(mpg ~ cyl, data = mtcars)

plot_cook(fit)
plot_cook(fit, n_highlights = 2)

Run the code above in your browser using DataLab