genPerms {PropScrRand} | R Documentation |
Generate Treatment Permutations
Description
Used within calls to pcr
to generate a set of unique treatment permutations for randomization.
Usage
genPerms(n, n1, nPerms)
Arguments
n |
Total number of units to be randomized. |
n1 |
Number of units to receive treatment. |
nPerms |
Number of permutations to generate. |
Details
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.
Value
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.
Author(s)
Travis M. Loux
Examples
genPerms(n=50, n1=25, nPerms=500)
genPerms(n=50, n1=35, nPerms=500)