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. For details on `visreg`

syntax and how to use it, please consult the `R`

help files. For details on what `visreg`

does and how it works, refer to the following paper:

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")`

2.3-0 * Added support for multi-response models such multinom, with accompanying visregList() function and collapse option for further control/options. * Added option to use ggplot2 instead of lattice to produce multi-panel plots. * Added quick-start vignette. * Fixed bug in which user options were not being passed to axis() when the horizontal axis was a factor. * Fixed bug in rounding for legend in overlay plots with numeric by variable. * Changed order of plotting so that partial residuals appear on top of lines and therefore cannot be hidden by them. * Reorganized and greatly expanded suite of tests * Added fix for mlm objects with no y names * Added support for glmmADMB models. * Fixed bug that arose for gamm4 models. * Fixed some issues with svm models (package: e1071)

2.2-2 * Fixed bug involvind an incompatibility between formulas with a . and formulas with an s() in them (2.2-1 extended visreg to formulas with a ., but this broke compatibility with formulas with s() and similar terms).

2.2-1 * Changes to NAMESPACE for compatibility with development versions of R * Minor changes to make visreg compatible with 'quantreg' and 'betareg' packages * Improved support for packages that do not provide a residuals() generic * Deviance residuals now used for 'coxph' (survival) models instead of martingale residuals

2.2-0 * Added support for random forests from the 'randomForest' package * Added support for models from the 'rms' package.

2.1-1 * Some bug fixes for contrast plots with lme4 models. * Fixed spline dependency in survival examples. * plot.visreg can now return trellis objects so that you can arrange multiple trellis plots to your liking.

2.1-0 * Major overhaul to visreg's internal structure. visreg now returns simple, structured objects that a user can modify and inspect prior to plotting. * Related to that, visreg() now separated from plot.visreg() * Improved formula parsing so that it now works properly for te() and ti() models (mgcv), pspline models (survival), more complex formulas from lme4, and more (thank you to Andrew Vitale for giving me a good, complex model formula to test against). * Bug fixes with strip.names: now works for factors and shingles for both overlay and lattice plots (thank you to Dan Silver for pointing this out).

2.0-6 * Fixed issue with S4 models not being compatible with as.formula(). visreg now refrains from calling as.formula. Thank you to Nick Livingston for bringing this issue to my attention. * Changed defaults so that rugs are plotted instead of partial residuals when a transformation has been applied.

2.0-5 * Fixed bug arising when passing plot options such as 'xlim' when used in conjunction with lme4 models. Thank you to Vincent Maire for pointing this bug out.

2.0-4 * Added compatibility with models from the 'lme4' package (Thank you to Jack Hogg for pointing out this incompatibility); same limitations regarding error bands as 'lme' models

2.0-3 * Added compatibility with 'lme' models; conditional models still cannot include error bands due to lack of this feature in predict.lme, but the package will produce reasonable plots of means and partial residuals (Thank you to Jason Rohr for pointing out this incompatibility and the bugs below) * Fixed bug in passing 'scales' to latticePlot * Fixed bug when trying to panel by every unique value of 'by' variable * Added option to manually relabel panel strips

2.0-2 * Made compatible with output from the 'survey' package (Thank you to Marco Pomati for pointing this incompatibility out) * Fixed calling of generics to be compatible with changes in R version 3.1. * Fixed bug for mlm models in which users received an incorrect warning about residuals. * Improved generalizability of fillFrame with factors; was incompatible with some instances of predict().

2.0-1 * Bug fix for spline models of variables with '.' in their names * Bug fix for survival models in which the Surv object is created outside the call to visreg * Fixed issue with levels of a factor being dropped from the model (Thank you to Johannes Kutsam for pointing this out) * Scoping issue resolved; can now call visreg, visreg2d from a function without fit or data present in the global environment (Thank you to Johannes Kutsam for pointing this out)

2.0-0 * Added 'overlay' option * Substantial internal refactoring to separate calculations / model manipulations from plotting * Changed how 'breaks' are handled for continuous 'by' variables, both in setup and appearance, with option to directly specify where breaks should occur * Added print.cond option, with warning when user tries to plot a main effect in the presence of interactions * Extrapolation now allowed * Addition of 'rug' option * Addition of 'band' option to suppress confidence bands * Fixed bug for models which were called with 'subset' option * Added 'ask' option to turn off prompting when starting a new page of plots * Minor bug fix for passing of lattice options * Expanded suite of tests

