crd: Completely Randomized Design (CRD)

Description Usage Arguments Value Author(s) References Examples

View source: R/conventional_designs.R

Description

Generates an assignment under completely randomized design (CRD).

Usage

1
crd(data_frame, n_treat, treat_sizes, control = FALSE)

Arguments

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 = TRUE, the first element of treat_sizes should be the control group size.

control

If TRUE, treatments are labeled as 0,1,...,g-1 (0 representing the control group). If FALSE, they are labeled as 1,2,...,g.

Value

The original data frame augmented with the column of the treatment indicator.

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

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

FSM documentation built on March 11, 2021, 1:06 a.m.

Related to crd in FSM...