Description Usage Arguments Examples
Plot out model values
1 2 3 4 |
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 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ## 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.