-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.Rmd
90 lines (63 loc) · 2.33 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
# condvis2
The goal of condvis2 is to visualise prediction models via shiny.
Predictions are generated from one or more model fits.
Low-dimensional visualisations are constructed showing the relationship between the response
and one or two (section) predictors, conditional on the remaining predictors. The section predictors
and conditioning values are selected within the shiny app.
## Installation
You can install condvis2 from github with:
```{r gh-installation, eval = FALSE}
# install.packages("devtools")
devtools::install_github("cbhurley/condvis2")
```
## Example 1: A prediction model
This is a basic condvis example.
We will use the airquality data built in to R.
```{r}
ozone <- na.omit(airquality)
```
```{r eval=F}
fit <- loess(Ozone~Wind+Solar.R+Temp, data=ozone)
condvis(ozone, fit, sectionvars="Wind", conditionvars=c("Solar.R", "Temp"))
```
The result is shown in the screenshot below.
It shows the loess prediction for Wind, conditional on values of the other two
predictors.
Only observations whose Solar.R and Temp values are near (207,79) are shown.
The user can move around the pink cross to see how the prediction varies.
```{r echo=FALSE, out.width='100%'}
knitr::include_graphics('vignettes/ozone1.png')
```
Check out the vignette `Introduction to condvis2` for more information and details.
## Example 2: A density estimate
```{r eval=F}
library(ks)
data(iris)
irisf <- kde(x=iris[,1:3])
condvis(data = iris, model = list(kde=irisf),
sectionvars= c("Sepal.Length", "Sepal.Width"),
conditionvars= "Petal.Length", density=T)
```
The result is shown in the screenshot below. It shows the estimated density of two
variables conditional on the third.
```{r echo=FALSE, out.width='100%'}
knitr::include_graphics('vignettes/iris.png')
```
## References
Catherine B. Hurley, Mark O'Connell, Katarina Domijan. (2021)
Interactive slice visualization for exploring machine learning models.
arXiv 2101.06986.
Mark O'Connell, Catherine Hurley, Katarina Domijan. (2017)
Conditional Visualization for Statistical Models: An Introduction to the condvis Package in R.
Journal of Statistical Software 81(5) 1--20.