fsm_batch {FSM} | R Documentation |
Batched FSM for sequential experiments
Description
Extension of the FSM to cases where units arrive sequentially in batches.
Usage
fsm_batch(
data_frame,
data_frame_past,
t_ind,
SOM,
s_function = "Dopt",
Q_initial = NULL,
eps = 0.001,
ties = "random",
intercept = TRUE,
index_col_past = TRUE,
standardize = TRUE,
units_print = TRUE,
index_col = TRUE,
Pol_mat = NULL,
w_pol = NULL
)
Arguments
data_frame |
Data frame containing a column of unit indices (optional) and covariates (or transformations thereof). |
data_frame_past |
A data frame of units already allocated to treatment groups. Data frame contains a column of unit indices (optional), columns of covariates (or transformations thereof), and a column for treatment indicator. |
t_ind |
column name containing the treatment indicator in |
SOM |
Selection Order Matrix. |
s_function |
Specifies a selection function, a string among |
Q_initial |
A (optional) non-singular matrix (called 'initial matrix') that is added the |
eps |
Proportionality constant for |
ties |
Specifies how to deal with ties in the values of the selection function. If |
intercept |
if |
index_col_past |
|
standardize |
if |
units_print |
if |
index_col |
if |
Pol_mat |
Policy matrix. Applicable only when |
w_pol |
A vector of policy weights. Applicable only when |
Value
A list containing the following items.
data_frame_allocated
: The original data frame augmented with the column of the treatment indicator.
som_appended
: The SOM with augmented columns for the indices and covariate values for units selected.
som_split
: som_appended, split by the levels of the treatment.
data_frame_allocated_augmented
: data frame combining data_frame_allocated
and data_frame_past
.
Author(s)
Ambarish Chattopadhyay, Carl N. Morris and Jose R. Zubizarreta
References
Chattopadhyay, A., Morris, C. N., and Zubizarreta, J. R. (2020), “Randomized and Balanced Allocation of Units into Treatment Groups Using the Finite Selection Model for R
'.
Examples
# Consider N=18, number of treatments = 2, n1 = n2 = 9, batch sizes = 6,6,6.
# Get data frame for the first batch.
df_sample_1 = data.frame(index = 1:6, age = c(20,30,40,40,50,60))
# Obtain SOM for all the 12 units.
som_gen = som(data_frame = NULL, n_treat = 2, treat_sizes = c(9,9),
include_discard = FALSE, method = 'SCOMARS', marginal_treat = rep((9/18),18), control = FALSE)
# Assign the first batch.
f1 = fsm(data_frame = df_sample_1, SOM = som_gen[1:6,], s_function = 'Dopt',
eps = 0.0001, ties = 'random', intercept = TRUE, standardize = TRUE, units_print = TRUE)
f1_app = f1$data_frame_allocated
# Get data frame for the second batch.
df_sample_2 = data.frame(index = 7:12, age = c(20,30,40,40,50,60))
# Assign the second batch.
f2 = fsm_batch(data_frame = df_sample_2, SOM = som_gen[7:12,], s_function = 'Dopt',
eps = 0.0001, ties = 'random', intercept = TRUE, standardize = TRUE, units_print = TRUE,
data_frame_past = f1_app, t_ind = 'Treat', index_col_past = TRUE)
f2_app = f2$data_frame_allocated_augmented
# Get data frame for the third batch.
df_sample_3 = data.frame(index = 13:18, age = c(20,30,40,40,50,60))
# Assign the third batch.
f3 = fsm_batch(data_frame = df_sample_3, SOM = som_gen[13:18,], s_function = 'Dopt',
eps = 0.0001, ties = 'random', intercept = TRUE, standardize = TRUE, units_print = TRUE,
data_frame_past = f2_app, t_ind = 'Treat', index_col_past = TRUE)
f3_app = f3$data_frame_allocated_augmented