Lattice plot diagnostics for lm objects, mostly mimicking the behavior
of stats::plot.lm() but based on lattice::xyplot() instead.
# S3 method for lm
xyplot(
x,
data = NULL,
which = c(1:3, 5),
main = FALSE,
id.n = 3,
labels.id = names(residuals(x)),
cex.id = 0.75,
cook.levels = c(0.5, 1),
label.pos = c(4, 2),
layout = NULL,
...
)A list of trellis objects or a single trellis object.
Only provided for method consistency and is ignored.
if a subset of the plots is required, specify a subset of the
numbers 1:6
if TRUE plots default titles. Can also be a list or character
vector of length 6.
number of points to be labelled in each plot, starting with the most extreme.
vector of labels, from which the labels for extreme
points will be chosen. NULL uses observation numbers.
magnification of point labels.
levels of Cook's distance at which to draw contours.
positioning of labels, for the left half and right half of the graph respectively, for plots 1-3, 5, 6.
a numeric vector with [columns, rows] to use in the call
to gridExtra::grid.arrange(), or a layout matrix which will then be
passed as the layout_matrix in grid.arrange().
arguments to be passed to lattice::xyplot().
Original by John Maindonald and Martin Maechler. Adaptation to lattice by Johan Larsson.
fit <- lm(Sepal.Length ~ Sepal.Width, data = iris)
xyplot(fit)
xyplot(fit, which = 5)
Run the code above in your browser using DataLab