.get_synth_draws3d {bsynth}R Documentation

Get Synthetic Draws in Tidy Format for Multiple Treated Units (3D Array)

Description

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.

Usage

.get_synth_draws3d(fit, data, id, treated_ids, time, outcome, intervention)

Arguments

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 data that identifies units (as a string).

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 data that indicates the intervention time (as a string).

Value

A data frame containing:


[Package bsynth version 1.0 Index]