This function creates a ggplot for visualizing Average Treatment Effect (ATE) from a given estimation object.

synthdid_plot_ate(
  est,
  show_CI = TRUE,
  title = "",
  xlab = "Relative Time Period",
  ylab = "ATE",
  y_intercept = 0,
  theme = causalverse::ama_theme(),
  fill_color = "lightgrey"
)

Arguments

est

Estimation object from synthdid_est_ate.

show_CI

Logical; if TRUE, shows confidence intervals on the plot.

title

String; title of the plot.

xlab

String; label for the x-axis.

ylab

String; label for the y-axis.

y_intercept

Numeric; value at which a horizontal line is drawn.

theme

ggplot theme; default is set to causalverse::ama_theme().

fill_color

String; color used for the confidence interval shading.

Value

A ggplot object representing the ATE plot.

Examples

if (FALSE) {
  # Load required libraries
  library(ggplot2)
  library(tidyverse)
  library(causalverse)
  
  library(tidyverse)
  data <- fixest::base_stagg |>
    dplyr::mutate(treatvar = if_else(time_to_treatment >= 0, 1, 0)) |>
    dplyr::mutate(treatvar = as.integer(if_else(year_treated > (5 + 2), 0, treatvar)))
  est <- 
    synthdid_est_ate(
      data = data,
      adoption_cohorts = 5:7,
      lags = 2,
      leads = 2,
      time_var = "year",
      unit_id_var = "id",
      treated_period_var = "year_treated",
      treat_stat_var = "treatvar",
      pooled = FALSE,
      placebo = FALSE,
      outcome_var = "y"
    )
  # Generate the plot
  synthdid_plot_ate(est, show_CI = TRUE, title = "Sample ATE Plot")
}