# randomizr

probabilities of assignment: Block Random Assignment

```block_ra_probabilities(blocks = NULL, 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)```

## Value

A matrix of probabilities of assignment

## Examples

```
blocks <- rep(c("A", "B","C"), times = c(50, 100, 200))
prob_mat <- block_ra_probabilities(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_ra_probabilities(blocks = blocks, m = 20)
#> [1,]    0.6    0.4
#> [2,]    0.6    0.4
#> [3,]    0.6    0.4
#> [4,]    0.6    0.4
#> [5,]    0.6    0.4
#> [6,]    0.6    0.4
block_m_each <- rbind(c(25, 25),
c(50, 50),
c(100, 100))

prob_mat <- block_ra_probabilities(blocks = blocks, block_m_each = block_m_each)
#> [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
block_m_each <- rbind(c(10, 40),
c(30, 70),
c(50, 150))

prob_mat <- block_ra_probabilities(blocks = blocks,
block_m_each = block_m_each,
conditions = c("control", "treatment"))
#> [1,]          0.2            0.8
#> [2,]          0.2            0.8
#> [3,]          0.2            0.8
#> [4,]          0.2            0.8
#> [5,]          0.2            0.8
#> [6,]          0.2            0.8
prob_mat <- block_ra_probabilities(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
block_m_each <- rbind(c(10, 20, 20),
c(30, 50, 20),
c(50, 75, 75))
prob_mat <- block_ra_probabilities(blocks = blocks, block_m_each = block_m_each)
#> [1,]     0.2     0.4     0.4
#> [2,]     0.2     0.4     0.4
#> [3,]     0.2     0.4     0.4
#> [4,]     0.2     0.4     0.4
#> [5,]     0.2     0.4     0.4
#> [6,]     0.2     0.4     0.4
prob_mat <- block_ra_probabilities(blocks=blocks, block_m_each=block_m_each,
conditions=c("control", "placebo", "treatment"))
#> [1,]          0.2          0.4            0.4
#> [2,]          0.2          0.4            0.4
#> [3,]          0.2          0.4            0.4
#> [4,]          0.2          0.4            0.4
#> [5,]          0.2          0.4            0.4
#> [6,]          0.2          0.4            0.4
prob_mat <- block_ra_probabilities(blocks=blocks, prob_each=c(.1, .1, .8))