levPlot: Create a Leverage (hat values) Plot

Description Usage Arguments See Also Examples

View source: R/levPlot.R

Description

Simple function to produce a plot of the hat values (leverage) after a model run in lm().

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
levPlot(
  obj,
  ylim = NULL,
  key.variable = NULL,
  print.obs = FALSE,
  print.plot = TRUE,
  sort.obs = TRUE,
  all.obs = FALSE,
  save.cutoff = FALSE,
  cut.level = 3
)

Arguments

obj

Object from an lm() fiitted equation.

ylim

Optional ylim for the plot.

key.variable

Required if lm() data object is of tibble class. Name of the unique key variable (identifier variable). If data object is of data.frame class, this is optional and row.names will be used instead.

print.obs

Logical: Should observations outside the specified sigma level be printed to the console?

print.plot

Logical: Should plot be created?

sort.obs

Logical: Should observations (if print.obs=TRUE) be sorted?

all.obs

Logical: Should all observations be printed?

save.cutoff

Logical: Should the used cutoff of the hat value be saved. The standard cut-offs (graphed) at 2 and 3 times the average hat value ((k+1) / n).

cut.level

Level to be used in *printing* the list of Leverage outliers. Defaults to 3 times the average hat value ((k+1) / n).

See Also

studResidPlot cooksPlot threeOuts

Examples

1
2
3
mod <- lm(hp ~ disp, data=mtcars)
summary(mod)
leveragePlot(mod)

MichaelJMahometa/SDSRegressionR documentation built on March 3, 2021, 10:51 p.m.