plot.earth {earth} | R Documentation |
Plot an earth
object.
The plot shows model selection, cumulative distribution
of the residuals, residuals versus fitted values, and the residual QQ plot.
## S3 method for class 'earth': plot(x = stop("no 'x' arg"), which = 1:4, ycolumn = 1, 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 = rownames(residuals(x, warn=FALSE)), legend.pos = NULL, do.par = TRUE, main = NULL, pch = 1, ...)
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 selection (GRSq plot) 2) cumulative distribution of absolute values of residuals 3) residuals versus fitted values 4) QQ. |
ycolumn |
Specify which column of the response to plot if the model has multiple responses. Default is 1. This argument does not affect the model selection plot which is always across all responses. |
caption |
Overall caption. The default value is
if(do.par) NULL else "" . Values are:"string" string"" no captionNULL generate a caption from the $call component of the earth object.
|
|
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.
Default is 1000 (not all to reduce over-plotting).
A systematic sample of size nresiduals is taken but
the largest few residuals are always included.
|
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 plot.
Default is c(-1,-1) .
Special value min=-1 means the minimum y axis value
is the smallest GRSq or RSq value excluding the intercept values.
Special value max=-1 means the maximum y axis value
is the largest GRSq or RSq value.
|
jitter |
Jitter applied to GRSq and RSq values to minimise over-plotting.
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 rownames(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. |
Why doesn't plot.earth
print GLM information?
It's just too much to display.
You can instead call plot
on the glm.list
in the earth model like this:
data(etitanic) a <- earth(survived ~ ., data=etitanic, glm=list(family=binomial)) par(mfrow=c(2,2)) plot(a$glm.list[[1]])I want to add lines or points to the RSq plot, and am having trouble getting my axis scaling right. Help?
Use do.par=FALSE
.
With do.par=FALSE
, the axis scales match the axis labels.
With do.par=TRUE
, plot.earth
restores the
par
parameters and axis scales to
what they were before calling plot.earth
.
This usually means that the x- and y-axis scales are both 0 to 1.
earth
,
plot.earth.models
,
plotmo
data(ozone1) a <- earth(O3 ~ ., data = ozone1, degree = 2) plot(a, col.npreds = 1, cum.grid = "none")