Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

decideAndJump

Creates a nimbleFunction for executing the Metropolis-Hastings jumping decision, and updating values in the model, or in a carbon copy modelValues object, accordingly.


Description

This nimbleFunction generator must be specialized to three required arguments: a model, a modelValues, and a character vector of node names.

Usage

decideAndJump(model, mvSaved, target, calcNodes)

Arguments

model

An uncompiled or compiled NIMBLE model object.

mvSaved

A modelValues object containing identical variables and logProb variables as the model. Can be created by modelValues(model).

target

A character vector providing the target node.

calcNodes

A character vector representing a set of nodes in the model (and hence also the modelValues) object.

Details

Calling decideAndJump(model, mvSaved, calcNodes) will generate a specialized nimbleFunction with four required numeric arguments:

modelLP1: The model log-probability associated with the newly proposed value(s)

modelLP0: The model log-probability associated with the original value(s)

propLP1: The log-probability associated with the proposal forward-transition

propLP0: The log-probability associated with the proposal reverse-tranisiton

Executing this function has the following effects: – Calculate the (log) Metropolis-Hastings ratio, as logMHR = modelLP1 - modelLP0 - propLP1 + propLP0 – Make the proposal acceptance decision based upon the (log) Metropolis-Hastings ratio – If the proposal is accepted, the values and associated logProbs of all calcNodes are copied from the model object into the mvSaved object – If the proposal is rejected, the values and associated logProbs of all calcNodes are copied from the mvSaved object into the model object – Return a logical value, indicating whether the proposal was accepted

Author(s)

Daniel Turek


nimble

MCMC, Particle Filtering, and Programmable Hierarchical Modeling

v0.11.0
BSD_3_clause + file LICENSE | GPL (>= 2)
Authors
Perry de Valpine [aut], Christopher Paciorek [aut, cre], Daniel Turek [aut], Nick Michaud [aut], Cliff Anderson-Bergman [aut], Fritz Obermeyer [aut], Claudia Wehrhahn Cortes [aut] (Bayesian nonparametrics system), Abel Rodrìguez [aut] (Bayesian nonparametrics system), Duncan Temple Lang [aut] (packaging configuration), Sally Paganin [aut] (reversible jump MCMC), Jagadish Babu [ctb] (code for the compilation system for an early version of NIMBLE), Lauren Ponisio [ctb] (contributions to the cross-validation code), Peter Sujan [ctb] (multivariate t distribution code)
Initial release
2021-04-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.