MCMCdef_dummy {compareMCMCs} | R Documentation |
MCMC plugins that come with the compareMCMCs package
Description
These functions are normally called from
compareMCMCs
, which passes its arguments or elements
extracted from its arguments to these functions.
Usage
MCMCdef_dummy(MCMCinfo, MCMCcontrol, monitorInfo, modelInfo)
MCMCdef_jags(MCMCinfo, MCMCcontrol, monitorInfo, modelInfo)
MCMCdef_stan(MCMCinfo, MCMCcontrol, monitorInfo, modelInfo)
Arguments
MCMCinfo |
The named element of |
MCMCcontrol |
The |
monitorInfo |
A list with elements |
modelInfo |
The |
Details
These functions are called internally from
compareMCMCs
. Each one runs an MCMC engine.
Functions to interface to other MCMC engines can be registered
via registerMCMCengine
.
MCMCs in nimble
are run from runNIMBLE
. This uses a different
system because there may be multiple nimble MCMC configurations for
one model.
MCMCdef_dummy
does not run a real MCMC. It provides a quick way
to generate MCMC-formatted output for testing other parts of this
package.
MCMCdef_jags
runs JAGS via package rjags
. It uses model
information from modelInfo
. It does not use MCMCinfo
.
MCMCdef_stan
runs Stan via package rstan
. It does not use
modelInfo
. It accepts the following elements of the MCMCinfo
list:
-
file
:file
argument tostan_model
function inrstan
. This can alternatively be provided viastan_model_args$file
. -
data
:data
argument tosampling
function inrstan
. This can alternatively be provided viasampling_args$data
. -
inits
:inits
argument tosampling
function inrstan
. This can alternatively be provided viasampling_args$inits
. -
stan_model_args
: list of arguments tostan_model
. Note that this can provide the stan model in themodel_code
element (as a character string) or in thefile
element (an alternative way to provide the file name). -
sampling_args
: list of arguments tosampling
.
The elements file
, data
, and inits
take precendence over
corresponding entries in stan_model_args
or sampling_args
.
If elements warmup
, iter
, and/or thin
are provided in
sampling_args
, those take precedence over corresponding values in
the MCMCcontrol
argument to compareMCMCs
. Otherwise iter
is
set to MCMCcontrol$niter
and warmup
is set to
MCMCcontrol$niter/2
. Only one chain will be run.
Total sampling time for Stan is recorded via
system.call(sampling(...))
. This is similar to how time is
recorded for other MCMCs. The warmup time (called "burnin" in
compareMCMCs
for consistency across different MCMCs) is obtained
from rstan
function get_elapsed_time
. The post-burnin time is
the total sampling time minus the burnin time.