Plot an earth
object.
By default the plot shows model selection, cumulative distribution
of the residuals, residuals versus fitted values, and the residual QQ plot.
This function calls plotres
internally.
The first arguments are identical to plotres
.
# S3 method for earth
plot(x = stop("no 'x' argument"), # the following are identical to plotres arguments
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,
# the following are earth specific
col.cv = "lightblue", col.grsq = 1, col.rsq = 2, 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.vline = col.grsq,
col.vseg = 0, lty.grsq = 1, lty.npreds = 2, lty.rsq = 5, lty.vline = "12",
legend.pos = NULL, ...)
earth_plotmodsel( # for internal use by plotres
x, col.rsq = 2, col.grsq = 1, col.infold.rsq = 0,
col.mean.infold.rsq = 0, col.mean.oof.rsq = "palevioletred",
col.npreds = NULL, 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.vline = col.grsq, col.vseg = 0,
lty.grsq = 1, lty.npreds = 2, lty.rsq = 5, lty.vline = "12",
legend.pos=NULL, add = FALSE, jitter = 0,
max.nterms = length(object$rss.per.subset),
max.npreds=max(1,get.nused.preds.per.subset(object$dirs,object$prune.terms)),
...)
An earth
object.
This is the only required argument.
(It is called "x" for consistency with the generic plot
.)
These arguments are identical to plotres
.
Please see the help page for plotres
.
.
.
.
.
.
.
Default "lightblue"
.
Color of cross validation line in the residuals plot.
This is the residual of the mean out-fold-predicted value.
The following arguments are for the model selection plot.
Default 1
.
Color of GRSq line in the Model Selection plot.
Use 0
for no GRSq line.
Default 2
.
Color of the RSq line in the Model Selection plot.
Use 0
for no RSq line.
Color of in-fold RSq lines for each fold in the Model Selection plot.
Applies only if nfold
and keepxy
were used
in the original call to earth
.
Default is 0
, lines not plotted.
Color of mean in-fold RSq for each number of terms in the Model Selection plot.
Default is 0
, line not plotted.
Applies only if nfold
and keepxy
were used
in the original call to earth
.
Default "palevioletred"
.
Color of mean out-of-fold RSq for each number of terms in the Model Selection plot.
Applies only if nfold
and keepxy
were used
in the original call to earth
.
Use 0
to not plot this line.
Color
of the "number of predictors" plot in the Model Selection plot.
The default displays the number of predictors unless the oof.rsq
's are displayed.
Use 0
for no "number of predictors" plot.
Color of fold number labels on the oof.rsq
lines.
Default is 0
, no labels.
Color of out-of-fold RSq lines for each fold in the Model Selection plot.
Applies only if nfold
and keepxy
were used
in the original call to earth
.
Default is "mistyrose2"
, a pale pink.
Use 0
to not plot these lines.
May be a vector of colors, which will be recycled if necessary.
Color of vertical line at the maximum oof.rsq
in the Model Selection plot.
Default is col.mean.oof.rsq
.
Color of point plotted on the 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.
Color of point plotted on the oof.rsq
line to indicate the
maximum oof.rsq
for that fold.
Default is 0
, point not plotted.
Color of the vertical line at selected model in the Model Selection plot.
Default is col.grsq
.
This will be at the maximum GRSq unless pmethod="none"
.
Use 0
for no vertical line.
Default is 0
.
Color of triangular marker at top of vertical line for best GRSq.
Line type of GRSq line in the Model Selection plot.
Default is 1
Line type of the "number of predictors" plot in the Model Selection plot.
Default is 2
.
Line type of RSq line in the Model Selection plot.
Default is 5
.
Line type of vertical line at selected model in the Model Selection plot.
Default is "12"
.
Position of the legend in the Model Selection plot.
Default is NULL
meaning automatic.
Use legend.pos=NA
or 0
for no legend.
Can be something like legend.pos="topleft"
or legend.pos=c(6, .75)
.
earth_plotmodsel
arguments for internal use by
plotres
.
Please see plotres
for the details
on the dots arguments.
The ylim
argument is treated specially in the model selection plot:
ymin
equal to -1
means use
the smallest GRSq or RSq value, excluding the intercept,
and ymax
equal -1
means use
the largest GRSq or RSq value.
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