Skip to contents

Creates a forest plot comparing point estimates and confidence intervals from multiple models or specifications. Useful for showing robustness of causal estimates across different identification strategies.

Usage

plot_coef_comparison(
  models,
  coef_name = NULL,
  conf_level = 0.95,
  title = "Treatment Effect Comparison",
  xlab = "Estimate"
)

Arguments

models

A named list of model objects (from lm, fixest::feols, etc.) or a data frame with columns model, estimate, std_error.

coef_name

Character string. The name of the coefficient to extract from each model. Required when models is a list of model objects.

conf_level

Numeric. Confidence level for intervals. Default is 0.95.

title

Character string. Plot title. Default is "Treatment Effect Comparison".

xlab

Character string. X-axis label. Default is "Estimate".

Value

A ggplot2 object showing a forest plot.

Examples

if (FALSE) { # \dontrun{
m1 <- lm(mpg ~ am, data = mtcars)
m2 <- lm(mpg ~ am + wt, data = mtcars)
m3 <- lm(mpg ~ am + wt + hp, data = mtcars)

plot_coef_comparison(
  models = list("Bivariate" = m1, "With Weight" = m2, "Full" = m3),
  coef_name = "am"
)
} # }