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, ... )
Name of the variable whose contrast we want to plot on the y-axis
String or vector of two strings. The first is a variable name to be displayed on the x-axis. The second is a variable whose values will be displayed in different colors. Other numeric variables are held at their means. Other categorical variables are held at their modes.
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.
Type of uncertainty estimates to report (e.g., for robust standard errors). Acceptable values:
FALSE: Do not compute standard errors. This can speed up computation considerably.
TRUE: Unit-level standard errors using the default
vcov(model) variance-covariance matrix.
String which indicates the kind of uncertainty estimates to return.
Heteroskedasticity and autocorrelation consistent:
Mixed-Models degrees of freedom: "satterthwaite", "kenward-roger"
"OPG". See the
sandwich package documentation.
One-sided formula which indicates the name of cluster variables (e.g.,
~unit_id). This formula is passed to the
cluster argument of the
Square covariance matrix
Function which returns a covariance matrix (e.g.,
numeric value between 0 and 1. Confidence level to use to build a confidence interval.
string or function. How should pairs of adjusted predictions be contrasted?
string: shortcuts to common contrast functions.
Supported shortcuts strings: difference, differenceavg, dydx, eyex, eydx, dyex, dydxavg, eyexavg, eydxavg, dyexavg, ratio, ratioavg, lnratio, lnratioavg, lnor, lnoravg, expdydx, expdydxavg
See the Transformations section below for definitions of each transformation.
function: accept two equal-length numeric vectors of adjusted predictions (
lo) and returns a vector of contrasts of the same length, or a unique numeric value.
See the Transformations section below for examples of valid functions.
(experimental) A function applied to unit-level estimates and confidence intervals just before the function returns results.
TRUE returns a
FALSE returns a
data.frame of the underlying data.
Additional arguments are passed to the
supplied by the modeling package.These arguments are particularly useful
for mixed-effects or bayesian models (see the online vignettes on the
marginaleffects website). Available arguments can vary from model to
model, depending on the range of supported arguments by each modeling
package. See the "Model-Specific Arguments" section of the
?marginaleffects documentation for a non-exhaustive list of available