View source: R/parallel.inits.R
parallel.inits | R Documentation |
This function takes care of initial values with safe RNGs based on
parallel.seeds
of the rjags package.
parallel.inits(inits, n.chains)
inits |
Initial values (see Initialization at |
n.chains |
Number of chains to generate. |
Initial values are handled similar to as it is done in
jags.model
.
RNGs are based on values returned by
parallel.seeds
.
If the "lecuyer"
JAGS module is active, RNGs are based on
the "lecuyer::RngStream"
factory, otherwise those are based on
the "base::BaseRNG"
factory.
Returns a list of initial values with RNGs.
Peter Solymos, solymos@ualberta.ca. Based on Martyn Plummer's
parallel.seeds
function and code in
jags.model
for initial value handling in the
rjags package.
parallel.seeds
, jags.model
This seeding function is used in all of dclone's
parallel functions that do initialization:
parJagsModel
, jags.parfit
,
dc.parfit
if (require(rjags)) { ## "base::BaseRNG" factory. parallel.inits(NULL, 2) ## "lecuyer::RngStream" factory load.module("lecuyer") parallel.inits(NULL, 2) unload.module("lecuyer") ## some non NULL inits specifications parallel.inits(list(a=0), 2) parallel.inits(list(list(a=0), list(a=0)), 2) parallel.inits(function() list(a=0), 2) parallel.inits(function(chain) list(a=chain), 2) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.