plot_cme {marginaleffects} | R Documentation |
plot_slopes()
is an alias to plot_slopes()
This alias is kept for backward compatibility.
plot_cme( model, variables = NULL, condition = NULL, by = NULL, newdata = NULL, type = "response", vcov = NULL, conf_level = 0.95, slope = "dydx", rug = FALSE, gray = FALSE, draw = TRUE, ... )
model |
Model object |
condition |
Conditional predictions
|
by |
Marginal predictions
|
newdata |
Grid of predictor values at which we evaluate the slopes.
|
type |
string indicates the type (scale) of the predictions used to
compute contrasts or slopes. 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. |
rug |
TRUE displays tick marks on the axes to mark the distribution of raw data. |
gray |
FALSE grayscale or color plot |
draw |
|
... |
Additional arguments are passed to the |
A ggplot2
object or data frame (if draw=FALSE
)
Some model types allow model-specific arguments to modify the nature of
marginal effects, predictions, marginal means, and contrasts. Please report
other package-specific predict()
arguments on Github so we can add them to
the table below.
https://github.com/vincentarelbundock/marginaleffects/issues
Package | Class | Argument | Documentation |
brms | brmsfit | ndraws | brms::posterior_predict |
re_formula | brms::posterior_predict | ||
lme4 | merMod | re.form | lme4::predict.merMod |
allow.new.levels | lme4::predict.merMod | ||
glmmTMB | glmmTMB | re.form | glmmTMB::predict.glmmTMB |
allow.new.levels | glmmTMB::predict.glmmTMB | ||
zitype | glmmTMB::predict.glmmTMB | ||
mgcv | bam | exclude | mgcv::predict.bam |
robustlmm | rlmerMod | re.form | robustlmm::predict.rlmerMod |
allow.new.levels | robustlmm::predict.rlmerMod | ||
MCMCglmm | MCMCglmm | ndraws | |
mod <- lm(mpg ~ hp + wt, data = mtcars) plot_predictions(mod, condition = "wt") mod <- lm(mpg ~ hp * wt * am, data = mtcars) plot_predictions(mod, condition = c("hp", "wt")) plot_predictions(mod, condition = list("hp", wt = "threenum")) plot_predictions(mod, condition = list("hp", wt = range))