- Introduction
- Overview
- Using the package
- Related work
- Summary and outlook
2018-05-28
Package allows interactively visualising sections through data space, showing fitted models and observed data
Built on base R graphics, with option to use Shiny
Works for models: lm, glm, gam, svm, randomForest, …
| age | fev | height | male | smoke |
|---|---|---|---|---|
| 9 | 1.708 | 57.0 | 0 | 0 |
| 8 | 1.724 | 67.5 | 0 | 0 |
| 7 | 1.720 | 54.5 | 0 | 0 |
| 9 | 1.558 | 53.0 | 1 | 0 |
| 9 | 1.895 | 57.0 | 1 | 0 |
| 8 | 2.336 | 61.0 | 0 | 0 |
m1 <- svm(fev ~ gender + smoke + age + height, data = fev) ceplot(data = fev, model = m1, sectionvars = "smoke", type = "separate")
m2 <- lm(mpg ~ wt + hp, data = mtcars) ceplot(data = mtcars, model = m2, sectionvars = "hp")
mtcars$cyl <- as.factor(mtcars$cyl)
m3 <- lm(mpg ~ wt + hp + disp, data = mtcars)
ceplot(data = mtcars, model = m3,
sectionvars = c("wt","cyl"), type = "shiny")
下圖只有在type = "separate" 才能呈現
m4 <- lm(mpg ~ wt + hp + disp + carb + cyl + vs, data = mtcars)
ceplot(data = mtcars, model = m4, conditionvars = c("wt","cyl","disp"),
selectortype = "full" ,type = "separate")
輸入selectortype = "full",一樣只有在separate模式才會出現
m4 <- lm(mpg ~ wt + hp + disp + carb + cyl + vs, data = mtcars)
ceplot(data = mtcars, model = m4, conditionvars = c("wt","cyl","disp"),
selectortype = "full" ,type = "separate")
\[d(x_i,x_j)=\parallel x_i-x_j \parallel_p+\lambda M(x_i,x_j)\]
Minkowski distance: \[\parallel x_i-x_j \parallel_p\]
The number of mismatches on the categorical elements:\[M(x_i,x_j)\]
library("randomForest"); library("mgcv"); library("covreg")
m3 <- list(RF = randomForest(fev ~ ., data = fev),
lm = lm(fev ~ ., data = fev),
gam = mgcv::gam(fev ~ smoke + gender + age + height, data=fev))
ceplot(data = fev, model = m3, sectionvars = "smoke",type="default")
library("e1071"); library("mgcv")
m4 <- list(svm = svm(PE ~ ., data = powerplant),
gam = gam(PE ~ AT + V + AP + RH, data = powerplant))
ceplot(data = powerplant, model = m4["svm"], sectionvars = "AT",
type = "separate")
ceplot(data = powerplant, model = m4, sectionvars = "AT", type = "separate", threshold = 0.5)
ceplot(data = powerplant, model = m4["svm"], sectionvars = c("AT", "V"),
type = "separate", view3d = TRUE, threshold = 0.2)
library("randomForest")
data("wine", package = "condvis")
wine$Class <- as.factor(wine$Class)
m5 <- randomForest(Class ~ Alcohol + Malic + Ash + Magnesium +
Phenols + Flavanoids, data = wine)
ceplot(data = wine, model = m5, sectionvars = c("Alcohol", "Phenols"),
type = "shiny")
ceplot(data = wine, model = m5, sectionvars = c("Alcohol", "Phenols"),
type = "separate", selectortype = "pcp", threshold = 2)
-Literature: Trellis graphics,Partial residual plots,ICE plots
-R:Conditional visualization(lattice,visreg,gam,mgcv..) Interactive graphics:ipolts,ggvis,condvfis…
-Contribution:more flexible,interactive approach to conditioning.
-The condvis package allows the user to interactively take 2-D and 3-D sections in data space and visualize fitted models where they intersect the section.
-The strength of condvis lies in creating low-dimensional visualizations of fitted models in highdimensional space.
-This method also does not suit situations where categorical predictors have more than 4 or 5 levels