earth (version 0.1-2)

plot.earth.models: Plot 'earth' models

Description

Compare earth models by plotting them.

Usage

plot.earth.models(x = stop("no 'x' arg"), which = c(1:2),
  sub.caption = "", rlim = c(0,1), jitter = 0,
  col.grsq = discrete.plot.cols(length(x)),
  col.rsq = 0, col.npreds = 0, col.cum = NULL,
  col.vline = "grey", lty.vline = 3,
  col.legend = 1, col.grid = "grey", cum.grid = "percentages",
  legend.pos = NULL, legend.text = NULL, do.par = TRUE, main = "Model Comparison", ...)

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
which
Which plots to plot: 1 model, 2 cumulative distribution of residuals. Default is 1:2, meaning both.
sub.caption
Overall caption. "string" string "" (default) no caption NULL generate a caption from the $call component of the earth objects.
rlim
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).

Special value min=-1 means the minimum y axis value is the smallest GRSq or RSq valu

jitter
Jitter applied to GRSq and RSq values to minimise overplotting. Default is 0, meaning no jitter. A typical useful value is 0.01.
For all the col arguments, 0 means do not plot the corresponding graph element. You can use vectors of colours for the col arguments.
col.grsq
Vector of colours for the GRSq plot. The default is discrete.plot.cols(length(x)) which is vector of distinguishable colours, the first three of which are also distinguishable on a monochrome printer. You can examine the colou
col.rsq
Vector of colours for the RSq plot. Default is 0, meaning no RSq plot.
col.npreds
Vector of colours for the number of predictors plot within the model plot.

Default is 0, meaning no number of predictors plot.

The special value NULL means borrow col.grsq

col.cum
Vector of colours for the cumulative distribution plot. The special value NULL (default) means borrow col.grsq (or col.rsq if col.grsq is NULL).
col.vline
A vertical line is drawn for each object to show which model size was chosen for each object. The colour of the line is col.vline. Default is "grey".
lty.vline
Line type of best model vertical line. Can be a vector. Default is 3.
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.

col.grid
Colour of grid lines in cumulative distribution plot. Default is "grey".
cum.grid
Specify grid on cumulative distribution graph. Values are: "none" no grid on cumulative distribution plot "grid" add grid "percentages" (default) add grid, and percentage labels to quantile lines.
legend.pos
The special value NULL (default) means position the legend automatically. Else specify c(x,y) in user coords.
legend.text
Vector of strings to use as legend text. The special value NULL (default) means generate the legend text automatically from call$formula. The following settings are related to par() and are included so yo
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.
...
Extra arguments passed to plotting functions.

See Also

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

Examples

Run this code
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), rlim=c(.6,.8), cum.grid="n")

Run the code above in your browser using DataLab