synthdid_plot_ate.Rd
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"
)
Estimation object from synthdid_est_ate
.
Logical; if TRUE, shows confidence intervals on the plot.
String; title of the plot.
String; label for the x-axis.
String; label for the y-axis.
Numeric; value at which a horizontal line is drawn.
ggplot theme; default is set to causalverse::ama_theme().
String; color used for the confidence interval shading.
A ggplot object representing the ATE plot.
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")
}