parallel.inits {dclone} | R Documentation |
Parallel RNGs for initial values
Description
This function takes care of initial values with safe RNGs based on
parallel.seeds
of the rjags package.
Usage
parallel.inits(inits, n.chains)
Arguments
inits |
Initial values (see Initialization at |
n.chains |
Number of chains to generate. |
Details
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.
Value
Returns a list of initial values with RNGs.
Author(s)
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.
See Also
This seeding function is used in all of dclone's
parallel functions that do initialization:
parJagsModel
, jags.parfit
,
dc.parfit
Examples
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)
}