dffits_plot {api2lm}R Documentation

Index plot of DFFITS values for lm object

Description

dffits_plot plots the DFFITS values from the dffits function of a fitted lm object.

Usage

dffits_plot(
  model,
  id_n = 3,
  add_reference = TRUE,
  ...,
  text_arglist = list(),
  abline_arglist = list(),
  extendrange_f = 0.08
)

Arguments

model

A fitted model object from the lm function.

id_n

The number of points to identify with labels. The default is 3.

add_reference

A logical value indicating whether a reference line should be added. The default is TRUE. See Details.

...

Additional arguments passed to the plot function.

text_arglist

Additional arguments passed to the text function, which is used to display the points that are identified.

abline_arglist

A named list specifying additional arguments passed to the abline function for the horizontal reference line added to the plot.

extendrange_f

Positive number(s) specifying the fraction by which the range of the residuals should be extended using the extendrange function. If longer than one, f[1] is used on the left and f[2] on the right.

Details

By default, a reference line is plotted at \pm 2\sqrt{p/n}, where p = length(stats::coef(model)) and n = stats::nobs(model). This can be customized by setting the h argument of abline_arglist.

Author(s)

Joshua French

See Also

plot, text, abline, dffits

Examples

lmod <- lm(price ~ sqft_living, data = home_sales)
dffits_plot(lmod, id_n = 6)
# customized plot
dffits_plot(lmod, id_n = 1,
            text_arglist = list(col = "blue", cex = 2),
            abline_arglist = list(col = "red", lwd = 2))

[Package api2lm version 0.2 Index]