Visualization of Regression Models Using visreg

Regression models allow one to isolate the relationship between the outcome and an ex planatory variable while the other variables are held constant. Here, we introduce an R package, visreg, for the convenient visualization of this relationship via short, simple function calls. In addition to estimates of this relationship, the package also provides pointwise confidence bands and partial residuals to allow assessment of variability as well as outliers and other deviations from modeling assumptions. The package provides several options for visualizing models with interactions, including lattice plots, contour plots, and both static and interactive perspective plots. The implementation of the package is designed to be fully object-oriented and interface seamlessly with R’s rich collection of model classes, allowing a consistent interface for visualizing not only linear models, but generalized linear models, proportional hazards models, generalized additive models, robust regression models, and many more.

Patrick Breheny , Woodrow Burchett

CRAN packages used

visreg, rms, rockchalk, car, effects, plotmo, lattice, ggplot2, splines, rgl, MASS, mgcv, locfit, randomForest, e1071, gbm, lme4

CRAN Task Views implied by cited packages

SocialSciences, Econometrics, Environmetrics, MachineLearning, Multivariate, Graphics, Psychometrics, Survival, Bayesian, Distributions, SpatioTemporal, Cluster, Finance, NumericalMathematics, OfficialStatistics, Phylogenetics, ReproducibleResearch, Robust


Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".


For attribution, please cite this work as

Breheny & Burchett, "The R Journal: Visualization of Regression Models Using visreg", The R Journal, 2017

BibTeX citation

  author = {Breheny, Patrick and Burchett, Woodrow},
  title = {The R Journal: Visualization of Regression Models Using visreg},
  journal = {The R Journal},
  year = {2017},
  note = {},
  doi = {10.32614/RJ-2017-046},
  volume = {9},
  issue = {2},
  issn = {2073-4859},
  pages = {56-71}