make_tr_vec_permutation: Randomly assign treatment with uniform probability.

Description Usage Arguments Details Value Examples

View source: R/make_tr_vec_permutation.R

Description

Create a permutation matrix from possible treatment random assignments with uniform probability.

Usage

1
make_tr_vec_permutation(N, p, R, seed = NULL, allow_repetitions = FALSE)

Arguments

N

number of units.

p

proportion of units assigned to treatment.

R

number of repetitions (treatment permutations). If allow_repetions = FALSE and R is bigger than the number of possible treatment assignments, then R is truncated to the number of possible treatment assignements.

seed

random number for result replicability.

allow_repetitions

logical; if TRUE sampling is with replacement rather than without replacement.

Details

make_tr_vec_permutation produces all possible (or a random sample of all possible) treatment assignments when sampling without replacement, or a random sample of possible treatment assignments when sampling with replacement.

Value

An R * N numeric matrix. Each row cooresponds to a treatment assignment vector.

Examples

1
2
3
4
make_tr_vec_permutation(N = 10, p = 0.2, R = 1, seed = 357)
make_tr_vec_permutation(N = 10, p = 0.2, R = 50, seed = 357)
make_tr_vec_permutation(N = 10, p = 0.2, R = 50, seed = 357,
                        allow_repetitions = TRUE)

szonszein/interference documentation built on Jan. 10, 2022, 6:35 p.m.