gen_seeds {SimDesign} | R Documentation |
Generate random seeds
Description
Generate seeds to be passed to runSimulation
's seed
input. Values
are sampled from 1 to 2147483647, or are generated using L'Ecuyer-CMRG's (2002)
method (returning either a list if arrayID
is omitted, or the specific
row value from this list if arrayID
is included).
Usage
gen_seeds(design = 1L, iseed = NULL, arrayID = NULL)
Arguments
design |
design matrix that requires a unique seed per condition, or a number indicating the number of seeds to generate. Default generates one number |
iseed |
the initial |
arrayID |
(optional) single integer input corresponding to the specific
row in the |
Author(s)
Phil Chalmers rphilip.chalmers@gmail.com
Examples
# generate 1 seed (default)
gen_seeds()
# generate 5 unique seeds
gen_seeds(5)
# generate from nrow(design)
design <- createDesign(factorA=c(1,2,3),
factorB=letters[1:3])
seeds <- gen_seeds(design)
seeds
# generate seeds for runArraySimulation()
(iseed <- gen_seeds()) # initial seed
seed_list <- gen_seeds(design, iseed=iseed)
seed_list
# expand number of unique seeds given iseed (e.g., in case more replications
# are required at a later date)
seed_list_tmp <- gen_seeds(nrow(design)*2, iseed=iseed)
str(seed_list_tmp) # first 9 seeds identical to seed_list
# more usefully for HPC, extract only the seed associated with an arrayID
arraySeed.15 <- gen_seeds(nrow(design)*2, iseed=iseed, arrayID=15)
arraySeed.15