# Two Group Designs
Z <- simple_ra(N = 100)
table(Z)
Z <- simple_ra(N = 100, prob = 0.5)
table(Z)
Z <- simple_ra(N = 100, prob_each = c(0.3, 0.7),
conditions = c("control", "treatment"))
table(Z)
# A probability of assignment that varies unit by unit
Z <- simple_ra(N = 100, prob_unit = seq(0.1, 0.9, length.out = 100))
table(Z)
# Skipping the input checks. The checks are also what fill in defaults, so
# conditions has to be given explicitly once they are skipped. In a
# simulation, declare_ra() and conduct_ra() are the tidier way to check the
# arguments once and then draw many assignments from them.
Z <- simple_ra(N = 100, prob = 0.3, conditions = c(0, 1), check_inputs = FALSE)
table(Z)
# Multi-arm Designs
Z <- simple_ra(N = 100, num_arms = 3)
table(Z)
Z <- simple_ra(N = 100, prob_each = c(0.3, 0.3, 0.4))
table(Z)
Z <- simple_ra(N = 100, prob_each = c(0.3, 0.3, 0.4),
conditions = c("control", "placebo", "treatment"))
table(Z)
Z <- simple_ra(N = 100, conditions = c("control", "placebo", "treatment"))
table(Z)
Run the code above in your browser using DataLab