Provides a convenient interface for constructing plots to visualize the fit of regression models arising from a wide variety of models in R ('lm', 'glm', 'coxph', 'rlm', 'gam', 'locfit', 'lmer', 'randomForest', etc.)
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:
install.packages("visreg")
devtools
): install_github("pbreheny/visreg")
2.5-0 (2018-02-26)
2.4-1 (2017-06-23)
2.4-0 (2017-06-09)
2.3-0 (2016-07-30)
2.2-2 (2016-02-06)
2.2-1 (2016-01-05)
2.2-0 (2015-04-22)
2.1-1 (2015-02-25)
2.1-0 (2014-11-27)
2.0-6 (2015-08-26)
2.0-5 (2014-05-30)
2.0-4 (2013-10-29)
2.0-3 (2013-09-27)
2.0-2 (2013-08-28)
2.0-1 (2013-08-10)
2.0-0 (2013-05-23)
1.2-1 (2013-02-21)
1.2-0 (2013-01-20)
1.1-1 (2012-11-14)
1.1-0 (2012-09-28)
1.0-0 (2012-05-31)
0.4-0 (2012-02-18)
0.3-0 (2011-12-03)
0.2-0 (2011-08-23)
0.1-0 (2011-07-22)
0.0-3 (2011-07-02)
0.0-2 (2011-06-24)
0.0-1 (2011-06-09)
0.0-0 (2011-05-12)