| .get_plot_df {bsynth} | R Documentation |
Returns Data Frame Ready for Plotting with Confidence Intervals
Description
This function processes data frames containing synthetic and observed outcomes, calculates confidence intervals for the synthetic outcomes, and returns a combined data frame suitable for plotting the results.
Usage
.get_plot_df(y_synth_draws, pre_data, post_data, time, outcome, ci = 0.75)
Arguments
y_synth_draws |
A data frame containing draws from the Stan fit object. |
pre_data |
A data frame with data before the intervention. |
post_data |
A data frame with data after the intervention. |
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. -
outcome: The observed outcome. -
y_synth: The mean synthetic outcome. -
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 difference between the observed and synthetic outcomes. -
tau_LB: The lower bound of the confidence interval fortau. -
tau_UB: The upper bound of the confidence interval fortau.