Usage
### This is a generic function with only one required argument:
residualPlots (model, ...)
## S3 method for class 'default':
residualPlots(model, terms = ~., layout = NULL, ask,
main = "", fitted = TRUE, AsIs=TRUE, plot = TRUE,
tests = TRUE, ...)
## S3 method for class 'lm':
residualPlots(model, ...)
## S3 method for class 'glm':
residualPlots(model, ...)
### residualPlots calls residualPlot, so these arguments can be
### used with either function
residualPlot(model, ...)
## S3 method for class 'default':
residualPlot(model, variable = "fitted", type = "pearson",
plot = TRUE,
quadratic = TRUE,
smoother=NULL, smoother.args=list(),
col.smooth=palette()[3],
labels,
id.method = "y",
id.n = if(id.method[1]=="identify") Inf else 0,
id.cex=1, id.col=palette()[1],
col = palette()[1], col.quad = palette()[2],
xlab, ylab, lwd = 1, lty = 1,
grid=TRUE, ...)
## S3 method for class 'lm':
residualPlot(model, ...)
## S3 method for class 'glm':
residualPlot(model, variable = "fitted", type = "pearson",
plot = TRUE, quadratic = FALSE,
smoother = loessLine, smoother.args=list(k=3), ...)
Arguments
model
A regression object.
terms
A one-sided formula that specifies a subset of the predictors. One
residual plot is drawn for each specified. The default
~ .
is to plot against all predictors. For example, the
specification terms = ~ . - X3
would plot agai
layout
If set to a value like c(1, 1)
or c(4, 3)
, the layout
of the graph will have this many rows and columns. If not set, the program
will select an appropriate layout. If the number of graphs exceed nine, you
must select the la
ask
If TRUE
, ask the user before drawing the next plot; if FALSE
, don't
ask.
main
Main title for the graphs. The default is main=""
for no title.
fitted
If TRUE
, the default, include the plot against fitted values.
AsIs
If FALSE
, terms that use the as-is function I
are skipped; if TRUE
, the default, they are included.
plot
If TRUE
, draw the plot(s).
tests
If TRUE
, display the curvature tests.
...
Additional arguments passed to residualPlot
and then to
plot
.
variable
Quoted variable name for the horizontal axis, or
"fitted"
to plot versus fitted values.
type
Type of residuals to be used. Pearson residuals are
appropriate for lm
objects since these are equivalent to ordinary residuals
with ols and correctly weighted residuals with wls. Any quoted string that
is an appropriate value of the
quadratic
if TRUE
, fits the quadratic regression of the
vertical axis on the horizontal axis and displays a lack of fit test. Default
is TRUE
for lm
and
FALSE for glm
.
smoother
the name of the smoother to use, selected from the choices
descripbed at ScatterplotSmoothers
For lm
objects the
default is NULL
. For glm
object the smoother.args
arguments passed to the smoother.
See ScatterplotSmoothers
. For generalized linear models the
number of elements in the spline basis is set to
k=3
; this is done to allow fi col.smooth
color for the smoother
id.method,labels,id.n,id.cex,id.col
Arguments for the labelling of
points. The default is id.n=0
for labeling no points. See
showLabels
for details of these arguments. col
default color for points
col.quad
default color for quadratic fit
xlab
X-axis label. If not specified, a useful label is constructed by
the function.
ylab
Y-axis label. If not specified, a useful label is constructed by
the function.
lty
line type for quadratic.
grid
If TRUE, the default, a light-gray background grid is put on the
graph