This guide is intended to briefly demonstrate the basic usage of
For details on
visreg syntax and how to use it, see:
The website focuses more on syntax, options, and user interface, while the paper goes into more depth regarding the statistical details.
The basic idea of visreg is that you fit some sort of regression model and visreg provides a convenient interface for visualizing it. Let’s fit the following model:
We can then visualize what the model says about the relationship between the outcome and, say, wind, with:
The plot displays (a) the model’s estimated relationship between wind and ozone, (b) a confidence band about that estimate, and (c) the partial residuals, so that one can assess model fit.
visreg correctly displays factors, transformations, etc., and has many options to produce many types of plots. As another example, suppose the model contains an interaction:
Visreg can plot cross-sections of this fit, either in separate panels:
Or overlaid on top of one another:
Or as a two-dimensional filled contour plot (level plot):
visreg is not limited to linear regression models. It can be used with virtually any type of model in
R that provides generic functions for
predict, such as
randomForest, etc. See the homepage for additional examples with other types of models. If there is a model that you think should work with
visreg but doesn’t, please open an issue.