Description Usage Arguments Details Value References Examples
View source: R/make_tr_vec_permutation_hierarchical.R
Create possible treatment random assignments with uniform probability under a two-stage hierarchical design.
1 | make_tr_vec_permutation_hierarchical(group, c, k, R, seed = NULL)
|
group |
integer vector of length |
c |
proportion of groups assigned to the high saturation (psi) in the first stage. |
k |
numeric vector of length 2 of proportions of individuals whithin groups assigned to treatment in the second stage, given the first stage treatment low and high saturations (phi and psi), respectively. |
R |
number of repetitions (treatment permutations). |
seed |
random number for result replicability. |
make_tr_vec_permutation_hierarchical
produces all possible (or a random
sample of all possible) treatment assignments under a two-stage hierarchical
design where groups are first randomly assigned to a high or a low level of
treatment saturation (psi, phi), and then units within groups are randomly
assigned to treatment with probability equal to their group saturation rate.
Sampling of treatment vectors is without replacement.
list of R
data frames each of N
observations and 3 variables:
group
:Integer with group label.
group_tr
:Numeric indicator of group assignment to high saturation (psi) in the first stage.
indiv_tr
:Numeric indicator of individual assignment to treatment in the second stage.
Hudgens, M.G. & Halloran M.E. (2008). Toward causal inference with interference. Journal of the American Statistical Association, 103(482), 832–842.
Aronow, P.M. et al. (2020). Spillover effects in experimental data. arXiv preprint, arXiv:2001.05444.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # Simulate a vector of group membership of 30 units
# equally divided into 6 groups:
group <- rep(1:6, each = 30/6)
# Define proportion of groups assigned to
# saturation psi in the first stage:
c <- 1/2
# Define proportion of individuals whithin groups assigned
# to treatment in the second stage, given the assigned
# first-stage low and high (phi, psi) saturation rates:
k <- c(2/5, 3/5)
make_tr_vec_permutation_hierarchical(group, c, k, R = 1, seed = 357)
make_tr_vec_permutation_hierarchical(group, c, k, R = 5, seed = 357)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.