{earth}R Documentation

Compare earth models by plotting them.


Compare earth models by plotting them.


## S3 method for class 'earth.models'
plot(x = stop("no 'x' argument"), which = c(1:2),
    caption = "", jitter = 0,
    col.grsq = discrete.plot.cols(length(objects)), lty.grsq = 1,
    col.rsq = 0, lty.rsq = 5,
    col.vline = col.grsq, lty.vline = "12",
    col.npreds = 0,  lty.npreds  = 2,
    legend.text = NULL, do.par = NULL, trace = 0,



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 plots to plot: 1 model, 2 cumulative distribution of residuals. Default is 1:2, meaning both.


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


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.


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


Line type for the GRSq plot. Default is 1.


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


Line type for the RSq plot. Default is 5.


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.


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.


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).


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

legend.text, do.par, trace

Please see plotres


Please see plotres


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

See Also

earth,,, plotd, plotmo


a1 <- earth(O3 ~ .,          data = ozone1, degree = 2)
a2 <- earth(O3 ~ .-wind,     data = ozone1, degree = 2)
a3 <- earth(O3 ~ .-humidity, data = ozone1, degree = 2),a2,a3), ylim=c(.65,.85))

[Package earth version 5.3.3 Index]