.get_synth_draws3d | R Documentation |
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)
fit |
A Stan fit object containing the model results. |
data |
A data frame with the input data, including outcome, time, and unit identifier. |
id |
The name of the variable in |
treated_ids |
A vector of identifiers for the treated units. |
time |
The name of the time period variable (as a string). |
outcome |
The name of the outcome variable (as a string). |
intervention |
The name of the variable in |
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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.