minMSE (version 0.3.1)

sample_with_prev_treatment: Sample Under Consideration of an Already Treated Subset of Units

Description

Given a previous treatment assignment vector for a subset of all observations that treatment assigment is desired for, the function computes a treatment assignment vector for which the previously assigned units are not changed. At a later step, the previously assigned units are also taken into consideration for computation of the score value, the min MSE function, to achieve balanced treatment groups.

Usage

sample_with_prev_treatment(prev_treatment, n_treatments, n_per_group)

Arguments

prev_treatment

takes a numerical vector of partial treatment assignment as argument, and -- for a start -- assigns the missing units (where the value is NA) to a random treatment group, while maintaining the same proportions in the groups.

n_treatments

specifies the number of treatment groups desired (in addition to the control group). They might be more than the ones already defined in prev_treatment.

n_per_group

specifies the distribution of participants per experimental group. It is either an integer, which produces even-sized groups, or a vector which has the same length as the number of experimental groups.

Value

Returns a treatment assignment vector where the observations given by prev_treatment are unmodified, and the others are assigned to a group.

Examples

Run this code
# NOT RUN {
sample_with_prev_treatment(prev_treatment = c(0, NA, NA, NA, 1, NA, NA, NA, NA, NA),
                           n_treatments = 2,
                           n_per_group = c(2, 4, 4))
# }

Run the code above in your browser using DataLab