probabilities of assignment: Blocked and Clustered Random Assignment

block_and_cluster_ra_probabilities(blocks = block_var, clusters = clust_var,
prob = NULL, prob_each = NULL, m = NULL, block_m = NULL,
block_m_each = NULL, block_prob = NULL, block_prob_each = NULL,
num_arms = NULL, conditions = NULL, check_inputs = TRUE,
block_var = NULL, clust_var = NULL)

## Value

A matrix of probabilities of assignment

## Examples


clusters <- rep(letters, times=1:26)
blocks <- rep(NA, length(clusters))
blocks[clusters %in% letters[1:5]] <- "block_1"
blocks[clusters %in% letters[6:10]] <- "block_2"
blocks[clusters %in% letters[11:15]] <- "block_3"
blocks[clusters %in% letters[16:20]] <- "block_4"
blocks[clusters %in% letters[21:26]] <- "block_5"

prob_mat <- block_and_cluster_ra_probabilities(clusters = clusters,
blocks = blocks)
#> [1,]    0.5    0.5
#> [2,]    0.5    0.5
#> [3,]    0.5    0.5
#> [4,]    0.5    0.5
#> [5,]    0.5    0.5
#> [6,]    0.5    0.5
prob_mat <- block_and_cluster_ra_probabilities(clusters = clusters,
blocks = blocks,
num_arms = 3)
#> [1,] 0.3333333 0.3333333 0.3333333
#> [2,] 0.3333333 0.3333333 0.3333333
#> [3,] 0.3333333 0.3333333 0.3333333
#> [4,] 0.3333333 0.3333333 0.3333333
#> [5,] 0.3333333 0.3333333 0.3333333
#> [6,] 0.3333333 0.3333333 0.3333333
prob_mat <- block_and_cluster_ra_probabilities(clusters = clusters,
blocks = blocks,
prob_each = c(.2, .5, .3))
#> [1,]     0.2     0.5     0.3
#> [2,]     0.2     0.5     0.3
#> [3,]     0.2     0.5     0.3
#> [4,]     0.2     0.5     0.3
#> [5,]     0.2     0.5     0.3
#> [6,]     0.2     0.5     0.3
block_m_each <- rbind(c(2, 3),
c(1, 4),
c(3, 2),
c(2, 3),
c(5, 1))

prob_mat <- block_and_cluster_ra_probabilities(clusters = clusters,
blocks = blocks,
block_m_each = block_m_each)
#> [1,]    0.4    0.6
#> [2,]    0.4    0.6
#> [3,]    0.4    0.6
#> [4,]    0.4    0.6
#> [5,]    0.4    0.6
#> [6,]    0.4    0.6