This internal helper function extracts synthetic draws from a Stan fit object where the draws are stored in a 3D array. It handles multiple treated units and combines the draws with observed outcome data, returning a tidy data frame suitable for analysis or plotting.
.get_synth_draws3d(fit, data, id, treated_ids, time, outcome, intervention)A data frame containing:
draw: The index of the synthetic draw.
id: The identifier of the treated unit.
time: The time period.
y_hat: The synthetic outcome for the given draw, unit, and time period.
A Stan fit object containing the model results.
A data frame with the input data, including outcome, time, and unit identifier.
The name of the variable in data that identifies units (as a string).
A vector of identifiers for the treated units.
The name of the time period variable (as a string).
The name of the outcome variable (as a string).
The name of the variable in data that indicates the intervention time (as a string).