.get_synth_draws | R Documentation |
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.
.get_synth_draws(fit, pre_data, post_data, time, outcome)
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). |
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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.