compareMCMCs {compareMCMCs} | R Documentation |
Run a set of MCMCs for performance comparison
Description
Run one or more MCMC engines for one model specification, with timing and performance metrics calculated. See details for special case of precompiled nimble MCMCs.
Usage
compareMCMCs(
modelInfo = list(),
MCMCcontrol = list(niter = 10000, thin = 1, burnin = 2000),
MCMCs = names(nimbleMCMCdefs),
monitors = character(),
nimbleMCMCdefs = list(),
externalMCMCinfo = list(),
metrics = c("mean", "median", "sd", "CI95_low", "CI95_upp", "efficiency_coda"),
metricOptions = list(),
conversions = list(),
seed = NULL,
needRmodel,
verbose = TRUE,
sessionInfo = TRUE
)
Arguments
modelInfo |
A list of nimble model-specification information (which may
be relevant for JAGS, WinBUGS and/or OpenBUGS as well) and/or a nimble
model itself. To provide information for a different MCMC engine, see
argument |
MCMCcontrol |
A list with fields |
MCMCs |
A character vector of MCMC cases to run. This can include
"nimble" (default nimble samplers), "jags", "stan", one of several nimble
special cases (see details below), custom nimble sampler configurations
provided via argument |
monitors |
A character vector of variable names to monitor (record in MCMC output). If missing, this will be determined from the nimble model as all top-level parameter names (e.g. hyper-parameters). |
nimbleMCMCdefs |
A list of information for custom sampler configurations
in nimble. See package vignette for details. If a compiled nimble model
is provided in |
externalMCMCinfo |
A list of arbitrary information for
external MCMC engines, named by engine names. If there is an
external MCMC engine named "myMCMC", then a list element |
metrics |
Either a character vector of registered metric names
to apply to each sample, or a list of elements with either
metric names or metric functions to apply to each sample. See
|
metricOptions |
Optional named list of individual metric
options passed as the third argument (" |
conversions |
List of parameter conversion (transformation) specifications, useful when different MCMCs use different parameterizations. |
seed |
An (arbitrary) numeric value passed to |
needRmodel |
If |
verbose |
If |
sessionInfo |
If |
Details
The special cases provided for the MCMCs
argument
include:
"nimble_noConj": use adaptive random-walk Metropolis-Hastings (ARWMH) samplers in place of Gibbs (conjugate) samplers.
"nimble_RW": use all adaptive random-walk Metropolis-Hastings samplers.
"nimble_slice": use all slice samplers.
If you have already used compileNimble
to compile both a nimble model and
one or more nimble MCMCs, provide the compiled model as modelInfo$model
and
provide the compiled MCMCs as elements of a named list for nimbleMCMCdefs
.
In that case, the monitors will already be set in the MCMCs and can't be
changed. However, you can still use the monitors
argument to subset and/or
re-order the monitored nodes (parameters).
See package vignette for more details and examples.
Value
A list of MCMCresult
objects.