plot.earth
Plot an earth object
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
.
- Keywords
- models
Usage
"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(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)), ...)
Arguments
- x
-
An
earth
object. This is the only required argument. (It is called "x" for consistency with the genericplot
.) - which,info,versus
- These arguments are identical to
plotres
. Please see the help page forplotres
. - standardize,delever,level
- .
- id.n,labels.id,smooth.col
- .
- grid.col,jitter
- .
- do.par,caption,trace
- .
- npoints,center
- .
- type,nresponse
- .
- col.cv
- 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.
- col.grsq
- Default
1
. Color of GRSq line in the Model Selection plot. Use0
for no GRSq line. - col.rsq
- Default
2
. Color of the RSq line in the Model Selection plot. Use0
for no RSq line. - col.infold.rsq
-
Color of in-fold RSq lines for each fold in the Model Selection plot.
Applies only if
nfold
andkeepxy
were used in the original call toearth
. Default is0
, lines not plotted. - col.mean.infold.rsq
-
Color of mean in-fold RSq for each number of terms in the Model Selection plot.
Default is
0
, line not plotted. Applies only ifnfold
andkeepxy
were used in the original call toearth
. - col.mean.oof.rsq
- Default
"palevioletred"
. Color of mean out-of-fold RSq for each number of terms in the Model Selection plot. Applies only ifnfold
andkeepxy
were used in the original call toearth
. Use0
to not plot this line. - col.npreds
- 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. Use0
for no "number of predictors" plot. - col.oof.labs
-
Color of fold number labels on the
oof.rsq
lines. Default is0
, no labels. - col.oof.rsq
-
Color of out-of-fold RSq lines for each fold in the Model Selection plot.
Applies only if
nfold
andkeepxy
were used in the original call toearth
. Default is"mistyrose2"
, a pale pink. Use0
to not plot these lines. May be a vector of colors, which will be recycled if necessary. - col.oof.vline
-
Color of vertical line at the maximum
oof.rsq
in the Model Selection plot. Default iscol.mean.oof.rsq
. - col.pch.cv.rsq
-
Color of point plotted on the
oof.rsq
line to indicate thecv.rsq
. for that fold (i.e., it is plotted at the number of terms selected by the in-fold GCV). Default is0
, point not plotted. - col.pch.max.oof.rsq
-
Color of point plotted on the
oof.rsq
line to indicate the maximumoof.rsq
for that fold. Default is0
, point not plotted. - col.vline
-
Color of the vertical line at selected model in the Model Selection plot.
Default is
col.grsq
. This will be at the maximum GRSq unlesspmethod="none"
. Use0
for no vertical line. - col.vseg
-
Default is
0
. Color of triangular marker at top of vertical line for best GRSq. - lty.grsq
-
Line type of GRSq line in the Model Selection plot.
Default is
1
- lty.npreds
-
Line type of the "number of predictors" plot in the Model Selection plot.
Default is
2
. - lty.rsq
-
Line type of RSq line in the Model Selection plot.
Default is
5
. - lty.vline
-
Line type of vertical line at selected model in the Model Selection plot.
Default is
"12"
. - legend.pos
-
Position of the legend in the Model Selection plot.
Default is
NULL
meaning automatic. Uselegend.pos=NA
or0
for no legend. - add, max.nterms, max.npreds
-
earth_plotmodsel
arguments for internal use byplotres
. - ...
- 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, andymax
equal-1
means use the largest GRSq or RSq value.
Note
For details on interpreting the graphs,
please see the earth
package vignettes
Notes on the earth package
and
Variance models in earth.
Note that cross-validation data will not be displayed unless
both nfold
and keepxy
were used in the original call to
earth
.
earth_plotmodsel
is provided for use by plotres
.
See Also
Examples
data(ozone1)
earth.mod <- earth(O3 ~ ., data = ozone1, degree = 2)
plot(earth.mod)