Manages the input and output for multiple calls to MCMCsuite to generate comparisons among MCMCs
compareMCMCs(modelInfo, MCMCs = c("nimble"), MCMCdefs, BUGSdir, stanDir,
stanInfo, doSamplePlots = FALSE, verbose = TRUE, summary = TRUE, ...)
A set of model information for which one or more MCMCs should be run. Can take one of several formats: (1) a character vector of names of classic WinBUGS examples. (2) for one model, a list with elements code
(containing the model code as returned by nimbleCode
), data
(containing a list of data that can be provided to nimbleModel
, constants
(containing a list of constants to be provided to nimbleModel
), inits
(containing a list of initial values that can be provided to nimbleModel
; this is optional unless it is needed to match names in some of the other arguments, as described below), and name
(a character name; this is optional). (3) for multiple models, a list of lists formatted as per option (2). See nimbleModel
about handling of data vs. constants. In particular, if both are provided in data, then nimbleModel
will try to determine which is which.
An object acceptable as the MCMCs
argument to MCMCsuite
. This specifies the set of MCMCs to be run. Valid entries include 'jags', 'nimble', 'nimble_RW', 'nimble_slice', 'autoBlock', 'stan', 'winbugs', 'openbugs', or a name provided in the MCMCdefs
list.
An optional object acceptable as the MCMCdefs
argument to MCMCsuite
.
If models
is a character vector of WinBUGS example names, BUGSdir
can optionally provide the directory (as a character string) where to find them. If missing, they will be looked up in the installed nimble
package using getBUGSexampleDir
.
Optional base directory in which Stan model code will be found (but stanInfo
can override this).
A list of information for finding and using the Stan code for each model. If names of list elements are provided, they will be used to match either the character vector of names provided for models
(option (1)) or the list names of models
(options (2) or (3)). If names are not provided, the models will be used in order. Each element must be a list that can or must include (i) dir
(optional: the subdirectory to use, instead of stanDir
; often the subdirectory is the model name). (ii) codeFile
(optional: the name of the stan code file, to which ".stan" will be appended if not already there; if omitted, this will be set to the value of modelName
. (iii) data
(optional: the name of a the stan data file, to which ".data.R" will be appended if not already there; if omitted, the system will try using stanCodeFile with ".data.R" appended). (iv) inits
(optional: the name of a the stan inits file, to which ".init.R" will be appended if not already there; if omitted, the system will try using stanCodeFile with ".init.R" appended). (v) modelName
(optional: a name for the model; if omitted, a value from the models
argument will be used). (vi) stanParameterRules
(optional: a list whose names are BUGS variable names, with each element a list with element StanSourceName
to give the corresponding Stan variable name and transform
to give a function that converts a value of the Stan variable to a value of the BUGS variable).
(default FALSE) This is passed to MCMCsuite
as both the makePlots
and savePlots
argument.
(default FALSE) If TRUE, a message will be shown about which model is being worked on.
(deafault TRUE) If TRUE, the return value will be a list with elements summary
, timing
and efficiency
. If FALSE, the return value will be the return value generated by MCMCsuite
. Among other things, the latter contains the actual samples.
additional arguments to be passed to MCMCsuite
.
If summary
is FALSE, compareMCMCs
returns the object returned by MCMCsuite
, which comes from MCMCsuiteClass
. If summary
is TRUE, it returns a list with elements timing, efficiency, and summary.
compareMCMCs wraps a call to MCMCsuite
MCMCsuiteClass
, updateMCMCcomparisonWithHighOrderESS
, make_MCMC_comparison_pages
, reshape_comparison_results
, combine_MCMC_comparison_results
, rename_MCMC_comparison_method
, reshape_comparison_results
.