model_plot {LSTbook}R Documentation

Graph a model function

Description

Every model has an implicit function whose output is the response variable and which has one or more explanatory variables. (Exceptionally, there might be no explanatory variables as in response ~ 1.) One of the explanatory variables can be mapped to the horizontal axis; this can be either quantitative or categorical. The remaining explanatory variables will be mapped to color, facet-horizontal, and facet-vertical. For visual clarity, any quantitative variables among these remaining variables must be coerced to categorical, corresponding to a discrete set of colors and a discrete set of facets.

Usage

model_plot(
  mod,
  nlevels = 3,
  interval = c("confidence", "prediction", "none"),
  level = 0.95,
  palette = LETTERS[1:8],
  model_ink = 0.7
)

Arguments

mod

A model object, made with model_train(), lm(), or glm()

nlevels

Integer. When quantitative variables need to be converted to factors for color or facetting, how many levels in those factors.

interval

The type of interval to draw (default: confidence)

level

The confidence or prediction level for the interval

palette

One of "A" through "F" giving some control for people who don't like or can't see the default palette

model_ink

The density of ink used to draw the model. ("alpha" for those in the know.)

Value

A ggplot graphics object


[Package LSTbook version 0.5.0 Index]