This function generates coefplots or iplots based on fixest outputs, allowing the user to visualize interaction coefficients with ease.

plot_coef_par_trends(
  data,
  dependent_vars,
  time_var,
  unit_treatment_status,
  unit_id_var,
  plot_type = "coefplot",
  combined_plot = TRUE,
  legend_position = "bottomleft",
  legend_title = "Legend Title",
  legend_args = list(),
  plot_args = list()
)

Arguments

data

Data frame containing the data to be used in the model.

dependent_vars

Named list of dependent variables to model and their respective labels.

time_var

Name of the time variable in the data.

unit_treatment_status

Name of the treatment status variable.

unit_id_var

Name of the unit identification variable.

plot_type

Type of plot to generate. Either "coefplot" or "iplot".

combined_plot

Logical indicating whether to combine plots for all dependent variables.

legend_position

Position of the legend on the plot.

legend_title

Title for the legend.

legend_args

List of additional arguments to customize the legend.

plot_args

List of additional arguments to customize the plot.

Value

A plot visualizing interaction coefficients.

Examples

if (FALSE) {
library(fixest)
data("base_did")

# Sample call to the function:
plot_coef_par_trends(
  data = base_did,
  dependent_vars = c(y = "Outcome 1", x1 = "Outcome 2"),
  time_var = "period",
  unit_treatment_status = "treat",
  unit_id_var = "id",
  plot_type = "coefplot",
  combined_plot = TRUE,
  plot_args = list(main = "Interaction coefficients Plot"),
  legend_title = "Metrics",
  legend_position = "bottomleft"
)

plot_coef_par_trends(
  data = base_did,
  dependent_vars = c(y = "Outcome 1", x1 = "Outcome 2"),
  time_var = "period",
  unit_treatment_status = "treat",
  unit_id_var = "id",
  plot_type = "coefplot",
  combined_plot = FALSE
)
}