See the plotmo
} vignette.
plotmo(object=stop("no 'object' argument"),
type=NULL, nresponse=NA,
pt.col=0, jitter=NULL, smooth.col=0, level=0,
func=NULL, inverse.func=NULL, nrug=0, grid.col=0,
type2="persp",
degree1=TRUE, all1=FALSE, degree2=TRUE, all2=FALSE,
do.par=TRUE, clip=TRUE, ylim=NULL, caption=NULL, trace=0,
grid.func=median, grid.levels=NULL, extend=0,
ngrid1=50, ngrid2=20, ndiscrete=5, npoints=3000,
center=FALSE, xflip=FALSE, yflip=FALSE, swapxy=FALSE, int.only.ok=TRUE,
...)
predict
.
For allowed values see the predict
method for
your object
(such as predict.earth
).
By predict
returns multiple columns.
This can be a column index or column name
(which may be abbreviated, partial matching is used).y
in the data
used to build the model.
Note that the displayed points are jittered (see the jitter
argument).
Default is 0
pt.col
is specified.
The default is jitter=NULL
, meaning automatically jitter the points.
Points are jittered horizontally and vertically.
Use jitter=0
to disable this automatic jittering.
Otherwise spt.col
is specified.)
Default is 0
, no smooth line.
Example:mod <- lm(Volume~Height, data=trees)
plotmo(mod, pt.color=1, smolevel
,
if the predict method for the model supports them.
Default is 0
, bands not plotted.
Else a fraction, for example level=.95
.
See func(x)
on the plot.
Example:mod <- lm(Volume~Girth, data=trees)
estimated.volume <- function(x) .17 * x$Girth^2
plotmo(mod, pt.col=2, func=estimated.volume)
The func
is called for each plot with a single argurug
rug along the bottom of the plot
(a sample of nrug
points is plotted).
Default is 0
, no rug.
Use nrug=TRUE
or -1
for all p0
, no grid.
Else add a background grid
of the specified color to the degree1 plots.
The special value grid.col=TRUE
is treated as "lightgray"
.plotmo
vignette).
Default is TRUE<
FALSE
.
Use TRUE
to plot all predictors,
not just those usually selected by plotmo
.
The all1
argument increases the number of plots;
the degree1
argument reduces the number of ploTRUE
meaning all
(after selecting the relevant interaction terms as described in
FALSE
.
Use TRUE
to plot all pairs of predictors,
not just those usually selected by plotmo
.NULL
, FALSE
, TRUE
, or 2
, as follows:do.par=NULL
. Same as do.par=FALSE
if the
number of plots is one; else the same as TRUE
.
do.par=FALSE
. Use
clip=TRUE
, meaning ignore very outlying
predictions when determining the automatic ylim
.
This keeps ylim
fairly compact while
still covering all or nearly all the data,
even if there are a few crazy pylim=NULL
(default). Automatically determine a ylim
to use across all graphs.
ylim=NA
. Each graph has its own ylim
.
ylim=c(ymin,ymax)
. Use the specified limits.caption=""
for no caption.
(Use main
to set the title of individual plots, can be a vector.)0
.
trace=1
(or TRUE
) for a summary trace (shows how
predict
is invoked for the current object).
trace=2
for detailed tracing.
tra
x
matrix to pin the values of
variables not on the axes.
Default is median
.
This argument is not related to the grid.col
argument.
Examples:pNULL
.
Else a list of variables and their fixed value to be used
when the variable is not on the axis.
Supersedes grid.func
for variables in the list.
Names and values can be abbreviated, partial matching is used.
Examp0
, do not extend
(i.e. use the range of the variable in the training data).
Else something like extend=.5
, which will extend both the lower
and upper xlim
50
.ngrid2 x ngrid2
points are plotted).
Default is 20
.
The default will sometimes be too small for contour
and image
plots.
With large ngrid2
values, persp<
npoints
points is plotted).
Applies only if pt.col
is specified.
The default is 3000 (not all, to avoid overplotting on large models).
Use npoints=TRUE
or -
5
(a somewhat arbitrary value).
Variables with no more than ndiscrete
unique values
are plotted as quantized in plots (a staircase rather than a curve).
Factors are always considered discrete.TRUE
.
Use int.only.ok=FALSE
to instead issue an error message for intercept-only models.FALSE
.FALSE
.
Use TRUE
to flip the direction of the x
axis.
This argument (and yflip
and swapxy
) is useful when comparing
to a plot from another source and you want the axes to be the same.FALSE
.
Use TRUE
to flip the direction of the y axis of the degree2 graphs.FALSE
.
Use TRUE
to swap the x and y axes on the degree2 graphs.plotmo
} vignette.There is a brief section on plotmo
in the rpart.plot
vignette
rpart
trees with prp
}.
if (require(rpart)) {
data(kyphosis)
rpart.model <- rpart(Kyphosis~., data=kyphosis)
plotmo(rpart.model, type="prob", nresponse="present")
}
if (require(earth)) {
data(ozone1)
earth.model <- earth(O3 ~ ., data=ozone1, degree=2)
plotmo(earth.model)
}
Run the code above in your browser using DataCamp Workspace