| plot_coef_ci | R Documentation |
Plotting point estimates with confidence intervals from regression results
plot_coef_ci(
point_estimates,
confint_lower,
confint_upper,
coef_names,
p = NULL,
estimate_colors = NULL,
confint_colors = NULL,
auto_color = FALSE,
alpha = 0.05,
set_estimate_colors = c("red", "grey", "green"),
set_confint_colors = c("#ffcccb", "lightgray", "#CCFFCC"),
skipvars = NULL,
plot.xlab = "Independent variables",
plot.main = "Point estimates with CI",
axis.at = seq(-30, 40, by = 5),
pch = 15,
cex = 2,
lwd = 5,
y.cex = 0.8
)
point_estimates |
|
confint_lower |
|
confint_upper |
|
coef_names |
|
p |
|
estimate_colors |
vector containing colors for the point estimates (optional) |
confint_colors |
vector containing colors for the confidence intervals (optional) |
auto_color |
|
alpha |
Significance level |
set_estimate_colors |
Colors for point estimates (significant negative, not significant, significant positive) |
set_confint_colors |
Colors for confidence intervals (significant negative, not significant, significant positive) |
skipvars |
List with coefficients to be dropped |
plot.xlab |
Label of x axis |
plot.main |
Plot title |
axis.at |
Position of y axis |
pch |
Point type |
cex |
Point size |
lwd |
Line width (confidence intervals) |
y.cex |
Font size of y axis |
The function checks whether the input vectors have the same length. If auto_color is TRUE, the colors from set_estimate_colors and set_confint_colors are used, and the significance level is determined based on the coefficient and confidence interval values (all three below 0 = significant negative, all three above 0 = significant positive).
Coefficients plot, no returned value
Thomas Wieland
Wieland T (2025) Assessing the effectiveness of non-pharmaceutical interventions in the SARS-CoV-2 pandemic: results of a natural experiment regarding Baden-Württemberg (Germany) and Switzerland in the second infection wave. Journal of Public Health 33(11), 2497-2511. \Sexpr[results=rd]{tools:::Rd_expr_doi("https://doi.org/10.1007/s10389-024-02218-x")}
data(did_fatalities_splm_coef)
# Results of a difference-in-differences model
plot_coef_ci(
point_estimates = did_fatalities_splm_coef$Estimate,
confint_lower = did_fatalities_splm_coef$CI_lower_Bonferroni,
confint_upper = did_fatalities_splm_coef$CI_upper_Bonferroni,
coef_names = did_fatalities_splm_coef$Var,
skipvars = c(
"Alpha_share",
"lambda",
"rho",
"log(D_Infections_daily_7dsum_per100000_lag2weeks)",
"vacc_cum_per100000_lag2weeks"
),
lwd = 13,
pch = 19,
auto_color = TRUE
)
# Plot with point estimates and confidence intervals
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.