This function visualizes the covariate balance over the pre-treatment period. It's particularly designed for outputs from methods like PanelMatch.

plot_covariate_balance_pretrend(
  balance_data,
  y_limits = c(-1, 1),
  theme_use = causalverse::ama_theme(),
  xlab = "Time to Treatment",
  ylab = "Balance (in SD unit)",
  main_title = "Covariate Balance Over Pre-Treatment Period",
  legend_title = "Covariate",
  show_legend = TRUE,
  ...
)

Arguments

balance_data

A matrix containing the covariate balance data over the pre-treatment period.

y_limits

A numeric vector of length 2 defining the y-axis limits.

theme_use

A ggplot2 theme. By default, it uses causalverse::ama_theme().

xlab

A string indicating the label for the x-axis.

ylab

A string indicating the label for the y-axis.

main_title

A string for the main title of the plot.

legend_title

A string for the legend title.

show_legend

A logical; if TRUE, the legend is displayed, otherwise, it's hidden.

...

Additional arguments passed to the ggplot labs.

Value

A ggplot2 object.

Examples

if (FALSE) {
  balance_data_sample <- matrix(rnorm(20), nrow = 5)
  plot_covariate_balance_pretrend(balance_data_sample)
}