plot_model()
creates plots from regression models, either
estimates (as socalled forest or dot whisker plots) or marginal effects.
plot_model(
model,
type = c("est", "re", "eff", "emm", "pred", "int", "std", "std2", "slope", "resid",
"diag"),
transform,
terms = NULL,
sort.est = NULL,
rm.terms = NULL,
group.terms = NULL,
order.terms = NULL,
pred.type = c("fe", "re"),
mdrt.values = c("minmax", "meansd", "zeromax", "quart", "all"),
ri.nr = NULL,
title = NULL,
axis.title = NULL,
axis.labels = NULL,
legend.title = NULL,
wrap.title = 50,
wrap.labels = 25,
axis.lim = NULL,
grid.breaks = NULL,
ci.lvl = NULL,
se = NULL,
robust = FALSE,
vcov.fun = NULL,
vcov.type = c("HC3", "const", "HC", "HC0", "HC1", "HC2", "HC4", "HC4m", "HC5"),
vcov.args = NULL,
colors = "Set1",
show.intercept = FALSE,
show.values = FALSE,
show.p = TRUE,
show.data = FALSE,
show.legend = TRUE,
show.zeroinf = TRUE,
value.offset = NULL,
value.size,
jitter = NULL,
digits = 2,
dot.size = NULL,
line.size = NULL,
vline.color = NULL,
p.threshold = c(0.05, 0.01, 0.001),
p.adjust = NULL,
grid,
case,
auto.label = TRUE,
prefix.labels = c("none", "varname", "label"),
bpe = "median",
bpe.style = "line",
bpe.color = "white",
ci.style = c("whisker", "bar"),
...
)
get_model_data(
model,
type = c("est", "re", "eff", "pred", "int", "std", "std2", "slope", "resid", "diag"),
transform,
terms = NULL,
sort.est = NULL,
rm.terms = NULL,
group.terms = NULL,
order.terms = NULL,
pred.type = c("fe", "re"),
ri.nr = NULL,
ci.lvl = NULL,
colors = "Set1",
grid,
case = "parsed",
digits = 2,
...
)
model  A regression model object. Depending on the 

type  Type of plot. There are three groups of plottypes:
Marginal Effects (related vignette)
Model diagnostics
Note: For mixed models, the diagnostic plots like linear relationship or check for Homoscedasticity, do not take the uncertainty of random effects into account, but is only based on the fixed effects part of the model. 
transform  A character vector, naming a function that will be applied
on estimates and confidence intervals. By default, 
terms  Character vector with the names of those terms from

sort.est  Determines in which way estimates are sorted in the plot:

