mod_plot {mosaicModel} | R Documentation |
Plot out model values
Description
Plot out model values
Usage
mod_plot(model = NULL, formula = NULL, data = NULL, bootstrap = 0,
nlevels = 3, at = list(), class_level = NULL, interval = c("none",
"confidence", "prediction"), post_transform = NULL, size = 1,
alpha = 0.8, ...)
Arguments
model |
the model to display graphically.
Can also be an ensemble produced with |
formula |
setting the y ~ x + color variables |
data |
optional data set from which to extract levels for explanatory variables |
bootstrap |
when > 1, this will generate bootstrap replications of the model
and plot all of them. Use as an alternative to |
nlevels |
how many levels to display for those variables shown at discrete levels |
at |
named list giving specific values at which to hold the variables. You can accomplish
this without forming a list by using |
class_level |
character string. If a probability for a classifier is being shown, which levels of the response variable to use in the plot. (Default: the first one.) |
interval |
show confidence or prediction intervals: values "none", "confidence", "prediction" |
post_transform |
a scalar transformation and new name for the response variable,
e.g. |
size |
numerical value for line width (default: 1) |
alpha |
numerical value in 0 to 1 for transparency (default: 0.8) |
... |
specific values for explantory variables |
Examples
## Not run:
mod1 <- lm(wage ~ age * sex + sector, data = mosaicData::CPS85)
mod_plot(mod1)
mod_plot(mod1, n = Inf, interval = "confidence")
mod_plot(mod1, ~ sector + sex + age) # not necessarily a good ordering
mod_plot(mod1, ~ age + sex + sector, nlevels = 8)
mod2 <- lm(log(wage) ~ age + sex + sector, data = mosaicData::CPS85)
mod_plot(mod2, post_transform = c(wage = exp),
interval = "confidence") # undo the log in the display
mod3 <- glm(married == "Married" ~ age + sex * sector,
data = mosaicData::CPS85, family = "binomial")
mod_plot(mod3)
E3 <- mod_ensemble(mod3, 10)
mod_plot(E3)
mod4 <- rpart::rpart(sector ~ age + sex + married, data = mosaicData::CPS85)
mod_plot(mod4)
mod_plot(mod4, class_level = "manag")
mod5 <- randomForest::randomForest(
sector ~ age + sex + married, data = mosaicData::CPS85)
mod_plot(mod5)
mod_plot(mod5, class_level = "manag")
## End(Not run)