lm
objectoutlier_plot
plots the studentized residuals (from
the rstudent
function) of a fitted
lm
object.
outlier_plot(
model,
id_n = 3,
add_reference = TRUE,
alpha = 0.05,
...,
text_arglist = list(),
abline_arglist = list(),
extendrange_f = 0.08
)
A fitted model object from the
lm
function.
The number of points to identify with labels.
The default is 3
.
A logical value indicating whether a
reference line should be added. The default is
TRUE
. See Details.
The default lower quantile used for the reference line prior to the Bonferroni adjustment. The default is 0.05.
Additional arguments passed to the
plot
function.
Additional arguments passed to the
text
function, which is used to
display the points that are identified.
A named list specifying additional
arguments passed to the abline
function for the horizontal reference line added to the
plot.
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.
Joshua French
If add_reference = TRUE
, then reference lines are
provided for the \(\alpha/(2n\) and \(1-\alpha/(2n)\)
quantiles of a Student's \(t\) distribution with
(df.residual(lmod) - 1
) degrees of freedom, which
are the standard quantiles used to identify outliers for
a fitted model.
The vertical position of the reference line can be
customized by setting the h
argument of
abline_arglist
.
lmod <- lm(price ~ sqft_living, data = home_sales)
outlier_plot(lmod, id_n = 1)
Run the code above in your browser using DataLab