.get_synth_draws {bsynth} | R Documentation |
Get Synthetic Draws in Tidy Format for Single Treated Unit
Description
This internal helper function extracts synthetic draws from a Stan fit object, combines them with observed outcome data, and returns a tidy data frame suitable for further analysis or plotting. This function is specifically designed for scenarios with a single treated unit.
Usage
.get_synth_draws(fit, pre_data, post_data, time, outcome)
Arguments
fit |
A Stan fit object containing the model results. |
pre_data |
A data frame with outcome data before the intervention. |
post_data |
A data frame with outcome 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). |
Value
A data frame containing:
-
draw
: The index of the synthetic draw. -
time
: The time period. -
y_synth
: The synthetic outcome for the given draw and time period. -
outcome
: The observed outcome for the given time period.
[Package bsynth version 1.0 Index]