gplot.lm: gplot diagnostics for an lm object

Description Usage Arguments

View source: R/gplots.R

Description

Six plots (selectable by which) are currently available: a plot of residuals against fitted values, a Scale-Location plot of sqrt(| residuals |) against fitted values, a Normal Q-Q plot, a plot of Cook's distances versus row labels, a plot of residuals against leverages, and a plot of Cook's distances against leverage/(1-leverage). By default, the first three and 5 are provided.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## S3 method for class 'lm'
gplot(x, which = c(1L:3L, 5L), grid = TRUE,
  col.grid = "grey90", col.acc = "white",
  caption = list("Residuals vs Fitted", "Normal Q-Q", "Scale-Location",
  "Cook's distance", "Residuals vs Leverage",
  expression("Cook's dist vs Leverage  " * h[ii]/(1 - h[ii]))), panel = if
  (add.smooth) panel.smooth else points, sub.caption = NULL, main = "",
  ask = prod(par("mfcol")) < length(which) && dev.interactive(), ...,
  id.n = 3, labels.id = names(residuals(x)), cex.id = 0.75,
  qqline = TRUE, cook.levels = c(0.5, 1),
  add.smooth = getOption("add.smooth"), label.pos = c(4, 2),
  cex.caption = 1)

Arguments

x

lm object, typically result of lm or glm.

which

if a subset of the plots is required, specify a subset of the numbers 1:6, see caption below (and the ‘Details’) for the different kinds.

grid

logical; if TRUE, a background grid will be drawn

col.grid

grid color

col.acc

grid accent color

caption

captions to appear above the plots; character vector or list of valid graphics annotations, see as.graphicsAnnot, of length 6, the j-th entry corresponding to which[j]. Can be set to "" or NA to suppress all captions.

panel

panel function. The useful alternative to points, panel.smooth can be chosen by add.smooth = TRUE.

sub.caption

common title—above the figures if there are more than one; used as sub (s.title) otherwise. If NULL, as by default, a possible abbreviated version of deparse(x$call) is used.

main

title to each plot—in addition to caption.

ask

logical; if TRUE, the user is asked before each plot, see par(ask=.).

...

other parameters to be passed through to plotting functions.

id.n

number of points to be labelled in each plot, starting with the most extreme.

labels.id

vector of labels, from which the labels for extreme points will be chosen. NULL uses observation numbers.

cex.id

magnification of point labels.

qqline

logical indicating if a qqline() should be added to the normal Q-Q plot.

cook.levels

levels of Cook's distance at which to draw contours.

add.smooth

logical indicating if a smoother should be added to most plots; see also panel above.

label.pos

positioning of labels, for the left half and right half of the graph respectively, for plots 1-3.

cex.caption

controls the size of caption.


raredd/plotr documentation built on Nov. 19, 2018, 11:02 a.m.