plot_cco | R Documentation |
This function plots contrasts (y-axis) against values of predictor(s) variable(s) (x-axis and colors). This is especially useful in models with interactions, where the values of contrasts depend on the values of "condition" variables.
plot_cco( model, effect = NULL, condition = NULL, type = "response", vcov = NULL, conf_level = 0.95, transform_pre = "difference", transform_post = NULL, draw = TRUE, ... )
model |
Model object |
effect |
Name of the variable whose contrast we want to plot on the y-axis |
condition |
character vector or named list of length smaller than 3. Character vectors must be the names of the predictor variables to display. The names of the list must The first element is displayed on the x-axis. The second element determines the colors. The third element creates facets. Unspecified variables are held at their means or modes. Lists can include these types of values (see Examples section below):
|
type |
string indicates the type (scale) of the predictions used to
compute marginal effects or contrasts. This can differ based on the model
type, but will typically be a string such as: "response", "link", "probs",
or "zero". When an unsupported string is entered, the model-specific list of
acceptable values is returned in an error message. When |
vcov |
Type of uncertainty estimates to report (e.g., for robust standard errors). Acceptable values:
|
conf_level |
numeric value between 0 and 1. Confidence level to use to build a confidence interval. |
transform_pre |
string or function. How should pairs of adjusted predictions be contrasted?
|
transform_post |
string or function. Transformation applied to unit-level estimates and confidence intervals just before the function returns results. Functions must accept a vector and return a vector of the same length. Support string shortcuts: "exp", "ln" |
draw |
|
... |
Additional arguments are passed to the |
A ggplot2
object
Other plot:
plot.marginaleffects()
,
plot_cap()
,
plot_cme()
mod <- lm(mpg ~ hp * drat * factor(am), data = mtcars) plot_cco(mod, effect = "hp", condition = "drat") plot_cco(mod, effect = "hp", condition = c("drat", "am")) plot_cco(mod, effect = "hp", condition = list("am", "drat" = 3:5)) plot_cco(mod, effect = "am", condition = list("hp", "drat" = range))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.