earth
object.
The plot shows model selection, cumulative distribution
of the residuals, residuals versus fitted values, and the residual QQ plot.## S3 method for class 'earth':
plot(x = stop("no 'x' arg"), which = 1:4,
info = FALSE, delever = FALSE, pearson = FALSE, level = 0, versus = NULL,
nresponse = 1, npoints = 1000, id.n = 3,
labels.id = rownames(residuals(object, warn=FALSE)),
center = TRUE, loess.f = .5,
do.par = length(which) > 1, xlim = NULL, ylim = NULL,
main = NULL, cex.main = 1.2, caption = if(do.par) NULL else "",
xlab = NULL, ylab = NULL,
pch = 20, col.line = "lightblue",
col.loess = NULL, lwd.loess = NULL, col.cv = "red",
col.qq = col.line, col.grid = "lightgray", col.points = 1, cex.points = NULL,
shade.pints = "mistyrose2", shade.cints = "mistyrose4",
cum.grid = "percentages",
col.rsq = NA, col.residuals = NA, nresiduals = NA,
# following are passed to plot.model.selection
legend.pos = NULL, cex.legend = NULL, col.grsq = 1, col.infold.rsq = 0,
col.mean.infold.rsq = 0, col.mean.oof.rsq = "palevioletred",
col.npreds = if(is.null(object$cv.oof.rsq.tab)) 1 else 0,
col.oof.labs = 0, col.oof.rsq = "mistyrose2", col.oof.vline = col.mean.oof.rsq,
col.pch.cv.rsq = 0, col.pch.max.oof.rsq = 0, col.sel.grid = 0,
col.vline = col.grsq, col.vseg = 0, lty.grsq = 1, lty.npreds = 2,
lty.rsq = 5, lty.vline = 3, col.legend = NA,
...)
1:4
.
1) Model selection (GRSq versus number of terms)
2) Cumulative distribution of abs residuals
3) Residuals versus fitted
4) QQ plot of residuals
5) Abs residuals versus fitted
6) Abs residuals versus log fiFALSE
.
(1) Plot the distribution of the residuals along the bottom of the plot.
(2) Show the Spearman Rank Correlation of the absolute residuals
with the fitted valueFALSE
.
Divide the residuals by sqrt(1 - h_ii)
,
where h_ii
are the diagonal entries of the hat matrix.
The hat matrix here is from the linear fit on earth's basis matrix bx
.
(NoFALSE
.
Divide each residual by its estimated standard deviation.
Requires that the model was built with the varmod.method
argument,
because we need the residual model to get the standard deviations.
Doe0
meaning do not plot the bands.
A typical value is level=.95
.
Requires that the model was built with the varmod.method
argument.
The color NULL
Default. Plot the residuals versus the fitted values
(the log fitted values when which=6
to 8
).
""
Residuals versus the predictors (multiple plots i-1
for all.
Default is 1000
(not all to reduce over-plotting).
A systematic sample of size nresiduals
is taken but
the largest few id.n
residuals will be labeled in the plot.
Default is 3
.rownames(residuals(x))
.
Only used if id.n > 0
..5
.
Lower values make the line bumpier.
This argument is passed as f
in the internal call to lowes
TRUE
, start a new page and call par
as appropriate.
Default is length(which) > 1
, i.e., call par
if
drawing more than one plot.
Use FALSE
to use the cuwhich
has more than one element,
this argument applies only to the Model Selection plot.
In the model selection plot,
the special value min=-1
means theNULL
, meaning generate the headings automatically.1.2
.
Used only if do.par
is TRUE
(default).if(do.par) NULL else ""
. One of:
"string"
string
""
no caption
NULL
generate a caption automatically.NULL
, meaning label the x axis automatically.NULL
, meaning label the y axis automatically.20
."lightblue"
Use 0
for no RSq line.loess
line.
Default is NULL
, meaning automatic."red"
.
Color of cross validation line in the residuals plot.
This is the residual of the mean out-fold-predicted value.col.line
.
Use 0
for no QQ line."lightgray"
. Use 0
for no grid.1
NULL
, meaning automatic.level
argument was used.
Color of the prediction intervals.
Default is "mistyrose2"
level
argument was used.
Color of the confidence intervals.
Default is "mistyrose4"
"none"
no grid on Cumulative Distribution plot
"grid"
add grid
"percentages"
(default) add grid and percentage labels to quantile lines.col.line
instead.
Default is NA
.col.points
instead.
Default is NA
.npoints
instead.
Default is NA
.
The following are passed to plot.model.selection
.NULL
, meaning automatic.
Else specify c(x,y)
in user coordinates,
or use "topleft"
etc. as explained in legend
.NULL
, meaning automatic.1
.
Use 0
for no GRSq line.nfold
and keepxy
were used
in the original call to earth
.
Default is 0
, lines not plotted.0
, line not plotted.
Applies only if nfold
and keepxy
were used
in the original call to earth
.nfold
and keepxy
were used
in the original call to earth
.
Default is "palevioletred"
.
Uoof.rsq
's are displayed.
Use 0
for no "number of predictors" plot.oof.rsq
lines.
Default is 0
, no labels.nfold
and keepxy
were used
in the original call to earth
.
Default is "mistyrose2"
, a pale pink.
Uoof.rsq
in the Model Selection plot.
Default is col.mean.oof.rsq
.oof.rsq
line to indicate the cv.rsq
.
for that fold
(i.e., it is plotted at the number of terms selected by the in-fold GCV).
Default is 0
, point not plotted.oof.rsq
line to indicate the
maximum oof.rsq
for that fold.
Default is 0
, point not plotted.0
, no grid.
Try something like "lightgray"
, "linen"
, or "seashell"
.
See also col.cum.grid
, for the grid in the Cumulacol.grsq
.
This will be at the maximum GRSq unless pmethod="none"
.
Use 0
for no vertical line.0
.
Color of triangular marker at top of vertical line for best GRSq.1
2
.5
.3
.1
.
Use 0
for no legend.earth
,
plot.earth.models
,
plotd
,
plotmo
data(ozone1)
earth.mod <- earth(O3 ~ ., data = ozone1, degree = 2)
plot(earth.mod)
Run the code above in your browser using DataLab