Download NIMBLE User Manual
Transcript
CHAPTER 7. MCMC 69 Default monitors The default MCMC configuration includes monitors on all top-level stochastic nodes of the model. Automated parameter blocking The default configuration may be replaced by that generated from an automated parameter blocking algorithm. This algorithm determines groupings of model nodes that, when jointly sampled with a RW block sampler, increase overall MCMC efficiency. Overall efficiency is defined as the effective sample size of the slowest-mixing node divided by computation time. This is done by: autoBlockSpec <- configureMCMC(Rmodel, autoBlock = TRUE) In this usage, the additional control argument autoIt may also be provided to indicate the number of MCMC samples to be used in the automated blocking procedure (default 20,000). Note that this function compiles and runs MCMCs, progressively exploring different sampler assignments, so it takes some time and generates some output. 7.1.2 Customizing the MCMC configuration The MCMC configuration may be customized in a variety of ways, either through additional named arguments to configureMCMC or by calling member methods of an existing MCMCspec object. Default samplers for particular nodes One can create an MCMC configuration with default samplers on just a particular set of nodes using the nodes argument to configureMCMC. The value for the nodes argument may be a character vector containing node and/or variable names. In the case of a variable name, a default sampler will be added for all stochastic nodes in the variable. If the nodes argument is provided, default samplers are created only for the stochastic nodes specified by this argument (possibly including data nodes), and the ordering of these sampling algorithms matches the ordering within the nodes argument. It is worthwhile to note this is the only way in which a sampler may be placed on a data node, which upon execution of the MCMC will overwrite any value stored in the data node. Creating a configuration with no samplers If you plan to customize the choice of all samplers, it can be useful to obtain a configuration with no sampler assignments at all. This can be done by providing the nodes argument with the value NULL, character(), or list().