plot.earth.models {earth}R Documentation

Compare "earth" models by plotting them.

Description

Compare earth models by plotting them.

Usage

## S3 method for class 'earth.models'
plot(x = stop("no 'x' arg"), which = c(1:2),
    caption = "", jitter = 0,
    col.grsq = discrete.plot.cols(length(x)), lty.grsq = 1,
    col.rsq = 0, lty.rsq = 5,
    col.vline = col.grsq, lty.vline = 3,
    col.npreds = 0,  lty.npreds  = 2, col.sel.grid = 0,
    ylim = c(0,1),
    col.legend = 1, cex.legend = NULL, legend.pos = NULL, legend.text = NULL,
    col.cum = NULL, do.par = TRUE, main = "Model Comparison",
    rlim = NA, ...)

Arguments

x

A list of one or more earth objects, or a single earth object. This is the only required argument. (This argument is called 'x' for consistency with the generic plot.)

which

Which plots to plot: 1 model, 2 cumulative distribution of residuals. Default is 1:2, meaning both.

caption

Overall caption. Values:
"string" string
"" (default) no caption
NULL generate a caption from the $call component of the earth objects.

jitter

Jitter applied to GRSq and RSq values to minimize over-plotting. Default is 0, meaning no jitter. A typical useful value is 0.01.

For the col arguments below, 0 means do not plot the corresponding graph element. You can use vectors of colors.

col.grsq

Vector of colors for the GRSq plot. The default is discrete.plot.cols(length(x)) which is vector of distinguishable colors, the first three of which are also distinguishable on a monochrome printer. You can examine the colors using
earth:::discrete.plot.cols().

lty.grsq

Line type for the GRSq plot. Default is 1.

col.rsq

Vector of colors for the RSq plot. Default is 0, meaning no RSq plot.

lty.rsq

Line type for the RSq plot. Default is 5.

col.vline

A vertical line is drawn for each object to show which model size was chosen for that object. The color of the line is col.vline. Default is col.grsq.

lty.vline

Line type of vertical lines (a vertical line is drawn to show the selected model for each object). Can be a vector. Default is 3.

col.npreds

Vector of colors for the "number of predictors" plot within the model selection plot. Default is 0, meaning no "number of predictors" plot. The special value NULL means borrow col.grsq (or col.rsq if col.grsq is NULL).

lty.npreds

Line type of the "number of predictors" plot (in the Model Selection plot). Default is 2.

col.sel.grid

Color of grid lines in the Model Selection graph. Default is 0, no grid. Try something like "lightgray", "linen", or "seashell".

ylim

Two element vector c(min,max) specifying min and max values on the y axis of the RSq/GRSq plot. Default is c(0,1).
The special value min=-1 means the minimum y axis value is the smallest GRSq or RSq, excluding the intercept.
The special value max=-1 means the maximum y axis value is the largest GRSq or RSq.

col.legend

Default is 1, meaning draw a legend. Use 0 for no legend. The legend is drawn in the cumulative distribution graph, if that graph is plotted. Else the legend is drawn in the model comparison chart.

cex.legend

Legend cex. Default is NULL, meaning choose automatically.

legend.pos

Legend position. Default NULL, meaning position the legend automatically. Else specify c(x,y) in user coordinates, or use "topleft" etc. as explained in legend.

legend.text

Vector of strings to use as legend text. The special value NULL (default) means generate the legend text automatically from call$formula.

col.cum

Vector of colors for the cumulative distribution plot. The special value NULL (default) means borrow col.grsq (or col.rsq if col.grsq is NULL).

The following settings are related to par() and are included so you can override the defaults.

do.par

Call par() for global settings as appropriate. Default is TRUE, which sets mfrow, mar=c(4,4,2,3), mgp=c(1.6,0.6,0), cex=0.7. Set to FALSE if you want to append figures to an existing plot.

main

Title of each plot. Default is NULL, meaning generate figure headings automatically.

rlim

Deprecated. Please use ylim instead.

...

Extra arguments passed to plotting functions.

Note

This function ignores GLM and cross-validation components of the earth model, if any.

See Also

earth, plot.earth, plot.earth.models, plotd, plotmo

Examples

data(ozone1)
a1 <- earth(O3 ~ .,          data = ozone1, degree = 2)
a2 <- earth(O3 ~ .-wind,     data = ozone1, degree = 2, nk = 31)
a3 <- earth(O3 ~ .-humidity, data = ozone1, degree = 2, nk = 31)
plot.earth.models(list(a1,a2,a3), ylim=c(.6,.8))

[Package earth version 3.2-7 Index]