1.2-1 * Fixed bug in calculation of confidence bands for quasilikelihood models (thank you to Ariel Muldoon for pointing this out) * Fixed side-effect which caused trellis settings to be changed when visreg changed them internally

1.2-0 * Fixed bug in 'removeFormulaFormatting'; further compatibility for splines with use of 'cond' * Added support for models from the 'gam' package * Improved support for 'coxph' models from 'survival' package * Fixed bug in use of ns/bs with type='effect'

1.1-1 * Fixed bug in 'removeFormulaFormatting'; old version was incompatible with use of ns() or bs() for splines

1.1-0 * Added support for multiple response (class 'mlm') models * Fixed bug in 'ask' behavior when multiple plots created * Allow finer control of plots with line.par, fill.par, points.par * Fixed bug with formatting names for locfit objects * Fixed bug with visregFactorPanel when partial=FALSE * Changed default for ylabels to las=1 (always horizontal) (Thank you to Doug Bates for this advice)

1.0-0 * Submitted to CRAN * Improved support for effect plots: - extensive revision to implementation - 'x' can now be categorical - interactions/conditioning allowed * Improved support for visreg2d - Interface/options consistent with visreg - Internal refactoring to share code between visreg and visreg2d - Should work now with glm/rlm/gam/etc., although I haven't tested all of these * Fixed bug in 'ask' behavior when multple plots created * Changed default (effect/conditional) for coxph models and fixed bug that occurred for coxph effect plots * Default 'ylim' now depends on 'partial' argument * Removed 'fill' option; always median fill from now on * Patched get_all_vars bug when variables are in environment rather than data frame * Added option to display panel strip names T/F * Added some padding to xlim/ylim for lattice plots * Default for 'ylab' changed: Delta added for effect plot * Improved support for gam/locfit models

0.4-0 * Substantial refactoring of visreg: - new setupCond function to handle setting up of cond when 'by' variables are present - new functions visregPlot and visregLatticePlot to separate work done by the two types of plots ('by' present or absent) - new function getXY for code that visregPlot and visregLatticePlot share * Internal changes to handling of whitespace when 'x' is a factor * Default for 'ylab' changed to always be name of response variable; virtually impossible in the presense of transformations, link functions, etc., to automatically choose an appropriate name * Plotting options now pass to lattice correctly * ylim for lattice plots fixed * xtrans for lattice fixed * Changed manner in which cross-sections are taken when 'by' is numeric; number of observations in each cross-section is now more even

0.3-0 * Reorganized frame construction again, using 'get_all_vars'; now works with missing data and various other strange situations where f(x) is in the model but x isn't * Added 'jitter' option * Improved handling of trellis parameters

0.2-0 * Added by argument to support interactions (still buggy) * visreg() now returns 'x' and 'y' invisibly * Reorganized frame construction, using 'extract.frame' to reduce redundancy * Modified default behavior of CI widths to make compatible with coxph models * Resolved type/type2 conflict in visreg2d with 'plot.type' option * Added 'scale' option for GLMs * Added documentation (not finished)

0.1-0 * Added glm suport * Added factor support in 1d version * Added "terms" option for 2d plots * Added 'cond' option for setting specific predictor variables for both versions (1d and 2d) * The most common instance of each factor is chosen by default if the model includes factors * Fixed bug for transformations for 2d plots * Fixed bug that occurs when model is fit without supplying a data frame (i.e., when all variables are in the global environment) * Fixed bug that occurs when a variable is class 'logical' * Added 'partial' and 'xtrans' options

0.0-3 * Added 'trans' option for transforming response variable, axes still need changing when option is used, the centerFrame function is causing a problem when a transformed variable is used in the model * Changed internal data frame evaluation, allowing the ability to lookup variables in the original data frame when constructing derived variables NOTE: Doing so rendered fillX obsolete and resulted in substantial changes to fillFrame, centerFrame, and setupD NOTE: This issue still causes an error if the variable is located in the global environment instead of the data frame; I see no easy way to resolve this error.

0.0-2 * Added fill='median' option

0.0-1 * Added 'type' option to visreg, allowing both conditional and term plots * Changed default y label in visreg * Added fill='zero' option

0.0-0 * Package infrastructure established * visreg.R, visreg2d.R: Polynomial terms handled correctly