.get_synth_draws_predictor_match {bsynth} | R Documentation |
Get Synthetic Draws in Tidy Format for Single Treated Unit (Predictor Match Model)
Description
This internal helper function extracts synthetic draws from a Stan fit object generated by a predictor match model. It combines these draws with observed outcome data and returns a tidy data frame suitable for analysis or plotting. It specifically works with variable definitions from the predictor match model.
Usage
.get_synth_draws_predictor_match(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.