dot-get_plot_df2: Prepare Data Frame for Plotting with Multiple Treated Units

.get_plot_df2R Documentation

Prepare Data Frame for Plotting with Multiple Treated Units

Description

This function processes data for multiple treated units, calculating synthetic outcomes, confidence intervals, and treatment effects. It combines this information into a data frame suitable for plotting the results.

Usage

.get_plot_df2(y_synth_draws, data, treated_ids, id, time, outcome, ci = 0.75)

Arguments

y_synth_draws

A data frame containing synthetic outcome draws for each treated unit and time period.

data

A data frame with the original data, including outcomes for treated units.

treated_ids

A vector of identifiers for the treated units.

id

The name of the variable in data that identifies units (as a string).

time

The name of the time period variable (as a string).

outcome

The name of the outcome variable (as a string).

ci

The width of the credible confidence interval (default: 0.75).

Value

A data frame containing:

  • time: The time period.

  • id: The unit identifier (including "Average" for the average treatment effect).

  • outcome: The observed outcome (for treated units).

  • y_synth: The mean synthetic outcome (for treated units and the average).

  • LB: The lower bound of the confidence interval for the synthetic outcome.

  • UB: The upper bound of the confidence interval for the synthetic outcome.

  • tau: The treatment effect (difference between observed and synthetic outcomes).

  • tau_LB: The lower bound of the confidence interval for the treatment effect.

  • tau_UB: The upper bound of the confidence interval for the treatment effect.


bsynth documentation built on June 25, 2024, 5:08 p.m.