cooks_plot {api2lm} | R Documentation |
Index plot of Cook's distances for lm
object
Description
cooks_plot
plots the Cook's distances from
the cooks.distance
function of a fitted
lm
object.
Usage
cooks_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
|
id_n |
The number of points to identify with labels.
The default is |
add_reference |
A logical value indicating whether a reference line should be added. See details. |
... |
Additional arguments passed to the
|
text_arglist |
Additional arguments passed to the
|
abline_arglist |
A named list specifying additional
arguments passed to the |
extendrange_f |
Positive number(s) specifying the
fraction by which the range of the residuals should be
extended using the |
Details
By default, a reference line is plotted at the 0.5
quantile of a F_{p, n-p}
distribution
where p =
length(stats::coef(model))
and
n - p =
stats::df.residual(model)
.
The vertical position of the reference line can be customized
by setting the h
argument of abline_arglist
.
Author(s)
Joshua French
See Also
plot
,
text
,
abline
,
cooks.distance
Examples
lmod <- lm(price ~ sqft_living, data = home_sales)
cooks_plot(lmod, id_n = 1)