See the package vignette
plotmo
package}
plotmo(object = stop("no 'object' arg"),
type=NULL, nresponse = NA, clip = TRUE, ylim = NULL,
center = FALSE, ndiscrete = 5,
degree1 = TRUE, all1=FALSE, degree2 = TRUE, all2=FALSE, int.only.ok = TRUE,
grid.func = median, grid.levels = NULL,
col.response = 0, cex.response = NULL, pch.response = 20,
jitter.response=0, npoints = -1, inverse.func = NULL,
level = 0, shade.pints = "mistyrose2", shade2.pints = "mistyrose4",
trace = 0,
nrug = 0, col.degree1 = 1, lty.degree1 = 1, lwd.degree1 = 1,
col.smooth = 0, lty.smooth = 1, lwd.smooth = 1, smooth.f = .5,
func = NULL, col.func = "lightblue", lty.func = 1, lwd.func = 1,
ngrid1 = 50, grid = FALSE,
type2 = "persp", ngrid2 = 20,
col.image = gray(0:10/10), col.persp = "lightblue",
theta = NA, phi = 30, dvalue = 1, shade = 0.5,
do.par = TRUE, caption = NULL, main = NULL,
xlim = NULL, xlab = "", ylab = "", cex = NULL, cex.lab = 1,
xflip = FALSE, yflip = FALSE, swapxy = FALSE, se = 0, ...)
predict
.
For allowed values see the predict
method for
your object
(such as
predict.earth
predict
returns multiple columns.
This can be a column index or column name
(which may be abbreviated, partial matching is used).
Ignored when predict
returns a single column.TRUE
, meaning plot only predicted values that
are in the expected range.
Use FALSE
to plot all values.
See clip
argumentNULL
(default) all y axes have same limits
(where FALSE
.
(This is an initial implementation of centering and will change.)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
, meaning all degree1 plots (the TRUE
gets recycled).
Use FALSE
(or 0
) for no degree1 plots.
Note that this FALSE
.
Use TRUE
to plot all predictors,
not just those usually selected by plotmo
.
See all1
argument increases the TRUE
, meaning all degree2 plots.
New in version 1.3-0: degree2
may be a character vector
specifying which variables to plot
(<FALSE
.
Use TRUE
to plot all pairs of predictors,
not just those usually selected by plotmo
.
The all2
argument increases the number of plots;
the degree2
argumeint.only.ok=FALSE
to instead issue an error message
for intercept-only mox
matrix to fix the values of
variables not on the axes.
Default is median
.
(This argument is ignored for factors. The first level of
factNULL
.
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 maty
in the data
used to build the model.
Plotting these points is most helpful only when the model has a single predictor.
Can be a vectorNULL
, meaning automatic.
Applies only if col.response!=0
.20
.
Applies only if col.response!=0
.col.response!=0
.
Default 0
, no jitter.
A typical useful value is .3
, but it depends on the data.
Points are jittered horizontally and verticalcol.response!=0
.
Default is the special value -1
meaning all.
Otherwise a sample of npoints
points is taken.NULL
.
Else a function applied to the predicted response before plotting.
For example, you could use inverse.func=exp
if your
model formula is log(y)~x
.level
.
Default is 0, bands not plotted.
Else a fraction, something like level=.95
.
See level
bands. Default is "mistyrose2"
, a pale pink.
Applies only if level > 0
.level
bands. Default is "mistyrose4"
.
Applies only if level > 0
and currently only for lm
models.0
.
Use 1
(or TRUE
) to trace operation.
Use values greater than 1
for more detailed tracing.
Use -1
to inhibit the grid:
message usually issued by plotmo
.0
, no rug.
Special value -1
for all.
Otherwise a sample of nrug
points is taken.1
.1
.1
.col.response
is set.)
This refers to the response y
in the data
used to build the model.
Default is 0
1
.
Applies only if col.smooth!=0
.1
.
Applies only if col.smooth!=0
.f
parameter in internal call to lowess
.
Default is .5
.
Applies only if col.smooth!=0
.func(x)
if func
is not NULL
.
Default is NULL
.
This is useful if you are comparing the model to a known function.
The func
is called for each plot with a single argfunc
line.
Default is "lightblue"
.func
line.
Default is 1.func
line.
Default is 1.50
.FALSE
.
Use TRUE
to add a grid
to the degree1 plots.
You can also specify a color here, e.g. grid="darkgray"
.
The following arguments are for degreengrid2 x ngrid2
points are plotted,
but less for factors and variables with less than ngrid2
discrete values).
Default is 20
.
Note 1: the default will often be too small for image
plot.
Default is gray(0:10/10)
, a range of grays.
Clipped values will be displayed in blue (only applies if clip=TRUE
).persp
surface. Default is "lightblue"
.
Use 0 for no color.persp
.
Default is NA
, meaning automatically rotate each graph
so the highest corner is furthest away.
Use trace=1
to see the calculated value fopersp
. Default is 30
.
Lower values to view from the side; higher to view from above.persp
as d
. Default is 1
.
The name was changed from d
to avoid partial matching problems.persp
. Default is 0.5
.
The following are related to par
and other graphical settings.TRUE
, meaning start a new page and call par
as
appropriate to display multiple plots on the same page
(this adjusts mfrow
, cex
, mar
, and type
, response name, and call
.caption
, for the overall title.NULL
, meaning automatically calculate xlim
for each graph.
Else used the given xlim
for all degree1
graphs.""
, no label, which gives more plottable area.
The special value NULL
means use the current variable xlab
.1
.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 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.level
argument instead.
So instead of se=2
use level=.95
.persp
plots, ticktype="d", nticks=2
is useful.)plotmo
} packageThere is 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, nk=21)
plotmo(earth.model)
}
Run the code above in your browser using DataCamp Workspace