See the plotres
} vignette.
plotres(object = stop("no 'object' argument"),
which = 1:4, info = FALSE, versus = 1,
standardize = FALSE, delever = FALSE, level = 0,
id.n = 3, labels.id = NULL, smooth.col = 2,
grid.col = 0, jitter = 0,
do.par = NULL, caption = NULL, trace = 0,
npoints = 3000, center = TRUE,
type = NULL, nresponse = NA,
object.name = quote.deparse(substitute(object)), ...)
1:4
.1
Model plot. What gets plotted here depends on the model class.
For example, for earth
models this is a model selection plot.
Nothing will be displayed for some models.
For d
FALSE
.
Use TRUE
to print extra information as follows:
i) Display the distribution of the residuals along the bottom of the plot.ii) Display the training R-Squared.
iii) Display the Spearman Rank Correlation of the
1
Default. Plot the residuals versus the fitted values
(or the log values when which=7
to 9
).
2
Residuals versus observation number,
after observations h
FALSE
.
Use TRUE
to standardize the residuals.
Only supported for some models, an error message will be issued otherwise.
Each residual is divided by by se_i * sqrt(1 - h_ii)
,
where se_i
is thFALSE
.
Use TRUE
to sqrt(1 - h_ii)
.
See the standardize
level
, if the model supports them.
Default is 0
, bands not plotted.
Else a fraction, for example level=0.90
.
Example:mod <- lm(log(Volume)~log(Girtid.n
residuals will be labeled in the plot.
Default is 3
.
Special values TRUE
and -1
or mean all.
If id.n
is negative (but not -1
)
the id.n
most positivid.n > 0
.
Default is the case names, or the case numbers if the cases are unnamed.2
, red. Use smooth.col=0
for no smooth line.
You can adjust the amount of smoothing with smooth.f
.
This gets passed as f
to
0
, no grid.
Else add a background grid
of the specified color to the degree1 plots.
The special value grid.col=TRUE
is treated as "lightgray"
.0
, no jitter.
Passed as factor
to jitter
to jitter the plotted points horizontally and vertically.
Useful for discrete variables and responses, where the residual poiNULL
, FALSE
, TRUE
, or 2
, as follows:do.par=NULL
(default). Same as do.par=FALSE
if the
number of plots is one; else the same as TRUE
.
do.par=FALSE
caption=""
for no caption.
(Use main
to set the title of an individual plot.)0
.
trace=1
(or TRUE
) for a summary trace (shows how
predict
and friends
are invoked for the model).
trace=2
for detailed tracing.npoints
is taken;
the sample includes the biggest twenty or so residuals.
The default is 3000 (not all, to avoid overplotting on large models).
Use npoints=TRUE
or -1
for residuals
or predict
returns
multiple columns.
This can be a column index or column name
(which may be abbreviated, partial matching is used).object
for error and trace messages.
Used internally by plot.earth
.plotres
} vignette.# we use lm in this example, but plotres is more useful for models
# that don't have a function like plot.lm for plotting residuals
lm.model <- lm(Volume~., data=trees)
plotres(lm.model)
Run the code above in your browser using DataLab