rm.terms  Character vector with names that indicate which terms should
be removed from the plot. Counterpart to 
group.terms  Numeric vector with group indices, to group coefficients. Each group of coefficients gets its own color (see 'Examples'). 
order.terms  Numeric vector, indicating in which order the coefficients should be plotted. See examples in this packagevignette. 
pred.type  Character, only applies for Marginal Effects plots
with mixed effects models. Indicates whether predicted values should be
conditioned on random effects ( 
mdrt.values  Indicates which values of the moderator variable should be
used when plotting interaction terms (i.e.

ri.nr  Numeric vector. If 
title  Character vector, used as plot title. By default,

axis.title  Character vector of length one or two (depending on the
plot function and type), used as title(s) for the x and y axis. If not
specified, a default labelling is chosen. Note: Some plot types
may not support this argument sufficiently. In such cases, use the returned
ggplotobject and add axis titles manually with

axis.labels  Character vector with labels for the model terms, used as
axis labels. By default, 
legend.title  Character vector, used as legend title for plots that have a legend. 
wrap.title  Numeric, determines how many chars of the plot title are displayed in one line and when a line break is inserted. 
wrap.labels  Numeric, determines how many chars of the value, variable or axis labels are displayed in one line and when a line break is inserted. 
axis.lim  Numeric vector of length 2, defining the range of the plot
axis. Depending on plottype, may effect either x or yaxis. For
Marginal Effects plots, 
grid.breaks  Numeric value or vector; if 
ci.lvl  Numeric, the level of the confidence intervals (error bars).
Use 
se  Logical, if 
robust  Logical, shortcut for arguments 
vcov.fun  Character vector, indicating the name of the 
vcov.type  Character vector, specifying the estimation type for the
robust covariance matrix estimation (see 
vcov.args  List of named vectors, used as additional arguments that
are passed down to 
colors  May be a character vector of color values in hexformat, valid
color value names (see

show.intercept  Logical, if 
show.values  Logical, whether values should be plotted or not. 
show.p  Logical, adds asterisks that indicate the significance level of estimates to the value labels. 
show.data  Logical, for Marginal Effects plots, also plots the raw data points. 
show.legend  For Marginal Effects plots, shows or hides the legend. 
show.zeroinf  Logical, if 
value.offset  Numeric, offset for text labels to adjust their position relative to the dots or lines. 
value.size  Numeric, indicates the size of value labels. Can be used
for all plot types where the argument 
jitter  Numeric, between 0 and 1. If 
digits  Numeric, amount of digits after decimal point when rounding estimates or values. 
dot.size  Numeric, size of the dots that indicate the point estimates. 
line.size  Numeric, size of the lines that indicate the error bars. 
vline.color  Color of the vertical "zero effect" line. Default color is inherited from the current theme. 
p.threshold  Numeric vector of length 3, indicating the treshold for
annotating pvalues with asterisks. Only applies if

p.adjust  Character vector, if not 
grid  Logical, if 
case  Desired target case. Labels will automatically converted into the
specified character case. See 
auto.label  Logical, if 
prefix.labels  Indicates whether the value labels of categorical variables
should be prefixed, e.g. with the variable name or variable label. See
argument 
bpe  For Stanmodels (fitted with the rstanarm or
brmspackage), the Bayesian point estimate is, by default, the median
of the posterior distribution. Use 
bpe.style  For Stanmodels (fitted with the rstanarm or
brmspackage), the Bayesian point estimate is indicated as a small,
vertical line by default. Use 
bpe.color  Character vector, indicating the color of the Bayesian
point estimate. Setting 
ci.style  Character vector, defining whether inner and outer intervals
for Bayesion models are shown in boxplotstyle ( 
...  Other arguments, passed down to various functions. Here is a list of supported arguments and their description in detail.

Depending on the plottype, plot_model()
returns a
ggplot
object or a list of such objects. get_model_data
returns the associated data with the plotobject as tidy data frame, or
(depending on the plottype) a list of such data frames.
type = "std"
Plots standardized estimates. See details below.
type = "std2"
Plots standardized estimates, however, standardization follows Gelman's (2008) suggestion, rescaling the estimates by dividing them by two standard deviations instead of just one. Resulting coefficients are then directly comparable for untransformed binary predictors.
type = "pred"
Plots estimated marginal means (or marginal effects).
Simply wraps ggpredict
. See also
this packagevignette.
type = "eff"
Plots estimated marginal means (or marginal effects).
Simply wraps ggeffect
. See also
this packagevignette.
type = "int"
A shortcut for marginal effects plots, where
interaction terms are automatically detected and used as
terms
argument. Furthermore, if the moderator variable (the second
 and third  term in an interaction) is continuous, type = "int"
automatically chooses useful values based on the mdrt.values
argument,
which are passed to terms
. Then, ggpredict
is called. type = "int"
plots the interaction term that appears
first in the formula along the xaxis, while the second (and possibly
third) variable in an interaction is used as grouping factor(s)
(moderating variable). Use type = "pred"
or type = "eff"
and specify a certain order in the terms
argument to indicate
which variable(s) should be used as moderator. See also
this packagevignette.
type = "slope"
and type = "resid"
Simple diagnosticplots, where a linear model for each single predictor is plotted against the response variable, or the model's residuals. Additionally, a loesssmoothed line is added to the plot. The main purpose of these plots is to check whether the relationship between outcome (or residuals) and a predictor is roughly linear or not. Since the plots are based on a simple linear regression with only one model predictor at the moment, the slopes (i.e. coefficients) may differ from the coefficients of the complete model.
type = "diag"
For Stanmodels, plots the prior versus posterior samples. For linear (mixed) models, plots for multicollinearitycheck (Variance Inflation Factors), QQplots, checks for normal distribution of residuals and homoscedasticity (constant variance of residuals) are shown. For generalized linear mixed models, returns the QQplot for random effects.
Default standardization is done by completely refitting the model on the
standardized data. Hence, this approach is equal to standardizing the
variables before fitting the model, which is particularly recommended for
complex models that include interactions or transformations (e.g., polynomial
or spline terms). When type = "std2"
, standardization of estimates
follows Gelman's (2008)
suggestion, rescaling the estimates by dividing them by two standard deviations
instead of just one. Resulting coefficients are then directly comparable for
untransformed binary predictors.
Gelman A (2008) "Scaling regression inputs by dividing by two
standard deviations." Statistics in Medicine 27: 28652873.
http://www.stat.columbia.edu/~gelman/research/published/standardizing7.pdf
Aiken and West (1991). Multiple Regression: Testing and Interpreting Interactions.