A generic plotmethod for ggeffects
objects.
# S3 method for ggeffects plot( x, ci = TRUE, ci.style = c("ribbon", "errorbar", "dash", "dot"), facets, add.data = FALSE, limit.range = FALSE, residuals = FALSE, residuals.line = FALSE, colors = "Set1", alpha = 0.15, dodge = 0.25, use.theme = TRUE, dot.alpha = 0.35, jitter = 0.2, log.y = FALSE, case = NULL, show.legend = TRUE, show.title = TRUE, show.x.title = TRUE, show.y.title = TRUE, dot.size = NULL, line.size = NULL, connect.lines = FALSE, grid, one.plot = TRUE, rawdata, residuals.type, ... ) theme_ggeffects(base_size = 11, base_family = "") show_pals()
x  An object of class 

ci  Logical, if 
ci.style  Character vector, indicating the style of the confidence
bands. May be either 
facets, grid  Logical, defaults to 
add.data, rawdata  Logical, if 
limit.range  Logical, if 
residuals  Logical, if 
residuals.line  Logical, if 
colors  Character vector with color values in hexformat, valid
color value names (see

alpha  Alpha value for the confidence bands. 
dodge  Value for offsetting or shifting error bars, to avoid overlapping.
Only applies, if a factor is plotted at the xaxis (in such cases, the
confidence bands are replaced by error bars automatically), or if

use.theme  Logical, if 
dot.alpha  Alpha value for data points, when 
jitter  Numeric, between 0 and 1. If not 
log.y  Logical, if 
case  Desired target case. Labels will automatically converted into the
specified character case. See 
show.legend  Logical, shows or hides the plot legend. 
show.title  Logical, shows or hides the plot title 
show.x.title  Logical, shows or hides the plot title for the xaxis. 
show.y.title  Logical, shows or hides the plot title for the yaxis. 
dot.size  Numeric, size of the point geoms. 
line.size  Numeric, size of the line geoms. 
connect.lines  Logical, if 
one.plot  Logical, if 
residuals.type  Deprecated. Formally was the residual type. Now is always 
...  Further arguments passed down to 
base_size  Base font size. 
base_family  Base font family. 
A ggplot2object.
For proportional odds logistic regression (see ?MASS::polr
)
or cumulative link models in general, plots are automatically facetted
by response.level
, which indicates the grouping of predictions
based on the level of the model's response.
Load library(ggplot2)
and use theme_set(theme_ggeffects())
to set the ggeffectstheme as default plotting theme. You can then use
further plotmodifiers from sjPlot, like legend_style()
or
font_size()
without losing the thememodifications.
There are predefined colour palettes in this package. Use
show_pals()
to show all available colour palettes.
For generalized linear models (glms), residualized scores are
computed as inv.link(link(Y) + r)
where Y
are the predicted
values on the response scale, and r
are the working residuals.
For (generalized) linear mixed models, the random effect are also
partialled out.
library(sjlabelled) data(efc) efc$c172code < as_label(efc$c172code) fit < lm(barthtot ~ c12hour + neg_c_7 + c161sex + c172code, data = efc) dat < ggpredict(fit, terms = "c12hour") plot(dat)# \donttest{ # facet by group, use predefined color palette dat < ggpredict(fit, terms = c("c12hour", "c172code")) plot(dat, facet = TRUE, colors = "hero")# don't use facets, b/w figure, w/o confidence bands dat < ggpredict(fit, terms = c("c12hour", "c172code")) plot(dat, colors = "bw", ci = FALSE)# factor at x axis, plot exact data points and error bars dat < ggpredict(fit, terms = c("c172code", "c161sex")) plot(dat)# for three variables, automatic facetting dat < ggpredict(fit, terms = c("c12hour", "c172code", "c161sex")) plot(dat)# }# show all color palettes show_pals()