Description Usage Arguments Details Value References Examples
View source: R/make_tr_vec_bernoulli.R
Create a permutation matrix from possible treatment assignments via 3-net clustering randomization or via unit-level randomization under a Bernoulli distribution.
1 | make_tr_vec_bernoulli(adj_matrix, p, R, cluster, seed = NULL)
|
adj_matrix |
an |
p |
probability that treatment takes the value 1. |
R |
number of repetitions (treatment assignments). |
cluster |
string; either |
seed |
random number for result replicability. |
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.
An R
* N
numeric matrix. Each row cooresponds to a
treatment assignment vector.
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.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.