make_tr_vec_bernoulli: Assign treatment via 3-net clustering randomization.

Description Usage Arguments Details Value References Examples

View source: R/make_tr_vec_bernoulli.R

Description

Create a permutation matrix from possible treatment assignments via 3-net clustering randomization or via unit-level randomization under a Bernoulli distribution.

Usage

1
make_tr_vec_bernoulli(adj_matrix, p, R, cluster, seed = NULL)

Arguments

adj_matrix

an N * N numeric matrix of 0, 1 entries such as those retuned by make_adj_matrix, or a N * N matrix, where N is the number of units.

p

probability that treatment takes the value 1.

R

number of repetitions (treatment assignments). R must be smaller or equal to the number of possible treatment assignements which is combination(N, C) * 2 ^ C when cluster = 'yes', and 2 ^ N when cluster = 'no', where N corresponds to the number of units and C to the number of clusters.

cluster

string; either 'yes' or 'no'. If 'yes' units are assigned to treatment via 3-net clustering randomization, if 'no' via unit-level randomization under a Bernoulli(p) distribution.

seed

random number for result replicability.

Details

make_tr_vec_bernoulli produces all possible (or a random sample of all possible) treatment assignments via 3-net clustering randomization following the algorithm of Ugander et al. (2013), or via unit-level randomization under a Bernoulli(p) distribution. Sampling of treatment vectors is without replacement.

Value

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

References

Ugander, J. et al. (2013). Graph cluster randomization: Network exposure to multiple universes. Proceedings of the 19th ACM SIGKDD international conference on Knowledge discovery and data mining. 329–337.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Create adjacency matrix:

adj_matrix <- make_adj_matrix(N = 50, model = 'small_world',
                              seed = 357)

# Assign treatment via 3-net clustering randomization:
make_tr_vec_bernoulli(adj_matrix, p = 0.2, R = 1,
                      cluster = 'yes', seed = 357)

# Assign treatment via unit-level randomization
# under Bernoulli(p) distribution:

make_tr_vec_bernoulli(adj_matrix, p = 0.2, R = 1,
                            cluster = 'no', seed = 357)

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