Description Usage Arguments Value Author(s) References Examples
View source: R/conventional_designs.R
Generates an assignment under completely randomized design (CRD).
1 |
data_frame |
A data frame corresponding to the full sample of units. |
n_treat |
Number of treatment groups. |
treat_sizes |
A vector of treatment group sizes. If |
control |
If |
The original data frame augmented with the column of the treatment indicator.
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 | # Consider N = 12, n1 = n2 = n3 = 4.
df_sample = data.frame(index = 1:12, x = c(20,30,40,40,50,60,20,30,40,40,50,60))
# Draw a random assignment from CRD.
fc = crd(data_frame = df_sample, n_treat = 3, treat_sizes = c(4,4,4))
# Get vector of treatment assignments.
Z_crd = fc$Treat
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.