# Two-arm Designs
Z <- complete_ra(N = 100)
table(Z)
Z <- complete_ra(N = 100, m = 50)
table(Z)
Z <- complete_ra(N = 100, m_unit = rep(30, 100))
table(Z)
Z <- complete_ra(N = 100, prob = 0.111)
table(Z)
Z <- complete_ra(N = 100, prob_unit = rep(0.1, 100))
table(Z)
Z <- complete_ra(N = 100, conditions = c("control", "treatment"))
table(Z)
# Multi-arm Designs
Z <- complete_ra(N = 100, num_arms = 3)
table(Z)
Z <- complete_ra(N = 100, m_each = c(30, 30, 40))
table(Z)
Z <- complete_ra(N = 100, prob_each = c(0.1, 0.2, 0.7))
table(Z)
Z <- complete_ra(N = 100, conditions = c("control", "placebo", "treatment"))
table(Z)
# Special Cases
# Two-arm trial where the conditions are by default "T1" and "T2"
Z <- complete_ra(N = 100, num_arms = 2)
table(Z)
# If N = m, every unit is assigned to treatment with probability 1
complete_ra(N = 2, m = 2)
# The single-unit case works the same way: m = 1 out of N = 1 is treated
# with probability 1. Up through randomizr 0.12.0 this case was instead
# treated as a coin flip, so the unit was assigned to treatment only half of
# the time. The change is noted here because it silently alters the
# probabilities of assignment in code written against those versions.
complete_ra(N = 1, m = 1)
Run the code above in your browser using DataLab