combine.mcmc | R Documentation |
Utility functions for combining separate MCMC or runjags objects into a single object, or the reverse operation
combine.mcmc(
mcmc.objects = list(),
thin = 1,
return.samples = NA,
collapse.chains = if (length(mcmc.objects) == 1) TRUE else FALSE,
vars = NA,
add.mutate = TRUE
)
combine.jags(runjags.objects = list(), summarise = TRUE, ...)
divide.jags(
runjags.object,
which.chains = 1:nchain(as.mcmc.list(runjags.object)),
summarise = TRUE,
...
)
mcmc.objects |
a list of MCMC or runjags objects, all with the same number of chains and matching variable names, or a single MCMC object/list or runjags object. No default. |
thin |
an integer to use to thin the (final) MCMC object by, in addition to any thinning already applied to the objects before being passed to combine.mcmc. Ignored if return.samples is specified (!is.na). Default 1 (no additional thinning is performed). |
return.samples |
the number of samples to return after thinning. The chains will be thinned to as close to this minimum value as possible, and any excess iterations discarded. Supersedes thin if both are specified. Ignored if niter(mcmc.objects) < return.samples. Default NA. |
collapse.chains |
option to combine all MCMC chains into a single MCMC chain with more iterations. Can be used for combining chains prior to calculating results in order to reduce the Monte Carlo error of estimates. Default TRUE if a single mcmc.object is provided, or FALSE otherwise. |
vars |
an optional character vector of variable names to extract. If supplied, only variable names in the object supplied with a partial match to anything in 'vars' will be used. Note that regular expressions are not allowed, but the caret (^) token can be used to specify the match at the start of a variable name, and a quoted vars will be matched exactly. Default NA meaning all variables available are returned. |
add.mutate |
should any mutate function associated with the runjags objects be run to collect the additional variables before returning MCMC chains? |
runjags.objects |
a list of runjags class objects to be combined |
summarise |
option to add a new set of summary statistics to the newly created runjags object |
... |
other arguments to be passed to |
runjags.object |
a single runjags class object to be divided |
which.chains |
the chains to extract from the runjags object |
The combine.mcmc function allows an MCMC object (with 1 or more chains) to be combined with object(s) representing extensions of the same simulation, to produce one MCMC object that contains the continuous combined Markov chains. Alternatively, a single MCMC list object can be converted into a single chain by combining all chains sequentially. An object of class runjags-class
can also be used, in which case the MCMC objects will be extracted from this. The combine.jags function does a similar operation, but returning the entire runjags object as a single object that can be extended using extend.jags
. The divide.jags extracts one or more chains from a given runjags object.
For combine.mcmc: an MCMC object if collapse.chains=TRUE, or an mcmc.list object if collapse.chains=FALSE
For combine.jags and divide.jags: a runjags-class
object
run.jags
and runjags-class
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.