plot_summs and plot_coefs create regression coefficient plots with ggplot2.

plot_summs(..., ci_level = 0.95, model.names = NULL, coefs = NULL,
omit.coefs = "(Intercept)", inner_ci_level = NULL,
colors = "CUD Bright", plot.distributions = FALSE,
rescale.distributions = FALSE, exp = FALSE, point.shape = TRUE,
legend.title = "Model", groups = NULL, facet.rows = NULL,
facet.cols = NULL, facet.label.pos = "top", color.class = colors)

plot_coefs(..., ci_level = 0.95, inner_ci_level = NULL,
model.names = NULL, coefs = NULL, omit.coefs = c("(Intercept)",
"Intercept"), colors = "CUD Bright", plot.distributions = FALSE,
rescale.distributions = FALSE, exp = FALSE, point.shape = TRUE,
legend.title = "Model", groups = NULL, facet.rows = NULL,
facet.cols = NULL, facet.label.pos = "top", color.class = colors)

## Arguments

... regression model(s). The desired width of confidence intervals for the coefficients. Default: 0.95 If plotting multiple models simultaneously, you can provide a vector of names here. If NULL, they will be named sequentially as "Model 1", "Model 2", and so on. Default: NULL If you'd like to include only certain coefficients, provide them as a vector. If it is a named vector, then the names will be used in place of the variable names. See details for examples. Default: NULL If you'd like to specify some coefficients to not include in the plot, provide them as a vector. This argument is overridden by coefs if both are provided. By default, the intercept term is omitted. To include the intercept term, just set omit.coefs to NULL. Plot a thicker line representing some narrower span than ci_level. Default is NULL, but good options are .9, .8, or .5. See jtools_colors for more on your color options. Default: 'CUD Bright' Instead of just plotting the ranges, you may plot normal distributions representing the width of each estimate. Note that these are completely theoretical and not based on a bootstrapping or MCMC procedure, even if the source model was fit that way. Default is FALSE. If plot.distributions is TRUE, the default behavior is to plot each normal density curve on the same scale. If some of the uncertainty intervals are much wider/narrower than others, that means the wide ones will have such a low height that you won't be able to see the curve. If you set this parameter to TRUE, each curve will have the same maximum height regardless of their width. If TRUE, all coefficients are exponentiated (e.g., transforms logit coefficents from log odds scale to odds). The reference line is also moved to 1 instead of 0. When using multiple models, should each model's point estimates use a different point shape to visually differentiate each model from the others? Default is TRUE. What should the title for the legend be? Default is "Model", but you can specify it here since it is rather difficult to change later via ggplot2's typical methods. If you would like to have facets (i.e., separate panes) for different groups of coefficients, you can specify those groups with a list here. See details for more on how to do this. The number of rows in the facet grid (the nrow argument to ggplot2::facet_wrap()). The number of columns in the facet grid (the nrow argument to ggplot2::facet_wrap()). Where to put the facet labels. One of "top" (the default), "bottom", "left", or "right". Deprecated. Now known as colors.

A ggplot object.

## Details

A note on the distinction between plot_summs and plot_coefs: plot_summs only accepts models supported by summ() and allows users to take advantage of the standardization and robust standard error features (among others as may be relevant). plot_coefs supports any models that have a broom::tidy() method defined in the broom package, but of course lacks any additional features like robust standard errors. To get a mix of the two, you can pass summ objects to plot_coefs too.

For coefs, if you provide a named vector of coefficients, then the plot will refer to the selected coefficients by the names of the vector rather than the coefficient names. For instance, if I want to include only the coefficients for the hp and mpg but have the plot refer to them as "Horsepower" and "Miles/gallon", I'd provide the argument like this: c("Horsepower" = "hp", "Miles/gallon" = "mpg")

To use the groups argument, provide a (preferably named) list of character vectors. If I want separate panes with "Frost" and "Illiteracy" in one and "Population" and "Area" in the other, I'd make a list like this:

list(pane_1 = c("Frost", "Illiteracy"), pane_2 = c("Population", "Area"))

## Examples

states <- as.data.frame(state.x77)
fit1 <- lm(Income ~ Frost + Illiteracy + Murder +
Population + Area + Life Exp + HS Grad,
data = states, weights = runif(50, 0.1, 3))
fit2 <- lm(Income ~ Frost + Illiteracy + Murder +
Population + Area + Life Exp + HS Grad,
data = states, weights = runif(50, 0.1, 3))
fit3 <- lm(Income ~ Frost + Illiteracy + Murder +
Population + Area + Life Exp + HS Grad,
data = states, weights = runif(50, 0.1, 3))

# Plot all 3 regressions with custom predictor labels,
# standardized coefficients, and robust standard errors
plot_summs(fit1, fit2, fit3,
coefs = c("Frost Days" = "Frost", "% Illiterate" = "Illiteracy",
"Murder Rate" = "Murder"),
scale = TRUE, robust = TRUE)