Learn R Programming

⚠️There's a newer version (2.7.0) of this package.Take me there.

Visualization of Regression Models

visreg provides a number of plotting functions for visualizing fitted regression models: regression functions, confidence bands, partial residuals, interactions, and more. visreg is compatible with virtually all formula-based models in R that provide a predict method: lm, glm, gam, rlm, nlme, lmer, coxph, svm, randomForest and many more.

The basic usage is that you fit a model, for example:

fit <- lm(Ozone ~ Solar.R + Wind + Temp, data=airquality)

and then you pass it to visreg:

visreg(fit, "Wind")

A more complex example, using the mgcv package:

airquality$Heat <- cut(airquality$Temp, 3, labels=c("Cool", "Mild", "Hot"))
fit <- gam(Ozone ~ s(Wind, by=Heat, sp=0.1), data=airquality)
visreg(fit, "Wind", "Heat", gg=TRUE, ylab="Ozone")

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.

If you have a question or feature request, please submit an issue.

To install:

  • the latest released version: install.packages("visreg")
  • the latest version (requires devtools): install_github("pbreheny/visreg")

Copy Link

Version

Install

install.packages('visreg')

Monthly Downloads

3,569

Version

2.6.1

License

GPL-3

Maintainer

Patrick Breheny

Last Published

March 13th, 2020

Functions in visreg (2.6.1)

visreg

Visualization of regression functions
visreg-faq

Frequently Asked Questions for visreg
plot.visreg2d

Visualization of regression functions for two variables
visreg-package

Visualization of regression models
visregList

Join multiple visreg objects together in a list
subset.visreg

Subset a visreg object
visreg2d

Visualization of regression functions for two variables
plot.visreg

Visualization of regression functions