| genPerms | R Documentation |
Used within calls to pcr to generate a set of unique treatment permutations for randomization.
genPerms(n, n1, nPerms)
n |
Total number of units to be randomized. |
n1 |
Number of units to receive treatment. |
nPerms |
Number of permutations to generate. |
This function randomly samples nPerms of the choose(n, n1) possible treatment permutations. If nPerms > choose(n, n1), then all choose(n, n1) permutations are generated systematically. Also, in the case of 1-to-1 allocation, the complement treatment vectors are also produced, so the returned matrix has 2*nPerms permutations. Uniqueness is checked throughout and duplicate permutations disgarded.
The result is an n1 x nPerms (or n1 x choose(n, n1) or n1 x 2*nPerms) matrix. Each column represents one treatment permutation, with the values in the column giving the index of the treated units.
Travis M. Loux
genPerms(n=50, n1=25, nPerms=500)
genPerms(n=50, n1=35, nPerms=500)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.