plot_treat_time.Rd
Plot number of treated units over time or return a dataframe.
plot_treat_time(
data,
time_var,
unit_treat,
outlier_method = "iqr",
show_legend = FALSE,
theme_use = causalverse::ama_theme(),
legend_title = "Point Type",
legend_labels = c("Regular", "Outlier"),
regular_size = 3,
outlier_size = 5,
regular_color = "black",
outlier_color = "red",
regular_shape = 16,
outlier_shape = 17,
title = "Random Time Assignment",
xlab = "Time",
ylab = "Number of Treated Units",
output = "plot",
...
)
Dataframe containing data.
Time variable for aggregating the number of treated units.
Variable indicating if the unit was treated in a specific time period.
Method for outlier detection ("iqr" or "z-score").
Logical indicating whether to show legend.
ggplot2 theme to use.
Title for legend.
Labels for regular and outlier points.
Size of regular points.
Size of outlier points.
Color of regular points.
Color of outlier points.
Shape of regular points.
Shape of outlier points.
Plot title.
X-axis label.
Y-axis label.
Type of output ("plot" or "dataframe").
Additional arguments to pass to ggplot2::labs.
ggplot2 object or dataframe.
# Example usage:
if (FALSE) {
data <- data.frame(time = c(1,1,2,2,3,3), treat = c(0,1,1,1,0,0))
plot_treat_time(data, time_var = time, unit_treat = treat)
plot_treat_time(data, time_var = time, unit_treat = treat, output = "dataframe")
}