View source: R/bcat_plt_coef.R
| bcat_plt_coef | R Documentation |
Visualize regression coefficients and confidence intervals for one or more
models. Uses broom::tidy() to extract estimates.
bcat_plt_coef(
models,
conf_level = 0.95,
intercept = FALSE,
coef_rename = NULL,
highlight = NULL,
dodge_width = 0.4,
x_lab = "Estimate",
y_lab = ggplot2::waiver(),
title = ggplot2::waiver(),
subtitle = ggplot2::waiver(),
caption = ggplot2::waiver(),
legend_lab = "Model",
legend_position = "bottom",
legend_hide = FALSE,
color_scale = scale_colour_UC()
)
models |
A model object or a named list of model objects. |
conf_level |
Numeric. Confidence level. Default is 0.95. |
intercept |
Logical. Include intercept? Default is FALSE. |
coef_rename |
Named character vector to rename coefficients. If NULL (default), auto-cleans names to Title Case. |
highlight |
Character vector of term names to highlight in UC Red. |
dodge_width |
Numeric. Dodge width for multi-model comparison. Default is 0.4. |
x_lab |
Label for x-axis (coefficient values). |
y_lab |
Label for y-axis (term names). |
title |
Plot title. |
subtitle |
Plot subtitle. |
caption |
Plot caption. |
legend_lab |
Legend title. |
legend_position |
Legend position. |
legend_hide |
Logical. Hide legend? |
color_scale |
|
A ggplot object.
Saannidhya Rawat
Other plots:
bcat_plt_area(),
bcat_plt_bar(),
bcat_plt_box(),
bcat_plt_diag(),
bcat_plt_hist(),
bcat_plt_line(),
bcat_plt_point(),
bcat_plt_ts()
library(ggplot2)
m <- lm(mpg ~ wt + hp + cyl, data = mtcars)
bcat_plt_coef(m)
m1 <- lm(mpg ~ wt + hp, data = mtcars)
m2 <- lm(mpg ~ wt + hp + cyl + disp, data = mtcars)
bcat_plt_coef(list("Base" = m1, "Full" = m2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.