Description Usage Arguments Value Author(s) References Examples
View source: R/fsm_batch_without_strata.R
Extension of the FSM to cases where units arrive sequentially in batches.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
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 (X^T X)
matrix of the choosing treatment group at any stage, when the (X^T X) matrix of that treatment group
at that stage is non-invertible. If |
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 |
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
.
Ambarish Chattopadhyay, Carl N. Morris and Jose R. Zubizarreta
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
'.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # 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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.