plotmo {plotmo} | R Documentation |

Plot a model's response when varying one or two predictors while holding the other predictors constant. A poor man's partial dependence plot.

Please see the plotmo vignette.

plotmo(object=stop("no 'object' argument"), type=NULL, nresponse=NA, pt.col=0, jitter=.5, 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, ...)

`object` |
The model object. | |||||||||||||||||||||||||||||

`type` |
Type parameter passed to | |||||||||||||||||||||||||||||

`nresponse` |
Which column to use when | |||||||||||||||||||||||||||||

`pt.col` |
The color of response points (or response sites in degree2 plots).
This refers to the response | |||||||||||||||||||||||||||||

`jitter` |
Applies only if | |||||||||||||||||||||||||||||

`smooth.col` |
Color of smooth line through the response points.
(The points themselves will not be plotted unless mod <- lm(Volume~Height, data=trees) plotmo(mod, pt.color=1, smooth.col=2) You can adjust the amount of smoothing with | |||||||||||||||||||||||||||||

`level` |
Draw estimated confidence or prediction interval bands at the given mod <- lm(log(Volume)~log(Girth), data=trees) plotmo(mod, level=.95) You can modify the color of the bands with | |||||||||||||||||||||||||||||

`func` |
Superimpose mod <- lm(Volume~Girth, data=trees) estimated.volume <- function(x) .17 * x$Girth^2 plotmo(mod, pt.col=2, func=estimated.volume) The | |||||||||||||||||||||||||||||

`inverse.func` |
A function applied to the response before plotting. Useful to transform a transformed response back to the original scale. Example: mod <- lm(log(Volume)~., data=trees) plotmo(mod, inverse.func=exp) # exp() is inverse of log() | |||||||||||||||||||||||||||||

`nrug` |
Number of points in the | |||||||||||||||||||||||||||||

`grid.col` |
Default is | |||||||||||||||||||||||||||||

`type2` |
Degree2 plot type.
One of plotmo(mod, persp.ticktype="detailed", persp.nticks=2) plotmo(mod, type2="image") plotmo(mod, type2="image", image.col=heat.colors(12)) plotmo(mod, type2="contour", contour.col=2, contour.labcex=.4) | |||||||||||||||||||||||||||||

`degree1` |
An index vector specifying which subset of degree1 (main effect) plots to include
(after selecting the relevant predictors as described in
“ | |||||||||||||||||||||||||||||

`all1` |
Default is | |||||||||||||||||||||||||||||

`degree2` |
An index vector specifying which subset of degree2 (interaction) plots to include.
| |||||||||||||||||||||||||||||

`all2` |
Default is | |||||||||||||||||||||||||||||

`do.par` |
One of
| |||||||||||||||||||||||||||||

`clip` |
The default is `plotmo` vignette.
Use `clip=FALSE` for no clipping.
| |||||||||||||||||||||||||||||

`ylim` |
Three possibilities:
| |||||||||||||||||||||||||||||

`caption` |
Overall caption. By default create the caption automatically.
Use | |||||||||||||||||||||||||||||

`trace` |
Default is | |||||||||||||||||||||||||||||

`grid.func` |
Function applied to columns of the plotmo(mod, grid.func=mean) grid.func <- function(x, ...) quantile(x)[2] # 25% quantile plotmo(mod, grid.func=grid.func) This argument is ignored for factors. The first level of
factors is used. That can be changed with | |||||||||||||||||||||||||||||

`grid.levels` |
Default is plotmo(mod, grid.levels=list(sex="m", age=21)) | |||||||||||||||||||||||||||||

`extend` |
Amount to extend the horizontal axis in each plot.
The default is | |||||||||||||||||||||||||||||

`ngrid1` |
Number of equally spaced x values in each degree1 plot.
Default is | |||||||||||||||||||||||||||||

`ngrid2` |
Grid size for degree2 plots ( | |||||||||||||||||||||||||||||

`npoints` |
Number of response points to be plotted
(a sample of | |||||||||||||||||||||||||||||

`ndiscrete` |
Default | |||||||||||||||||||||||||||||

`int.only.ok` |
Plot the model even if it is an intercept-only model.
Do this by plotting a single degree1 plot for the first predictor.
| |||||||||||||||||||||||||||||

`center` |
Center the plotted response.
Default is | |||||||||||||||||||||||||||||

`xflip` |
Default | |||||||||||||||||||||||||||||

`yflip` |
Default | |||||||||||||||||||||||||||||

`swapxy` |
Default | |||||||||||||||||||||||||||||

`...` |
Dot arguments are passed to the predict and plot functions.
Dot argument names, whether prefixed or not, should be specified in full
and not abbreviated.
plotmo(mod, s=1) # error: arg matches multiple formal args plotmo(mod, predict.s=1) # ok now: s=1 will be passed to predict() The prefixes recognized by
The For backwards compatibility, some dot arguments are supported but not
explicitly documented. For example, the old argument |

In general this function won't work on models that don't save the call
and data with the model in a standard way.
For further discussion please see “*Accessing the model
data*” in the plotmo vignette.
Package authors may want to look at
Guidelines for S3 Regression Models.

By default, `plotmo`

tries to use sensible model-dependent
defaults when calling `predict`

.
Use `trace=1`

to see the arguments passed to `predict`

.
You can change the defaults by using `plotmo`

's `type`

argument,
and by using dot arguments prefixed with
`predict.`

(see the description of “`...`

” above).

Please see the plotmo vignette.

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) }

[Package *plotmo* version 3.2.1 Index]