gg_cooksd: Plot cook's distance graph

View source: R/gg_cooksd.R

gg_cooksdR Documentation

Plot cook's distance graph

Description

Plot cook's distance graph

Usage

gg_cooksd(
  fitted.lm,
  label = TRUE,
  show.threshold = TRUE,
  threshold = "convention",
  scale.factor = 0.5
)

Arguments

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.

Value

A ggplot object that contains a cook's distance plot

Examples

library(MASS)
data(Cars93)
cars_lm <- lm(Price ~ Passengers + Length + RPM, data = Cars93)
gg_cooksd(cars_lm)


lindia documentation built on Aug. 11, 2023, 1:09 a.m.

Related to gg_cooksd in lindia...