Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pbreheny/visreg
Visualization of regression functions
https://github.com/pbreheny/visreg
Last synced: about 1 month ago
JSON representation
Visualization of regression functions
- Host: GitHub
- URL: https://github.com/pbreheny/visreg
- Owner: pbreheny
- Created: 2012-08-13T15:20:12.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2024-06-01T16:08:54.000Z (7 months ago)
- Last Synced: 2024-09-21T14:14:08.546Z (3 months ago)
- Language: R
- Homepage: http://pbreheny.github.io/visreg/
- Size: 6.35 MB
- Stars: 62
- Watchers: 4
- Forks: 18
- Open Issues: 30
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![GitHub version](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pbreheny/visreg/master/.version.json&style=flat&logo=github)](https://github.com/pbreheny/visreg)
[![CRAN version](https://img.shields.io/cran/v/visreg?logo=R)](https://cran.r-project.org/package=visreg)
[![downloads](http://cranlogs.r-pkg.org/badges/visreg)](https://cran.r-project.org/package=visreg)
[![R-CMD-check](https://github.com/pbreheny/visreg/workflows/R-CMD-check/badge.svg)](https://github.com/pbreheny/visreg/actions)
[![codecov.io](https://codecov.io/github/pbreheny/visreg/coverage.svg?branch=master)](https://app.codecov.io/gh/pbreheny/visreg)# visreg: Visualization of Regression Models
**visreg** is an R package for displaying the results of a fitted model in terms of how a predictor variable `x` affects an outcome `y`. The implementation of **visreg** takes advantage of object-oriented programming in R, meaning that it works with virtually any type of formula-based model in R provided that the model class provides a `predict()` method: `lm`, `glm`, `gam`, `rlm`, `nlme`, `lmer`, `coxph`, `svm`, `randomForest` and many more.
## Installation
To install the latest release version from CRAN:
```r
install.packages("visreg")
```To install the latest development version from GitHub:
```r
remotes::install_github("pbreheny/visreg")
```## Usage
The basic usage is that you fit a model, for example:
```r
fit <- lm(Ozone ~ Solar.R + Wind + Temp, data=airquality)
```and then you pass it to `visreg`:
```r
visreg(fit, "Wind")
```
A more complex example, which uses the `gam()` function from **mgcv**:
```r
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")
```
## More information
For more information on **visreg** syntax and how to use it, see:
* The online documentation at contains many examples of visreg plots and the code to create them.
* [Breheny P and Burchett W (2017). Visualization of Regression Models Using visreg. *The R Journal*, 9: 56-71.](https://journal.r-project.org/archive/2017/RJ-2017-046/index.html)The website focuses more on syntax, options, and user interface, while the paper goes into more depth regarding the statistical details.