earth (version 0.1-2)

plot.earth: Plot an 'earth' object

Description

Plot an earth object. The plot shows model selection, cumulative distribution of the residuals, residuals versus fitted values, and the residual QQ plot.

Usage

## S3 method for class 'earth':
plot(x = stop("no 'x' arg"), 
     which = 1:4, sub.caption = if(do.par) NULL else "",
     col.rsq = "lightblue", col.loess = col.rsq, 
     col.qq = col.rsq, col.grid = "grey",
     col.vline = "grey", lty.vline = 3, 
     col.legend = 1, col.npreds = 1,
     nresiduals = 1000, cum.grid = "percentages", rlim = c(-1,-1),
     jitter = 0, id.n = 3, labels.id = names(residuals(x)),
     legend.pos = NULL, do.par = TRUE,
     main = NULL, pch = 1, ...)

Arguments

x
An earth object. This is the only required argument. (This argument is called 'x' for consistency with the generic plot).
which
Which plots to plot. Default is 1:4, meaning all. 1) model 2) cumulative distribution of absolute values of residuals 3) residuals versus fitted values 4) QQ.
sub.caption
Overall caption. The default value is if(do.par) NULL else "". Values are: "string" string "" no caption NULL generate a caption from the $call component of the earth obj
For all the col arguments, 0 means don't plot the corresponding graph element.
col.rsq
Colour of RSq line in model selection plot. Default is "lightblue".
col.loess
Colour of loess line in residuals plot. Default is col.rsq. Generating the loess line occasionally causes warnings such as "Warning: pseudoinverse used". To get rid of these warnings, set col.loess=0
col.qq
Colour of QQ line. Default is col.rsq.
col.grid
Colour of grid lines in cumulative distribution plot. Default is "grey".
col.vline
Colour of vertical line at best model in model plot. Default is "grey".
lty.vline
Line type of vertical line at best model in model plot. Default is 3.
col.legend
Colour of legend (inside plot area) of model plot. Default is 1, meaning draw a legend. Use 0 for no legend.
col.npreds
Colour of the number of predictors plot within the model plot. Default is 1. Use 0 for no number of predictors plot.
nresiduals
Maximum number of residuals to plot. Use -1 for all. A systematic sample of size nresiduals is taken but the largest few residuals are always included. Default is 1000.
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.
rlim
Two element vector c(min,max) specifying min and max values on the y axis of the RSq/GRSq plot. Default is c(-1,-1).

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

jitter
Jitter applied to GRSq and RSq values to minimise overplotting. Default is 0, meaning no jitter. A typical useful value is 0.01.
id.n
Number of largest residuals to be labeled. Default is 3.
labels.id
Residual names. Default is names(residuals(x)).
legend.pos
NULL (default) means position legend automatically. Else specify c(x,y) in user coords. 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,1), 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.
pch
Plot character for QQ and residuals plot. Default is 1.
...
Extra arguments passed to plotting functions.

See Also

earth, plot.earth.models, plotmo

Examples

Run this code
data(ozone1)
a <- earth(O3 ~ ., data = ozone1, degree = 2)
plot(a, col.npreds = 1, cum.grid = "none")

Run the code above in your browser using DataLab